11#! /usr/bin/env bash
22
3- # Usage: [EXTRA_CMAKE_ARGS=<args...>] build-qt.sh [<qt submodule>...]
4- # installs to ./qt /
3+ # Usage: [EXTRA_CMAKE_ARGS=<args...>] build-qt.sh <sysname> [<qt submodule>...]
4+ # installs to ./qt_<sysname> /
55
66set -e
77set -u
@@ -16,7 +16,7 @@ prefix_output() {
1616module_vars () {
1717 url=" https://download.qt.io/archive/qt/6.8/6.8.3/submodules/${1} -everywhere-src-6.8.3.tar.xz"
1818 archive=" ${url##*/ } "
19- dirname=" ${archive% .tar.* } "
19+ dirname=" build_ ${sysname} / ${archive% .tar.* } "
2020}
2121
2222
@@ -35,9 +35,12 @@ build_module() {
3535 cmake --install .
3636}
3737
38+ sysname=" ${1} "
39+ shift
40+
3841WORK_DIR=" ${PWD} "
3942SCRIPT_DIR=$( realpath " $( dirname " $0 " ) " )
40- INSTALL_DIR=" ${WORK_DIR} /qt "
43+ INSTALL_DIR=" ${WORK_DIR} /qt_ ${sysname} "
4144
4245# FIXME bad warning in qtdeclarative-everywhere-src-6.8.3/src/quickwidgets/qquickwidget.cpp
4346
@@ -46,38 +49,8 @@ common_options_cmake="
4649 -DQT_GENERATE_SBOM=OFF
4750 ${BUILDQT_CMAKE_ARGS:- }
4851"
49- options_qtbase="
50- -opensource
51- -confirm-license
52- -release
53- -optimize-size
54- -no-shared
55- -static
56- --c++std=17
57- -disable-deprecated-up-to 0x060800
58- -reduce-exports
59- -gc-binaries
60- -qpa xcb
61- -nomake tests
62- -nomake examples
63- -no-gif
64- -no-icu
65- -no-glib
66- -opengl desktop
67- -no-eglfs
68- -no-opengles3
69- -no-egl
70- -xkbcommon
71- -dbus-runtime
72- -qt-freetype
73- -qt-pcre
74- -qt-harfbuzz
75- -qt-libpng
76- -qt-libjpeg
77- -system-zlib
78- -openssl-linked
79- -prefix ${INSTALL_DIR}
80- --
52+
53+ base_features='
8154 -DFEATURE_androiddeployqt=OFF
8255 -DFEATURE_animation=ON
8356 -DFEATURE_cborstreamwriter=OFF
@@ -139,7 +112,6 @@ options_qtbase="
139112 -DFEATURE_mimetype_database=OFF
140113 -DFEATURE_movie=OFF
141114 -DFEATURE_networkdiskcache=OFF
142- -DFEATURE_opengl_desktop=ON
143115 -DFEATURE_pdf=OFF
144116 -DFEATURE_picture=OFF
145117 -DFEATURE_printsupport=OFF
@@ -171,6 +143,9 @@ options_qtbase="
171143 -DFEATURE_stringlistmodel=OFF
172144 -DFEATURE_style_fusion=OFF
173145 -DFEATURE_style_stylesheet=OFF
146+ -DFEATURE_style_windows=ON
147+ -DFEATURE_style_windows11=OFF
148+ -DFEATURE_style_windowsvista=OFF
174149 -DFEATURE_syntaxhighlighter=OFF
175150 -DFEATURE_systemtrayicon=OFF
176151 -DFEATURE_tabbar=OFF
@@ -205,10 +180,39 @@ options_qtbase="
205180 -DFEATURE_whatsthis=OFF
206181 -DFEATURE_widgettextcontrol=ON
207182 -DFEATURE_wizard=OFF
208- -DFEATURE_xcb=ON
209- -DFEATURE_xcb_glx_plugin=ON
210183 -DFEATURE_xml=OFF
211184 -DFEATURE_xmlstream=ON
185+ '
186+
187+ options_qtbase="
188+ -opensource
189+ -confirm-license
190+ -release
191+ -optimize-size
192+ -no-shared
193+ -static
194+ --c++std=17
195+ -disable-deprecated-up-to 0x060800
196+ -reduce-exports
197+ -gc-binaries
198+ -nomake tests
199+ -nomake examples
200+ -no-gif
201+ -no-icu
202+ -no-glib
203+ -opengl desktop
204+ -no-eglfs
205+ -no-opengles3
206+ -no-egl
207+ -qt-freetype
208+ -qt-pcre
209+ -qt-harfbuzz
210+ -qt-libpng
211+ -qt-libjpeg
212+ -prefix ${INSTALL_DIR}
213+ --
214+ ${base_features}
215+ -DFEATURE_opengl_desktop=ON
212216 -DQT_BUILD_DOCS=OFF
213217"
214218options_qt5compat=' --'
@@ -239,9 +243,80 @@ options_qtdeclarative='
239243 -DFEATURE_quicktemplates2_multitouch=OFF
240244'
241245
246+ case " ${sysname} " in
247+ linux)
248+ options_qtbase="
249+ -dbus-runtime
250+ -openssl-linked
251+ -qpa xcb
252+ -system-zlib
253+ -xkbcommon
254+ ${options_qtbase}
255+ -DFEATURE_xcb=ON
256+ -DFEATURE_xcb_glx_plugin=ON
257+ "
258+ ;;
259+ macos)
260+ ;;
261+ windows)
262+ options_qtbase="
263+ -device-option CROSS_COMPILE=i686-w64-mingw32-
264+ -xplatform win32-g++
265+ -schannel
266+ ${options_qtbase}
267+ -DFEATURE_imageformat_xpm=ON
268+ -DFEATURE_library=ON
269+ -DCMAKE_TOOLCHAIN_FILE=${SCRIPT_DIR} /cross-toolchain-mingw32.cmake
270+ -DQT_HOST_PATH=${WORK_DIR} /qt_tools
271+ "
272+ # -no-feature-d3d12
273+
274+ ;;
275+ tools)
276+ options_qtbase="
277+ --c++std=17
278+ -release
279+ -static
280+ -qpa none
281+ -no-opengl
282+ -no-harfbuzz
283+ -no-freetype
284+ -no-ico
285+ -no-gif
286+ -no-xkbcommon
287+ -no-openssl
288+ -prefix ${INSTALL_DIR}
289+ --
290+ ${base_features}
291+ -DFEATURE_widgets=OFF
292+ -DFEATURE_network=OFF
293+ -DFEATURE_harfbuzz=OFF
294+ -DFEATURE_evdev=OFF
295+ -DFEATURE_cursor=OFF
296+ -DFEATURE_linuxfb=OFF
297+ -DFEATURE_freetype=OFF
298+ -DxxxFEATURE_pcre2=OFF
299+ -DFEATURE_libinput=OFF
300+ -DFEATURE_imageformat_jpeg=OFF
301+ -DFEATURE_imageformat_png=OFF
302+ -DFEATURE_imageformatplugin=OFF
303+ "
304+ options_qtdeclarative='
305+ --
306+ '
307+ ;;
308+ * )
309+ echo ' arg 1 should be linux|macos|windows'
310+ exit 1
311+ esac
312+
242313# qt5compat depends on qtdeclarative
243- # qtdeclarative depends on qtshadertools, qtsvg
244- MODULES=${@:- qtbase qtsvg qtshadertools qtdeclarative qt5compat}
314+ # qtdeclarative depends on qtshadertools
315+ # qtdeclarative optionally depends on qtsvg but we don't actually want that?
316+ # Also in the tools build we strategically build qtdeclarative before qtshadertools to disable
317+ # the bulk of QML targets (TODO: disable them explicitly with options?)
318+
319+ MODULES=${@:- qtbase qtshadertools qtdeclarative qt5compat qtsvg}
245320
246321# for bloaty
247322# options_qtbase="-force-debug-info ${options_qtbase}"
@@ -260,11 +335,13 @@ wait
260335
261336md5sum --check --ignore-missing " ${SCRIPT_DIR} /md5sums-qt.txt"
262337
338+ mkdir -p " ${WORK_DIR} /build_${sysname} "
339+
263340# Nuke old dir; extract in parallel
264341for module in $MODULES ; do
265342 module_vars " ${module} "
266343 rm -rf " ${dirname} "
267- tar -xJf " ${archive} " &
344+ tar -C " ${WORK_DIR} /build_ ${sysname} " - xJf " ${archive} " &
268345done
269346wait
270347
0 commit comments