Mercurial > hg > syntilista
annotate build-win32.sh @ 300:3cca82bced54
Fix Qt DLL source path.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 11 May 2023 13:58:28 +0300 |
parents | 02d2dec01f0f |
children |
rev | line source |
---|---|
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 #!/bin/sh |
227
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
2 INSTALL_USB="/mnt/sdb1" |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 INSTALL_WINE="$HOME/.wine/drive_c/Syntilista/" |
72
cde3d200967c
Use temporary file for unix2dos because of exfat limitations causing warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
69
diff
changeset
|
4 TMPFILE="unix2dos.tmp" |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
6 MINGW_CPP="i686-w64-mingw32-g++" |
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
7 BINPATH="win32/" |
69 | 8 |
283
958451fcd85a
Rename various variables etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
9 QT_VERSION_PREFIX="Qt5" |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
10 QT_BASE="/misc/packages/qt5-src/qtbase" |
69 | 11 |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
12 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
13 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
14 fatal() |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
15 { |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
16 echo "ERROR: $1" |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
17 exit 1 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
18 } |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
19 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
20 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
21 do_cp() |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
22 { |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
23 cp -f "$1" "$2" || fatal "Could not copy file '$1' to '$2'." |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
24 } |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
25 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
26 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
27 do_mkdir() |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
28 { |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
29 mkdir -p "$1" || fatal "Could not create directory '$1'." |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
30 } |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
31 |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 do_cpinstall() |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 { |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 # $1 src base path |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 # $2 dst base path |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 # $3 common sub path |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 # $4 filename |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
40 do_mkdir "$2/$3" |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
41 do_cp "$1/$3/$4" "$2/$3/$4" |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 } |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
43 |
270 | 44 |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
45 do_install() |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 { |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 TARGET="$1" |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
48 |
227
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
49 if test -d "$TARGET"; then |
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
50 rm -fr "$TARGET" |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
51 elif test -e "$TARGET"; then |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
52 fatal "Target '$TARGET' exists but is not a directory!" |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 fi |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
55 mkdir -p "$TARGET" || fatal "Could not create target directory '$TARGET'." |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
56 |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
57 echo "Installing to '${TARGET}' ..." |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
58 |
283
958451fcd85a
Rename various variables etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
59 do_cpinstall "${QT_BASE}/plugins/" "$TARGET" "platforms" "qwindows.dll" |
958451fcd85a
Rename various variables etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
60 do_cpinstall "${QT_BASE}/plugins/" "$TARGET" "sqldrivers" "qsqlite.dll" |
958451fcd85a
Rename various variables etc.
Matti Hamalainen <ccr@tnsp.org>
parents:
270
diff
changeset
|
61 do_cpinstall "${QT_BASE}/plugins/" "$TARGET" "printsupport" "windowsprintersupport.dll" |
69 | 62 |
142
36c9cb759326
Implement simple SQLite database backup at program exit using Qt HTTP/HTTPS
Matti Hamalainen <ccr@tnsp.org>
parents:
114
diff
changeset
|
63 for i in Core Gui Sql Widgets PrintSupport Network; do |
300 | 64 do_cp "${QT_BASE}/bin/${QT_VERSION_PREFIX}${i}.dll" "$TARGET" |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
65 done |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 for i in libstdc++-6 libgcc_s_sjlj-1; do |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
68 do_cp "${MINGW_PATH}/${i}.dll" "$TARGET" |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
69 strip "${TARGET}/${i}.dll" |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 done |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
71 |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
72 for i in zlib1.dll; do |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
73 do_cp "${MINGW_LIBS}/${i}" "$TARGET" |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
74 done |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
75 |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
76 do_cp "$BINPATH/Syntilista.exe" "$TARGET" |
261
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
77 unix2dos -n "COPYING.html" "$TMPFILE" || fatal "Could not unix2dos." |
f6a99b984b8e
Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
78 do_cp "$TMPFILE" "$TARGET/COPYING.txt" |
72
cde3d200967c
Use temporary file for unix2dos because of exfat limitations causing warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
69
diff
changeset
|
79 rm -f "$TMPFILE" |
28
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
80 } |
b749685958d7
Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
81 |
29
0129b619511c
Check for qt5 crossbuild qmake before trying to build anything.
Matti Hamalainen <ccr@tnsp.org>
parents:
28
diff
changeset
|
82 |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
83 ### Check dirs |
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
84 MINGW_PATH="$(dirname $(realpath $($MINGW_CPP -print-prog-name=cc1)))" |
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
85 MINGW_LIBS="$(dirname $(realpath $($MINGW_CPP -print-file-name=zlib1.dll)))" |
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
86 test -d "$MINGW_PATH" || fatal "Could not find MinGW C++ compiler path!" |
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
87 test -d "$MINGW_LIBS" || fatal "Could not find MinGW library path (zlib1.dll not found)" |
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
88 |
270 | 89 ### Build the binaries |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
90 echo "QT: ${QT_BASE} / MinGW: ${MINGW_PATH}" |
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
91 make -f Makefile.cross-mingw QT_PREFIX="$QT_BASE" BINPATH="$BINPATH" || fatal "Compilation failed." |
37 | 92 |
50 | 93 ### Install to targets |
227
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
94 if test -d "$INSTALL_USB" && mount|grep -q "$INSTALL_USB"; then |
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
95 do_install "$INSTALL_USB/Syntilista" |
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
96 else |
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
97 echo "INFO: '$INSTALL_USB' is not mounted. Not installing." |
07e7f254ef16
Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
98 fi |
298
02d2dec01f0f
Fixes to the win32 build script.
Matti Hamalainen <ccr@tnsp.org>
parents:
283
diff
changeset
|
99 #do_install "$INSTALL_WINE" |