diff scripts/win32/deploy_build.sh @ 243:ed5ab3896666

autotools: add `-mwindows` and windows deploy script
author Paper <paper@paper.us.eu.org>
date Mon, 22 Jan 2024 19:54:41 -0800
parents
children 3a4aa9b4814c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/win32/deploy_build.sh	Mon Jan 22 19:54:41 2024 -0800
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# deploys needed libraries for minori on win32
+#
+# this also runs windeployqt to deploy qt crap
+# as well
+
+DIR="${DIR:-minori}"
+
+GetNeededLibraries() {
+	# do not run this on untrusted executables.
+	# see: ldd(1)
+	ldd "$1" | while IFS="" read -r dependency; do
+		fields=($dependency)
+		lib="${fields[2]}"
+		if [[ "$lib" == /"${MSYSTEM,,}"/* ]]; then
+			echo "$lib"
+		fi
+	done
+}
+
+if [ -d "$DIR" ]; then
+	rm -r "$DIR"
+fi
+
+mkdir "$DIR"
+
+for lib in $(GetNeededLibraries ".libs/minori.exe"); do
+	cp "$lib" "$DIR/"
+done
+
+cp ".libs/minori.exe" "$DIR/"
+
+windeployqt "$DIR/minori.exe"
+
+zip -r "$DIR.zip" "$DIR"