annotate build-win32.sh @ 261:f6a99b984b8e

Clean up build script a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 24 Dec 2019 05:38:12 +0200
parents f65e0de45c2b
children 8c6fb6ee6f9e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
50
402446a76794 And more build system work.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
6 BUILDPATH="win32/"
69
a242548ccce8 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
7
a242548ccce8 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
8 QT5_PREFIX="/misc/packages/qt5-src"
a242548ccce8 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
9 QT5_BASE="${QT5_PREFIX}/qtbase"
a242548ccce8 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
10
261
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
11 MINGWPATH="$(dirname $(i686-w64-mingw32-g++ -print-prog-name=cc1))"
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
12 MINGWLIBS="/usr/i686-w64-mingw32/lib/"
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
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
15 fatal()
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
16 {
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
17 echo "ERROR: $1"
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
18 exit 1
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
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
22 do_cp()
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
23 {
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
24 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
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
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
28 do_mkdir()
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
29 {
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
30 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
31 }
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
32
28
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 do_cpinstall()
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 {
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 # $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
37 # $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
38 # $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
39 # $4 filename
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
261
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
41 do_mkdir "$2/$3"
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
42 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
43 }
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
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
261
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
59 do_cpinstall "${QT5_BASE}/plugins/" "$TARGET" "platforms" "qwindows.dll"
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
60 do_cpinstall "${QT5_BASE}/plugins/" "$TARGET" "sqldrivers" "qsqlite.dll"
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
61 do_cpinstall "${QT5_BASE}/plugins/" "$TARGET" "printsupport" "windowsprintersupport.dll"
69
a242548ccce8 Build system cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 59
diff changeset
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
261
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
64 do_cp "${QT5_BASE}/lib/Qt5${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
261
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
68 do_cp "${MINGWPATH}/${i}.dll" "$TARGET"
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
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
73 do_cp "${MINGWLIBS}/${i}" "$TARGET"
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
f6a99b984b8e Clean up build script a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 257
diff changeset
76 do_cp "$BUILDPATH/Syntilista.exe" "$TARGET"
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"
50
402446a76794 And more build system work.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
80 return 0
28
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 }
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
29
0129b619511c Check for qt5 crossbuild qmake before trying to build anything.
Matti Hamalainen <ccr@tnsp.org>
parents: 28
diff changeset
83
50
402446a76794 And more build system work.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
84 ### Create cross-building makefiles
257
f65e0de45c2b Rename the MinGW cross-build Makefile as it is no longer win32 only.
Matti Hamalainen <ccr@tnsp.org>
parents: 235
diff changeset
85 make -f Makefile.cross-mingw QT5_PREFIX="$QT5_PREFIX" BINPATH="$BUILDPATH"
37
3d1990eb1020 Actually run qmake.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
86
50
402446a76794 And more build system work.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
87 ### Install to targets
227
07e7f254ef16 Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents: 215
diff changeset
88 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
89 do_install "$INSTALL_USB/Syntilista"
07e7f254ef16 Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents: 215
diff changeset
90 else
07e7f254ef16 Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents: 215
diff changeset
91 echo "INFO: '$INSTALL_USB' is not mounted. Not installing."
07e7f254ef16 Improve windows build script.
Matti Hamalainen <ccr@tnsp.org>
parents: 215
diff changeset
92 fi
28
b749685958d7 Add a script that performs the win32 cross-build (only the Syntilista
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 do_install "$INSTALL_WINE"