7 if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
8 echo "Platform ${TARGET_CPU} is not supported"
9 echo "Expected either aarch64 or x86_64."
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."
19 # Cross-building prefix
20 CROSS=${TARGET_CPU}-${TARGET_OS}
22 if [[ ! $(which ${CROSS}-gcc) ]]; then
23 echo "Target C compiler ${CROSS}-gcc is not found"
27 if [[ ! $(which ${CROSS}-g++) ]]; then
28 echo "Target C++ compiler ${CROSS}-g++ is not found"
32 if [[ ! $(which make) ]]; then
33 echo "make is not installed, please install buld-essential package"
37 if [ "${TARGET_OS}" == "w64-mingw32" ]; then
38 TARGET_PARAMS="win32-clang-g++ -no-freetype"
40 if [ "${TARGET_CPU}" == "aarch64" ]; then
41 TARGET_PARAMS="linux-aarch64-gnu-g++"
43 TARGET_PARAMS="linux-g++-64"
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
54 mkdir ${ROOT}/${CROSS}
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
66 rm -rf ${ROOT}/${CROSS}-build
70 cd ${ROOT}/${CROSS}-build-qttools
71 ${ROOT}/${CROSS}/bin/qmake ${ROOT}/qttools
73 make DESTDIR=${ROOT}/${CROSS} install
75 rm -rf ${ROOT}/${CROSS}-build-qttools
77 # Compile translations
79 cd ${ROOT}/${CROSS}-build-qttranslations
80 ${ROOT}/${CROSS}/bin/qmake ${ROOT}/qttranslations
82 make DESTDIR=${ROOT}/${CROSS} install
84 rm -rf ${ROOT}/${CROSS}-build-qttranslations
86 # Compile qtdeclarative
88 cd ${ROOT}/${CROSS}-build-qtdeclarative
89 ${ROOT}/${CROSS}/bin/qmake ${ROOT}/qtdeclarative
91 make DESTDIR=${ROOT}/${CROSS} install
93 rm -rf ${ROOT}/${CROSS}-build-qtdeclarative