aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-07 17:10:02 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-12 20:41:34 +0200
commit944ec58852a316bf00b564c5a09376ba81d595a2 (patch)
tree73e99c3e7ed7af72e743c1501022df6620c2a7f2
parent268defa6efa18fc4b9a226c5d58f0e50ce2d0846 (diff)
Add mkwinbins.sh based script to setup a mingw development enviroment
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rwxr-xr-xscripts/w32devenv.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/w32devenv.sh b/scripts/w32devenv.sh
new file mode 100755
index 0000000..1b579bc
--- /dev/null
+++ b/scripts/w32devenv.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -e
+
+VERSION=$(grep AC_INIT configure.ac | grep -o \\[[0-9.]*\\] | tr -d [])
+
+W64_DIR="$(pwd)/w32deps"
+W64_PREFIX="x86_64-w64-mingw32"
+
+mkdir -p "$W64_DIR"
+
+################################ get binaries ################################
+
+PKG_DIR="squashfs-tools-ng-${VERSION}-mingw64"
+PKG_TAR="${PKG_DIR}.zip"
+PKG_URL="https://infraroot.at/pub/squashfs/windows"
+PKG_HASH="029d75c28af656e3deb35dac1e433b30e278f42077a8fea3e2e9d4dc34dc458c"
+
+[ -f "$W64_DIR/$PKG_TAR" ] || {
+ curl -s -L "$PKG_URL/$PKG_TAR" > "$W64_DIR/$PKG_TAR"
+ echo "$PKG_HASH $W64_DIR/$PKG_TAR" | sha256sum -c --quiet "-"
+}
+
+[ -d "$W64_DIR/$PKG_DIR" ] || {
+ unzip "$W64_DIR/$PKG_TAR" -d "$W64_DIR"
+}
+
+pushd "$W64_DIR/$PKG_DIR"
+rm bin/*.exe
+rm bin/libsquashfs.dll
+rm -r include/sqfs
+rm lib/libsquashfs.dll.a
+rm lib/libsquashfs.a
+
+mv bin "$W64_DIR"
+mv lib "$W64_DIR"
+mv include "$W64_DIR"
+popd
+
+################################ build 64 bit ################################
+
+export PKG_CONFIG_PATH="$W64_DIR/lib/pkgconfig"
+
+./autogen.sh
+./configure CFLAGS="-O2" LZO_CFLAGS="-I$W64_DIR/include" \
+ LZO_LIBS="-L$W64_DIR/lib -llzo2" \
+ BZIP2_CFLAGS="-I$W64_DIR/include" \
+ BZIP2_LIBS="-L$W64_DIR/lib -lbz2" \
+ --prefix="$W64_DIR" --host="$W64_PREFIX"