Dependencies build scripts unification
[novacoin.git] / mingw64_deps / qt / build.sh
1 #!/bin/bash
2
3 TARGET_CPU=$1
4 TARGET_OS=$2
5 ROOT=$(pwd)
6
7 if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
8 echo "Platform ${TARGET_CPU} is not supported"
9 echo "Expected either aarch64 or x86_64."
10 exit 1
11 fi
12
13 if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
14 echo "Operation sysrem ${TARGET_OS} is not supported"
15 echo "Expected either w64-mingw32 or linux-gnu."
16 exit 1
17 fi
18
19 # Cross-building prefix
20 CROSS=${TARGET_CPU}-${TARGET_OS}
21
22 if [[ ! $(which ${CROSS}-gcc) ]]; then
23 echo "Target C compiler ${CROSS}-gcc is not found"
24 exit 1
25 fi
26
27 if [[ ! $(which ${CROSS}-g++) ]]; then
28 echo "Target C++ compiler ${CROSS}-g++ is not found"
29 exit 1
30 fi
31
32 if [[ ! $(which make) ]]; then
33 echo "make is not installed, please install buld-essential package"
34 exit 1
35 fi
36
37 if [ "${TARGET_OS}" == "w64-mingw32" ]; then
38     TARGET_PARAMS="win32-clang-g++ -no-freetype"
39 else
40     if [ "${TARGET_CPU}" == "aarch64" ]; then
41         TARGET_PARAMS="linux-aarch64-gnu-g++"
42     else
43         TARGET_PARAMS="linux-g++-64"
44     fi
45 fi
46
47 # Make build directories
48 mkdir ${ROOT}/${CROSS}-build
49 mkdir ${ROOT}/${CROSS}-build-qttools
50 mkdir ${ROOT}/${CROSS}-build-qttranslations
51 mkdir ${ROOT}/${CROSS}-build-qtdeclarative
52
53 # Stage directory
54 mkdir ${ROOT}/${CROSS}
55
56 # Compile Qt
57
58 cd ${ROOT}/${CROSS}-build
59 export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
60 export CXXFLAGS=${CFLAGS}
61 export LDFLAGS="-fstack-protector-all"
62 ${ROOT}/qtbase/configure -xplatform ${TARGET_PARAMS} --hostprefix=${ROOT}/${CROSS} --prefix=${ROOT}/${CROSS} -device-option CROSS_COMPILE=${CROSS}- -release -confirm-license -no-compile-examples -no-cups -no-egl -no-eglfs -no-evdev -no-icu -no-iconv -no-libproxy -no-openssl -no-reduce-relocations -no-schannel -no-sctp -no-sql-db2 -no-sql-ibase -no-sql-oci -no-sql-tds -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite  -no-sql-sqlite2 -no-system-proxies -no-use-gold-linker -no-zstd -nomake examples -nomake tests -nomake tools -opensource -qt-libpng -qt-pcre -qt-zlib -static -no-feature-bearermanagement -no-feature-colordialog -no-feature-concurrent -no-feature-dial -no-feature-ftp -no-feature-http -no-feature-image_heuristic_mask -no-feature-keysequenceedit -no-feature-lcdnumber -no-feature-networkdiskcache -no-feature-networkproxy -no-feature-pdf -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sessionmanager -no-feature-socks5 -no-feature-sql -no-feature-sqlmodel -no-feature-statemachine -no-feature-syntaxhighlighter -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-topleveldomain -no-feature-udpsocket -no-feature-undocommand -no-feature-undogroup -no-feature-undostack -no-feature-undoview -no-feature-vnc -no-feature-xml -no-dbus -no-opengl
63 make -j 4
64 make install
65 cd ${ROOT}
66 rm -rf ${ROOT}/${CROSS}-build
67
68 # Compile Qt tools
69
70 cd ${ROOT}/${CROSS}-build-qttools
71 ${ROOT}/${CROSS}/bin/qmake ${ROOT}/qttools
72 make -j 4
73 make DESTDIR=${ROOT}/${CROSS} install
74 cd ${ROOT}
75 rm -rf ${ROOT}/${CROSS}-build-qttools
76
77 # Compile translations
78
79 cd ${ROOT}/${CROSS}-build-qttranslations
80 ${ROOT}/${CROSS}/bin/qmake ${ROOT}/qttranslations
81 make -j 4
82 make DESTDIR=${ROOT}/${CROSS} install
83 cd ${ROOT}
84 rm -rf ${ROOT}/${CROSS}-build-qttranslations
85
86 # Compile qtdeclarative
87
88 cd ${ROOT}/${CROSS}-build-qtdeclarative
89 ${ROOT}/${CROSS}/bin/qmake ${ROOT}/qtdeclarative
90 make -j 4
91 make DESTDIR=${ROOT}/${CROSS} install
92 cd ${ROOT}
93 rm -rf ${ROOT}/${CROSS}-build-qtdeclarative