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