1 package=qt
2 include packages/qt_details.mk
3 $(package)_version=$(qt_details_version)
4 $(package)_download_path=$(qt_details_download_path)
5 $(package)_file_name=$(qt_details_qtbase_file_name)
6 $(package)_sha256_hash=$(qt_details_qtbase_sha256_hash)
7 ifneq ($(host),$(build))
8 $(package)_dependencies := native_$(package)
9 endif
10 $(package)_linux_dependencies := freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_cursor libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm
11 $(package)_freebsd_dependencies := $($(package)_linux_dependencies)
12 $(package)_openbsd_dependencies := $($(package)_linux_dependencies)
13 $(package)_patches_path := $(qt_details_patches_path)
14 $(package)_patches := cocoa_compat.patch
15 $(package)_patches += dont_hardcode_pwd.patch
16 $(package)_patches += qtbase_avoid_qmain.patch
17 $(package)_patches += qtbase_platformsupport.patch
18 $(package)_patches += qtbase_plugins_cocoa.patch
19 $(package)_patches += qtbase_skip_tools.patch
20 $(package)_patches += rcc_hardcode_timestamp.patch
21 $(package)_patches += qttools_skip_dependencies.patch
22 $(package)_patches += static_fixes.patch
23 $(package)_patches += fix-gcc16-qcompare.patch
24 $(package)_patches += fix-gcc16-sfinae-qregularexpression.patch
25 $(package)_patches += fix-gcc16-sfinae-qchar.patch
26 $(package)_patches += fix-gcc16-sfinae-qbitarray.patch
27 $(package)_patches += fix-gcc16-sfinae-qanystringview.patch
28 $(package)_patches += fix-macos26-qyield.patch
29 $(package)_patches += fix-qbytearray-include.patch
30 $(package)_patches += fix_openbsd_network_kernel.patch
31 $(package)_patches += fix_openbsd_plugin_qelfparser.patch
32
33 $(package)_qttranslations_file_name=$(qt_details_qttranslations_file_name)
34 $(package)_qttranslations_sha256_hash=$(qt_details_qttranslations_sha256_hash)
35
36 $(package)_qttools_file_name=$(qt_details_qttools_file_name)
37 $(package)_qttools_sha256_hash=$(qt_details_qttools_sha256_hash)
38
39 $(package)_extra_sources := $($(package)_qttranslations_file_name)
40 $(package)_extra_sources += $($(package)_qttools_file_name)
41
42 $(package)_top_download_path=$(qt_details_top_download_path)
43 $(package)_top_cmakelists_file_name=$(qt_details_top_cmakelists_file_name)
44 $(package)_top_cmakelists_download_file=$(qt_details_top_cmakelists_download_file)
45 $(package)_top_cmakelists_sha256_hash=$(qt_details_top_cmakelists_sha256_hash)
46 $(package)_top_cmake_download_path=$(qt_details_top_cmake_download_path)
47 $(package)_top_cmake_ecmoptionaladdsubdirectory_file_name=$(qt_details_top_cmake_ecmoptionaladdsubdirectory_file_name)
48 $(package)_top_cmake_ecmoptionaladdsubdirectory_download_file=$(qt_details_top_cmake_ecmoptionaladdsubdirectory_download_file)
49 $(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash=$(qt_details_top_cmake_ecmoptionaladdsubdirectory_sha256_hash)
50 $(package)_top_cmake_qttoplevelhelpers_file_name=$(qt_details_top_cmake_qttoplevelhelpers_file_name)
51 $(package)_top_cmake_qttoplevelhelpers_download_file=$(qt_details_top_cmake_qttoplevelhelpers_download_file)
52 $(package)_top_cmake_qttoplevelhelpers_sha256_hash=$(qt_details_top_cmake_qttoplevelhelpers_sha256_hash)
53
54 $(package)_extra_sources += $($(package)_top_cmakelists_file_name)-$($(package)_version)
55 $(package)_extra_sources += $($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version)
56 $(package)_extra_sources += $($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version)
57
58 define $(package)_set_vars
59 $(package)_config_opts_release := -release
60 $(package)_config_opts_debug := -debug
61 $(package)_config_opts := -no-egl
62 $(package)_config_opts += -no-eglfs
63 $(package)_config_opts += -no-evdev
64 $(package)_config_opts += -no-gif
65 $(package)_config_opts += -no-glib
66 $(package)_config_opts += -no-icu
67 $(package)_config_opts += -no-ico
68 $(package)_config_opts += -no-kms
69 $(package)_config_opts += -no-linuxfb
70 $(package)_config_opts += -no-libjpeg
71 $(package)_config_opts += -no-libproxy
72 $(package)_config_opts += -no-libudev
73 $(package)_config_opts += -no-mtdev
74 $(package)_config_opts += -no-opengl
75 $(package)_config_opts += -no-openssl
76 $(package)_config_opts += -no-openvg
77 $(package)_config_opts += -no-reduce-relocations
78 $(package)_config_opts += -no-schannel
79 $(package)_config_opts += -no-sctp
80 $(package)_config_opts += -no-securetransport
81 $(package)_config_opts += -no-system-proxies
82 $(package)_config_opts += -no-use-gold-linker
83 $(package)_config_opts += -no-zstd
84 $(package)_config_opts += -nomake examples
85 $(package)_config_opts += -nomake tests
86 $(package)_config_opts += -prefix $(host_prefix)
87 $(package)_config_opts += -qt-doubleconversion
88 $(package)_config_opts += -qt-harfbuzz
89 ifneq ($(host),$(build))
90 $(package)_config_opts += -qt-host-path $(build_prefix)
91 endif
92 $(package)_config_opts += -qt-libpng
93 $(package)_config_opts += -qt-pcre
94 $(package)_config_opts += -qt-zlib
95 $(package)_config_opts += -static
96 $(package)_config_opts += -no-feature-backtrace
97 $(package)_config_opts += -no-feature-colordialog
98 $(package)_config_opts += -no-feature-concurrent
99 $(package)_config_opts += -no-feature-dial
100 $(package)_config_opts += -no-feature-gssapi
101 $(package)_config_opts += -no-feature-http
102 $(package)_config_opts += -no-feature-image_heuristic_mask
103 $(package)_config_opts += -no-feature-keysequenceedit
104 $(package)_config_opts += -no-feature-lcdnumber
105 $(package)_config_opts += -no-feature-libresolv
106 # Disable libstdcpp_assertions (_GLIBCXX_ASSERTIONS) to prevent embedding absolute
107 # C++ standard library paths into object files, which breaks reproducible builds.
108 $(package)_config_opts += -no-feature-libstdcpp_assertions
109 $(package)_config_opts += -no-feature-networkdiskcache
110 $(package)_config_opts += -no-feature-networkproxy
111 $(package)_config_opts += -no-feature-printsupport
112 $(package)_config_opts += -no-feature-sessionmanager
113 $(package)_config_opts += -no-feature-socks5
114 $(package)_config_opts += -no-feature-sql
115 $(package)_config_opts += -no-feature-textmarkdownreader
116 $(package)_config_opts += -no-feature-textmarkdownwriter
117 $(package)_config_opts += -no-feature-textodfwriter
118 $(package)_config_opts += -no-feature-topleveldomain
119 $(package)_config_opts += -no-feature-udpsocket
120 $(package)_config_opts += -no-feature-undocommand
121 $(package)_config_opts += -no-feature-undogroup
122 $(package)_config_opts += -no-feature-undostack
123 $(package)_config_opts += -no-feature-undoview
124 $(package)_config_opts += -no-feature-vnc
125 $(package)_config_opts += -no-feature-vulkan
126
127 # Core tools.
128 $(package)_config_opts += -no-feature-androiddeployqt
129 $(package)_config_opts += -no-feature-macdeployqt
130 $(package)_config_opts += -no-feature-qmake
131 $(package)_config_opts += -no-feature-windeployqt
132
133 ifeq ($(host),$(build))
134 # Qt Tools module.
135 $(package)_config_opts += -feature-linguist
136 $(package)_config_opts += -no-feature-assistant
137 $(package)_config_opts += -no-feature-clang
138 $(package)_config_opts += -no-feature-clangcpp
139 $(package)_config_opts += -no-feature-designer
140 $(package)_config_opts += -no-feature-pixeltool
141 $(package)_config_opts += -no-feature-qdoc
142 $(package)_config_opts += -no-feature-qtattributionsscanner
143 $(package)_config_opts += -no-feature-qtdiag
144 $(package)_config_opts += -no-feature-qtplugininfo
145 endif
146
147 $(package)_config_opts_darwin := -no-dbus
148 $(package)_config_opts_darwin += -no-feature-printsupport
149 $(package)_config_opts_darwin += -no-feature-freetype
150 $(package)_config_opts_darwin += -no-pkg-config
151
152 $(package)_config_opts_linux := -fontconfig
153 $(package)_config_opts_linux += -no-feature-process
154 $(package)_config_opts_linux += -no-feature-xlib
155 $(package)_config_opts_linux += -no-xcb-xlib
156 $(package)_config_opts_linux += -pkg-config
157 $(package)_config_opts_linux += -system-freetype
158 $(package)_config_opts_linux += -xcb
159 ifneq ($(LTO),)
160 $(package)_config_opts_linux += -ltcg
161 endif
162 $(package)_config_opts_freebsd := $$($(package)_config_opts_linux)
163 $(package)_config_opts_freebsd += -no-feature-inotify
164 $(package)_config_opts_openbsd := $$($(package)_config_opts_linux)
165
166 $(package)_config_opts_mingw32 := -no-dbus
167 $(package)_config_opts_mingw32 += -no-feature-freetype
168 $(package)_config_opts_mingw32 += -no-pkg-config
169
170 # CMake build options.
171 $(package)_config_env := CC="$$($(package)_cc)"
172 $(package)_config_env += CXX="$$($(package)_cxx)"
173 $(package)_config_env_darwin := OBJC="$$($(package)_cc)"
174 $(package)_config_env_darwin += OBJCXX="$$($(package)_cxx)"
175
176 $(package)_cmake_opts := -DCMAKE_PREFIX_PATH=$(host_prefix)
177 $(package)_cmake_opts += -DQT_FEATURE_cxx20=ON
178 $(package)_cmake_opts += -DQT_GENERATE_SBOM=OFF
179 ifneq ($(V),)
180 $(package)_cmake_opts += --log-level=STATUS
181 endif
182
183 $(package)_cmake_opts += -DQT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS=ON
184 $(package)_cmake_opts += -DCMAKE_C_FLAGS="$$($(package)_cppflags) $$($$($(package)_type)_CFLAGS) -ffile-prefix-map=$$($(package)_extract_dir)=/usr"
185 $(package)_cmake_opts += -DCMAKE_C_FLAGS_RELEASE="$$($$($(package)_type)_release_CFLAGS)"
186 $(package)_cmake_opts += -DCMAKE_C_FLAGS_DEBUG="$$($$($(package)_type)_debug_CFLAGS)"
187 $(package)_cmake_opts += -DCMAKE_CXX_FLAGS="$$($(package)_cppflags) $$($$($(package)_type)_CXXFLAGS) -ffile-prefix-map=$$($(package)_extract_dir)=/usr"
188 $(package)_cmake_opts += -DCMAKE_CXX_FLAGS_RELEASE="$$($$($(package)_type)_release_CXXFLAGS)"
189 $(package)_cmake_opts += -DCMAKE_CXX_FLAGS_DEBUG="$$($$($(package)_type)_debug_CXXFLAGS)"
190 ifeq ($(host_os),darwin)
191 $(package)_cmake_opts += -DCMAKE_OBJC_FLAGS="$$($(package)_cppflags) $$($$($(package)_type)_CFLAGS) -ffile-prefix-map=$$($(package)_extract_dir)=/usr"
192 $(package)_cmake_opts += -DCMAKE_OBJC_FLAGS_RELEASE="$$($$($(package)_type)_release_CFLAGS)"
193 $(package)_cmake_opts += -DCMAKE_OBJC_FLAGS_DEBUG="$$($$($(package)_type)_debug_CFLAGS)"
194 $(package)_cmake_opts += -DCMAKE_OBJCXX_FLAGS="$$($(package)_cppflags) $$($$($(package)_type)_CXXFLAGS) -ffile-prefix-map=$$($(package)_extract_dir)=/usr"
195 $(package)_cmake_opts += -DCMAKE_OBJCXX_FLAGS_RELEASE="$$($$($(package)_type)_release_CXXFLAGS)"
196 $(package)_cmake_opts += -DCMAKE_OBJCXX_FLAGS_DEBUG="$$($$($(package)_type)_debug_CXXFLAGS)"
197 endif
198 $(package)_cmake_opts += -DCMAKE_EXE_LINKER_FLAGS="$$($$($(package)_type)_LDFLAGS)"
199 $(package)_cmake_opts += -DCMAKE_EXE_LINKER_FLAGS_RELEASE="$$($$($(package)_type)_release_LDFLAGS)"
200 $(package)_cmake_opts += -DCMAKE_EXE_LINKER_FLAGS_DEBUG="$$($$($(package)_type)_debug_LDFLAGS)"
201
202 ifneq ($(host),$(build))
203 $(package)_cmake_opts += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system_name)
204 $(package)_cmake_opts += -DCMAKE_SYSTEM_VERSION=$($(host_os)_cmake_system_version)
205 $(package)_cmake_opts += -DCMAKE_SYSTEM_PROCESSOR=$(host_arch)
206 # Native packages cannot be used during cross-compiling. However,
207 # Qt still unconditionally tries to find them, which causes issues
208 # in some cases, such as when cross-compiling from macOS to Windows.
209 # Explicitly disable this unnecessary Qt behaviour.
210 $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_Libb2=TRUE
211 $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapSystemDoubleConversion=TRUE
212 $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapSystemMd4c=TRUE
213 $(package)_cmake_opts += -DCMAKE_DISABLE_FIND_PACKAGE_WrapZSTD=TRUE
214 endif
215 ifneq (,$(filter linux openbsd,$(host_os)))
216 # The `-dbus-runtime` configure option does not work
217 # https://qt-project.atlassian.net/browse/QTBUG-144864
218 $(package)_cmake_opts += -DINPUT_dbus=runtime
219 endif
220 ifeq ($(host_os),darwin)
221 $(package)_cmake_opts += -DCMAKE_INSTALL_NAME_TOOL=true
222 $(package)_cmake_opts += -DCMAKE_FRAMEWORK_PATH=$(OSX_SDK)/System/Library/Frameworks
223 $(package)_cmake_opts += -DQT_INTERNAL_APPLE_SDK_VERSION=$(OSX_SDK_VERSION)
224 $(package)_cmake_opts += -DQT_INTERNAL_XCODE_VERSION=$(XCODE_VERSION)
225 $(package)_cmake_opts += -DQT_NO_APPLE_SDK_MAX_VERSION_CHECK=ON
226 endif
227 endef
228
229 define $(package)_fetch_cmds
230 $(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
231 $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \
232 $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash)) && \
233 $(call fetch_file,$(package),$($(package)_top_download_path),$($(package)_top_cmakelists_download_file),$($(package)_top_cmakelists_file_name)-$($(package)_version),$($(package)_top_cmakelists_sha256_hash)) && \
234 $(call fetch_file,$(package),$($(package)_top_cmake_download_path),$($(package)_top_cmake_ecmoptionaladdsubdirectory_download_file),$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version),$($(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash)) && \
235 $(call fetch_file,$(package),$($(package)_top_cmake_download_path),$($(package)_top_cmake_qttoplevelhelpers_download_file),$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version),$($(package)_top_cmake_qttoplevelhelpers_sha256_hash))
236 endef
237
238 ifeq ($(host),$(build))
239 define $(package)_extract_cmds
240 mkdir -p $($(package)_extract_dir) && \
241 echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
242 echo "$($(package)_qttranslations_sha256_hash) $($(package)_source_dir)/$($(package)_qttranslations_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
243 echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
244 echo "$($(package)_top_cmakelists_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
245 echo "$($(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
246 echo "$($(package)_top_cmake_qttoplevelhelpers_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
247 $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
248 mkdir -p qtbase && \
249 $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
250 mkdir -p qttranslations && \
251 $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
252 mkdir -p qttools && \
253 $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools && \
254 cp $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version) ./$($(package)_top_cmakelists_file_name) && \
255 mkdir -p cmake && \
256 cp $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name) && \
257 cp $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_qttoplevelhelpers_file_name)
258 endef
259 else
260 define $(package)_extract_cmds
261 mkdir -p $($(package)_extract_dir) && \
262 echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
263 echo "$($(package)_top_cmakelists_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
264 echo "$($(package)_top_cmake_ecmoptionaladdsubdirectory_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
265 echo "$($(package)_top_cmake_qttoplevelhelpers_sha256_hash) $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
266 $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
267 mkdir -p qtbase && \
268 $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
269 cp $($(package)_source_dir)/$($(package)_top_cmakelists_file_name)-$($(package)_version) ./$($(package)_top_cmakelists_file_name) && \
270 mkdir -p cmake && \
271 cp $($(package)_source_dir)/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_ecmoptionaladdsubdirectory_file_name) && \
272 cp $($(package)_source_dir)/$($(package)_top_cmake_qttoplevelhelpers_file_name)-$($(package)_version) cmake/$($(package)_top_cmake_qttoplevelhelpers_file_name)
273 endef
274 endif
275
276 define $(package)_preprocess_cmds
277 patch -p1 -i $($(package)_patch_dir)/cocoa_compat.patch && \
278 patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
279 patch -p1 -i $($(package)_patch_dir)/qtbase_avoid_qmain.patch && \
280 patch -p1 -i $($(package)_patch_dir)/qtbase_platformsupport.patch && \
281 patch -p1 -i $($(package)_patch_dir)/qtbase_plugins_cocoa.patch && \
282 patch -p1 -i $($(package)_patch_dir)/qtbase_skip_tools.patch && \
283 patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
284 patch -p1 -i $($(package)_patch_dir)/static_fixes.patch && \
285 patch -p1 -i $($(package)_patch_dir)/fix-gcc16-qcompare.patch && \
286 patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qregularexpression.patch && \
287 patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qchar.patch && \
288 patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qbitarray.patch && \
289 patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qanystringview.patch && \
290 patch -p1 -i $($(package)_patch_dir)/fix-macos26-qyield.patch && \
291 patch -p1 -i $($(package)_patch_dir)/fix-qbytearray-include.patch && \
292 patch -p1 -i $($(package)_patch_dir)/fix_openbsd_network_kernel.patch && \
293 patch -p1 -i $($(package)_patch_dir)/fix_openbsd_plugin_qelfparser.patch
294 endef
295 ifeq ($(host),$(build))
296 $(package)_preprocess_cmds += && patch -p1 -i $($(package)_patch_dir)/qttools_skip_dependencies.patch
297 endif
298
299 define $(package)_config_cmds
300 cd qtbase && \
301 ./configure -top-level $($(package)_config_opts) -- $($(package)_cmake_opts)
302 endef
303
304 define $(package)_build_cmds
305 cmake --build . -- $$(filter -j%,$$(MAKEFLAGS))
306 endef
307
308 define $(package)_stage_cmds
309 cmake --install . --prefix $($(package)_staging_prefix_dir) --strip
310 endef
311
312 define $(package)_postprocess_cmds
313 rm -rf doc/
314 endef
315