diff scripts/win32/deploy_build.sh @ 300:8eb0cfe59992

CI/windows: attempt to fix the build
author Paper <paper@paper.us.eu.org>
date Mon, 13 May 2024 14:56:37 -0400
parents dec4d3c9a909
children 1faa72660932
line wrap: on
line diff
--- a/scripts/win32/deploy_build.sh	Mon May 13 14:15:47 2024 -0400
+++ b/scripts/win32/deploy_build.sh	Mon May 13 14:56:37 2024 -0400
@@ -4,15 +4,22 @@
 #
 # this also runs windeployqt to deploy qt crap
 # as well
+#
+# note: ldd is NOT a standard ldd; it's mingw-ldd
+# from pypi which works much well when cross
+# compiling using something like quasi-msys2
 
+# you can override the paths to these at runtime
 DIR="${DIR:-minori}"
+LDD="${LDD:-mingw-ldd}"
 
 GetNeededLibraries() {
 	# do not run this on untrusted executables.
 	# see: ldd(1)
 	system="$(echo "$MSYSTEM" | tr "[:upper:]" "[:lower:]")"
-	ldd "$1" | while IFS="" read -r dependency; do
-		lib="$(printf -- "$dependency" | cut -d' ' -f3)"
+	"$LDD" --output-format ldd-like --dll-lookup-dirs "/$system/bin" -- "$1" | while IFS="" read -r dependency; do
+		# trim whitespace, then get the value; mingw-ldd's "ldd-like" output doesn't use tabs like regular ldd
+		lib="$(printf -- "%s" "$dependency" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | cut -d' ' -f3)"
 		case $lib in
 			"/$system/"*)
 				printf -- "$lib\n"
@@ -24,7 +31,7 @@
 }
 
 
-if [ -d "$DIR" ]; then
+if test -d "$DIR"; then
 	rm -r "$DIR"
 fi