diff scripts/win32/deploy_build.sh @ 249:6b2441c776dd

*: merge
author Paper <mrpapersonic@gmail.com>
date Wed, 24 Jan 2024 20:18:59 -0500
parents 3a4aa9b4814c
children 699a20c57dc8
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/win32/deploy_build.sh	Wed Jan 24 20:18:59 2024 -0500
@@ -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
+		lib="$(cut -d' ' -f3 <<< $dependency)"
+		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"