comparison 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
comparison
equal deleted inserted replaced
260:2552756f2876 261:f6a99b984b8e
6 BUILDPATH="win32/" 6 BUILDPATH="win32/"
7 7
8 QT5_PREFIX="/misc/packages/qt5-src" 8 QT5_PREFIX="/misc/packages/qt5-src"
9 QT5_BASE="${QT5_PREFIX}/qtbase" 9 QT5_BASE="${QT5_PREFIX}/qtbase"
10 10
11 MINGWPATH=$(dirname $(i686-w64-mingw32-g++ -print-prog-name=cc1)) 11 MINGWPATH="$(dirname $(i686-w64-mingw32-g++ -print-prog-name=cc1))"
12 MINGWLIBS="/usr/i686-w64-mingw32/lib/"
13
14
15 fatal()
16 {
17 echo "ERROR: $1"
18 exit 1
19 }
20
21
22 do_cp()
23 {
24 cp -f "$1" "$2" || fatal "Could not copy file '$1' to '$2'."
25 }
26
27
28 do_mkdir()
29 {
30 mkdir -p "$1" || fatal "Could not create directory '$1'."
31 }
32
12 33
13 do_cpinstall() 34 do_cpinstall()
14 { 35 {
15 # $1 src base path 36 # $1 src base path
16 # $2 dst base path 37 # $2 dst base path
17 # $3 common sub path 38 # $3 common sub path
18 # $4 filename 39 # $4 filename
19 40
20 mkdir -p "$2/$3" 41 do_mkdir "$2/$3"
21 cp -f "$1/$3/$4" "$2/$3/$4" 42 do_cp "$1/$3/$4" "$2/$3/$4"
22 } 43 }
23 44
24 do_install() 45 do_install()
25 { 46 {
26 TARGET="$1" 47 TARGET="$1"
48
27 if test -d "$TARGET"; then 49 if test -d "$TARGET"; then
28 rm -fr "$TARGET" 50 rm -fr "$TARGET"
29 else 51 elif test -e "$TARGET"; then
30 echo "ERROR: Target '$TARGET' exists but is not a directory!" 52 fatal "Target '$TARGET' exists but is not a directory!"
31 return 1
32 fi
33 if ! mkdir -p "$TARGET"; then
34 echo "ERROR: Could not create target directory '$TARGET'."
35 return 1
36 fi 53 fi
37 54
38 echo "Installing to '$TARGET' ..." 55 mkdir -p "$TARGET" || fatal "Could not create target directory '$TARGET'."
39 56
40 do_cpinstall "$QT5_BASE/plugins/" "$TARGET" "platforms" "qwindows.dll" 57 echo "Installing to '${TARGET}' ..."
41 do_cpinstall "$QT5_BASE/plugins/" "$TARGET" "sqldrivers" "qsqlite.dll" 58
42 do_cpinstall "$QT5_BASE/plugins/" "$TARGET" "printsupport" "windowsprintersupport.dll" 59 do_cpinstall "${QT5_BASE}/plugins/" "$TARGET" "platforms" "qwindows.dll"
60 do_cpinstall "${QT5_BASE}/plugins/" "$TARGET" "sqldrivers" "qsqlite.dll"
61 do_cpinstall "${QT5_BASE}/plugins/" "$TARGET" "printsupport" "windowsprintersupport.dll"
43 62
44 for i in Core Gui Sql Widgets PrintSupport Network; do 63 for i in Core Gui Sql Widgets PrintSupport Network; do
45 cp -f "$QT5_BASE/lib/Qt5$i.dll" "$TARGET" 64 do_cp "${QT5_BASE}/lib/Qt5${i}.dll" "$TARGET"
46 done 65 done
47 66
48 for i in libstdc++-6 libgcc_s_sjlj-1; do 67 for i in libstdc++-6 libgcc_s_sjlj-1; do
49 cp -f "$MINGWPATH/$i.dll" "$TARGET" 68 do_cp "${MINGWPATH}/${i}.dll" "$TARGET"
50 strip "$TARGET/$i.dll" 69 strip "${TARGET}/${i}.dll"
51 done 70 done
52 71
53 cp -f "$BUILDPATH/Syntilista.exe" "$TARGET" 72 for i in zlib1.dll; do
54 unix2dos -n "COPYING.html" "$TMPFILE" && cp -f "$TMPFILE" "$TARGET/COPYING.txt" 73 do_cp "${MINGWLIBS}/${i}" "$TARGET"
74 done
75
76 do_cp "$BUILDPATH/Syntilista.exe" "$TARGET"
77 unix2dos -n "COPYING.html" "$TMPFILE" || fatal "Could not unix2dos."
78 do_cp "$TMPFILE" "$TARGET/COPYING.txt"
55 rm -f "$TMPFILE" 79 rm -f "$TMPFILE"
56 return 0 80 return 0
57 } 81 }
58 82
59 83