changeset 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 246017a7907a
children b1f625b0227c
files .builds/windows.yml scripts/win32/deploy_build.sh
diffstat 2 files changed, 71 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/.builds/windows.yml	Mon May 13 14:15:47 2024 -0400
+++ b/.builds/windows.yml	Mon May 13 14:56:37 2024 -0400
@@ -1,60 +1,62 @@
-image: debian/bookworm
-packages:
-  - autoconf
-  - automake
-  - libtool
-  - autotools-dev
-  - pkg-config
-  - libcurl4-openssl-dev
-  - wget
-  - tar
-  - zstd
-  - gpg
-  - clang
-  - lld
-  - xz-utils
-  - wine
-  - ncurses-bin
-  - qtbase5-dev
-  - qttools5-dev
-  - zip
-sources:
-  - hg+https://hg.sr.ht/~mrpapersonic/minori
-environment:
-  BUILD_SUBMITTER: hg.sr.ht
-tasks:
-  - build-win64: |
-      export WINEARCH=win64
-      git clone https://github.com/holyblackcat/quasi-msys2 quasi-msys2-win64
-      cd quasi-msys2-win64
-      echo MINGW64 >msystem.txt
-      make install _gcc _qt5-base _qt5-tools _curl
-      cd ../minori
-      autoreconf -i
-      mkdir build64
-      cd build64
-      sudo bash -c 'echo -n 1 >/proc/sys/fs/binfmt_misc/status'
-      bash -c 'source ../../quasi-msys2-win64/env/all.src && ../configure && make && env DIR=minori64 bash ../scripts/win32/deploy_build.sh'
-  - get-wine32: |
-      sudo dpkg --add-architecture i386
-      sudo apt-get update
-      sudo apt-get -y install wine32:i386
-  - build-win32: |
-      export WINEARCH=win32
-      export WINEPREFIX="$HOME/.wine32"
-      git clone https://github.com/holyblackcat/quasi-msys2 quasi-msys2-win32
-      cd quasi-msys2-win32
-      echo MINGW32 >msystem.txt
-      make install _gcc _qt5-base _qt5-tools _curl
-      cd ../minori
-      mkdir build32
-      cd build32
-      sudo bash -c 'echo -n 1 >/proc/sys/fs/binfmt_misc/status'
-      bash -c 'source ../../quasi-msys2-win32/env/all.src && ../configure && make && env DIR=minori32 bash ../scripts/win32/deploy_build.sh'
-artifacts:
-  - minori/build64/minori64.zip
-  - minori/build32/minori32.zip
-triggers:
-  - action: email
-    condition: failure
+image: debian/bookworm
+packages:
+  - autoconf
+  - automake
+  - libtool
+  - autotools-dev
+  - pkg-config
+  - libcurl4-openssl-dev
+  - wget
+  - tar
+  - zstd
+  - gpg
+  - clang
+  - lld
+  - xz-utils
+  - wine
+  - ncurses-bin
+  - qtbase5-dev
+  - qttools5-dev
+  - python3-pip
+  - zip
+sources:
+  - hg+https://hg.sr.ht/~mrpapersonic/minori
+environment:
+  BUILD_SUBMITTER: hg.sr.ht
+tasks:
+  - build-win64: |
+      export WINEARCH=win64
+      git clone https://github.com/holyblackcat/quasi-msys2 quasi-msys2-win64
+      cd quasi-msys2-win64
+      echo MINGW64 >msystem.txt
+      make install _gcc _qt5-base _qt5-tools _curl
+      cd ../minori
+      autoreconf -i
+      mkdir build64
+      cd build64
+      sudo bash -c 'echo -n 1 >/proc/sys/fs/binfmt_misc/status'
+      python3 -m pip install --user --break-system-packages mingw-ldd
+      bash -c 'source ../../quasi-msys2-win64/env/all.src && ../configure && make && env DIR=minori64 LDD="$HOME/.local/bin/mingw-ldd" sh ../scripts/win32/deploy_build.sh'
+  - get-wine32: |
+      sudo dpkg --add-architecture i386
+      sudo apt-get update
+      sudo apt-get -y install wine32:i386
+  - build-win32: |
+      export WINEARCH=win32
+      export WINEPREFIX="$HOME/.wine32"
+      git clone https://github.com/holyblackcat/quasi-msys2 quasi-msys2-win32
+      cd quasi-msys2-win32
+      echo MINGW32 >msystem.txt
+      make install _gcc _qt5-base _qt5-tools _curl
+      cd ../minori
+      mkdir build32
+      cd build32
+      sudo bash -c 'echo -n 1 >/proc/sys/fs/binfmt_misc/status'
+      bash -c 'source ../../quasi-msys2-win32/env/all.src && ../configure && make && env DIR=minori32 LDD="$HOME/.local/bin/mingw-ldd" sh ../scripts/win32/deploy_build.sh'
+artifacts:
+  - minori/build64/minori64.zip
+  - minori/build32/minori32.zip
+triggers:
+  - action: email
+    condition: failure
     to: Paper <mrpapersonic@gmail.com>
\ No newline at end of file
--- 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