annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
296
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
1 #!/bin/sh
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
2 #
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
3 # deploys needed libraries for minori on win32
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
4 #
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
5 # this also runs windeployqt to deploy qt crap
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
6 # as well
300
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
7 #
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
8 # note: ldd is NOT a standard ldd; it's mingw-ldd
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
9 # from pypi which works much well when cross
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
10 # compiling using something like quasi-msys2
296
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
11
300
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
12 # you can override the paths to these at runtime
296
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
13 DIR="${DIR:-minori}"
300
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
14 LDD="${LDD:-mingw-ldd}"
296
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
15
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
16 GetNeededLibraries() {
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
17 # do not run this on untrusted executables.
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
18 # see: ldd(1)
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
19 system="$(echo "$MSYSTEM" | tr "[:upper:]" "[:lower:]")"
300
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
20 "$LDD" --output-format ldd-like --dll-lookup-dirs "/$system/bin" -- "$1" | while IFS="" read -r dependency; do
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
21 # trim whitespace, then get the value; mingw-ldd's "ldd-like" output doesn't use tabs like regular ldd
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
22 lib="$(printf -- "%s" "$dependency" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | cut -d' ' -f3)"
296
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
23 case $lib in
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
24 "/$system/"*)
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
25 printf -- "$lib\n"
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
26 ;;
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
27 *)
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
28 ;;
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
29 esac
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
30 done
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
31 }
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
32
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
33
300
8eb0cfe59992 CI/windows: attempt to fix the build
Paper <paper@paper.us.eu.org>
parents: 298
diff changeset
34 if test -d "$DIR"; then
296
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
35 rm -r "$DIR"
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
36 fi
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
37
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
38 mkdir "$DIR"
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
39
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
40 for lib in $(GetNeededLibraries ".libs/minori.exe"); do
298
dec4d3c9a909 scripts/win32/deploy_build: be more verbose with libs
Paper <paper@paper.us.eu.org>
parents: 296
diff changeset
41 echo "copying '$lib' to $DIR"
296
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
42 cp "$lib" "$DIR/"
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
43 done
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
44
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
45 cp ".libs/minori.exe" "$DIR/"
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
46
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
47 windeployqt "$DIR/minori.exe"
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
48
b2a4358da16c scripts/win32: CRLF -> LF
Paper <paper@paper.us.eu.org>
parents: 257
diff changeset
49 zip -r "$DIR.zip" "$DIR"