Skip to content

Commit 4315dc0

Browse files
committed
Merge bitcoin/bitcoin#20641: depends: Use Qt top-level build facilities
1155978 build, qt: Do not install *.prl files (Hennadii Stepanov) 763793b build, qt: Fix wrong cross-compiling detection on macOS (Hennadii Stepanov) 3098272 build, qt: Force bootstrap while building linguist tools (Hennadii Stepanov) 689320e build, qt: Drop translations.pro hack (Hennadii Stepanov) 6a1f98f build, qt: Drop lrelease dependency patch (Hennadii Stepanov) 39e561e build, qt: Add linguist_tools list (Hennadii Stepanov) 27d3def build: Use Qt top-level build facilities (Hennadii Stepanov) Pull request description: This PR: - uses Qt top-level build facilities without the need to download all-in-one archive - is based on **BlockMechanic**'s [idea](bitcoin/bitcoin#20600), and is an alternative to #20600 - makes it easy to integrate [new modules](bitcoin/bitcoin#16883) into static builds - has the minimal diff - makes the qt package build process streamlined by dropping some patches and hacks (an alternative to #21420 and #20642) Fixes #18536 (a non-intrusive alternative to #21589 and #19785). Fixes #14648. Fixes #21588 (a non-intrusive alternative to #21591). Required for adding [Wayland support](bitcoin/bitcoin#19950) on Linux. --- **Note for reviewers**: With 9046de8a4cbc3899fed9eae084115f423e7ac5bd from #21995 it is easy to verify that there are no changes in the resulted `qt` package archive on the per commit basis. For example, for `HOST=i686-pc-linux-gnu` no commit in this PR introduces any changes. ACKs for top commit: fanquake: ACK 1155978 Tree-SHA512: 667b06b72cb7ff26d68b9b88e8dddb51084783ca9e3d80b3392710794c1dc7fd77bbcc3ccf4ccece9919d33b9bf8fce13c5059502bd228021dc7c93fdb87ca7a
2 parents b588961 + 1155978 commit 4315dc0

File tree

5 files changed

+41
-54
lines changed

5 files changed

+41
-54
lines changed

depends/packages/qt.mk

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ $(package)_file_name=qtbase-$($(package)_suffix)
66
$(package)_sha256_hash=1c1b4e33137ca77881074c140d54c3c9747e845a31338cfe8680f171f0bc3a39
77
$(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon
88
$(package)_qt_libs=corelib network widgets gui plugins testlib
9-
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_no_printer.patch no-xlib.patch
9+
$(package)_linguist_tools = lrelease lupdate lconvert
10+
$(package)_patches = qt.pro qttools_src.pro
11+
$(package)_patches += fix_qt_pkgconfig.patch mac-qmake.conf fix_no_printer.patch no-xlib.patch
1012
$(package)_patches+= fix_android_qmake_conf.patch fix_android_jni_static.patch dont_hardcode_pwd.patch
11-
$(package)_patches+= drop_lrelease_dependency.patch no_sdk_version_check.patch
13+
$(package)_patches+= no_sdk_version_check.patch
1214
$(package)_patches+= fix_lib_paths.patch fix_android_pch.patch
1315
$(package)_patches+= qtbase-moc-ignore-gcc-macro.patch fix_limits_header.patch
1416

@@ -64,6 +66,7 @@ $(package)_config_opts += -no-system-proxies
6466
$(package)_config_opts += -no-use-gold-linker
6567
$(package)_config_opts += -nomake examples
6668
$(package)_config_opts += -nomake tests
69+
$(package)_config_opts += -nomake tools
6770
$(package)_config_opts += -opensource
6871
$(package)_config_opts += -pkg-config
6972
$(package)_config_opts += -prefix $(host_prefix)
@@ -113,14 +116,13 @@ $(package)_config_opts_darwin = -no-dbus
113116
$(package)_config_opts_darwin += -no-opengl
114117
$(package)_config_opts_darwin += -pch
115118
$(package)_config_opts_darwin += -no-feature-corewlan
116-
$(package)_config_opts_darwin += -device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=$(OSX_MIN_VERSION)
119+
$(package)_config_opts_darwin += QMAKE_MACOSX_DEPLOYMENT_TARGET=$(OSX_MIN_VERSION)
117120

118121
ifneq ($(build_os),darwin)
119122
$(package)_config_opts_darwin += -xplatform macx-clang-linux
120123
$(package)_config_opts_darwin += -device-option MAC_SDK_PATH=$(OSX_SDK)
121124
$(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSION)
122125
$(package)_config_opts_darwin += -device-option CROSS_COMPILE="$(host)-"
123-
$(package)_config_opts_darwin += -device-option MAC_MIN_VERSION=$(OSX_MIN_VERSION)
124126
$(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
125127
$(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION)
126128
endif
@@ -201,26 +203,24 @@ endef
201203
#
202204
# 1. Apply our patches to the extracted source. See each patch for more info.
203205
#
204-
# 2. Point to lrelease in qttools/bin/lrelease; otherwise Qt will look for it in
205-
# $(host)/native/bin/lrelease and not find it.
206+
# 2. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf.
206207
#
207-
# 3. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf.
208-
#
209-
# 4. After making a copy of the mkspec for the linux-arm-gnueabi host, named
208+
# 3. After making a copy of the mkspec for the linux-arm-gnueabi host, named
210209
# bitcoin-linux-g++, replace instances of linux-arm-gnueabi with $(host). This
211210
# way we can generically support hosts like riscv64-linux-gnu, which Qt doesn't
212211
# ship a mkspec for. See it's usage in config_opts_* above.
213212
#
214-
# 5. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds.
213+
# 4. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds.
215214
#
216-
# 6. Do similar for the win32-g++ mkspec.
215+
# 5. Do similar for the win32-g++ mkspec.
217216
#
218-
# 7. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466.
217+
# 6. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466.
219218
#
220-
# 8. Adjust a regex in toolchain.prf, to accommodate Guix's usage of
219+
# 7. Adjust a regex in toolchain.prf, to accommodate Guix's usage of
221220
# CROSS_LIBRARY_PATH. See #15277.
222221
define $(package)_preprocess_cmds
223-
patch -p1 -i $($(package)_patch_dir)/drop_lrelease_dependency.patch && \
222+
cp $($(package)_patch_dir)/qt.pro qt.pro && \
223+
cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \
224224
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
225225
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
226226
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch && \
@@ -232,7 +232,6 @@ define $(package)_preprocess_cmds
232232
patch -p1 -i $($(package)_patch_dir)/fix_lib_paths.patch && \
233233
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
234234
patch -p1 -i $($(package)_patch_dir)/fix_limits_header.patch && \
235-
sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \
236235
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
237236
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
238237
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
@@ -249,35 +248,22 @@ endef
249248
define $(package)_config_cmds
250249
export PKG_CONFIG_SYSROOT_DIR=/ && \
251250
export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \
252-
export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \
251+
export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \
253252
cd qtbase && \
254-
./configure $($(package)_config_opts) && \
255-
cd .. && \
256-
$(MAKE) -C qtbase sub-src-clean && \
257-
qtbase/bin/qmake -o qttranslations/Makefile qttranslations/qttranslations.pro && \
258-
qtbase/bin/qmake -o qttranslations/translations/Makefile qttranslations/translations/translations.pro && \
259-
qtbase/bin/qmake -o qttools/src/linguist/lrelease/Makefile qttools/src/linguist/lrelease/lrelease.pro && \
260-
qtbase/bin/qmake -o qttools/src/linguist/lupdate/Makefile qttools/src/linguist/lupdate/lupdate.pro && \
261-
qtbase/bin/qmake -o qttools/src/linguist/lconvert/Makefile qttools/src/linguist/lconvert/lconvert.pro
253+
./configure -top-level $($(package)_config_opts)
262254
endef
263255

264256
define $(package)_build_cmds
265-
$(MAKE) -C qtbase/src $(addprefix sub-,$($(package)_qt_libs)) && \
266-
$(MAKE) -C qttools/src/linguist/lrelease && \
267-
$(MAKE) -C qttools/src/linguist/lupdate && \
268-
$(MAKE) -C qttools/src/linguist/lconvert && \
269-
$(MAKE) -C qttranslations
257+
$(MAKE)
270258
endef
271259

272260
define $(package)_stage_cmds
273261
$(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \
274-
$(MAKE) -C qttools/src/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install_target && \
275-
$(MAKE) -C qttools/src/linguist/lupdate INSTALL_ROOT=$($(package)_staging_dir) install_target && \
276-
$(MAKE) -C qttools/src/linguist/lconvert INSTALL_ROOT=$($(package)_staging_dir) install_target && \
262+
$(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \
277263
$(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets
278264
endef
279265

280266
define $(package)_postprocess_cmds
281267
rm -rf native/mkspecs/ native/lib/ lib/cmake/ && \
282-
rm -f lib/lib*.la lib/*.prl plugins/*/*.prl
268+
rm -f lib/lib*.la
283269
endef

depends/patches/qt/drop_lrelease_dependency.patch

Lines changed: 0 additions & 20 deletions
This file was deleted.

depends/patches/qt/mac-qmake.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ include(../common/clang-mac.conf)
88
QMAKE_MAC_SDK_PATH=$${MAC_SDK_PATH}
99
QMAKE_XCODE_VERSION = $${XCODE_VERSION}
1010
QMAKE_XCODE_DEVELOPER_PATH=/Developer
11-
QMAKE_MACOSX_DEPLOYMENT_TARGET = $${MAC_MIN_VERSION}
1211
QMAKE_MAC_SDK=macosx
1312
QMAKE_MAC_SDK.macosx.Path = $${MAC_SDK_PATH}
1413
QMAKE_MAC_SDK.macosx.platform_name = macosx

depends/patches/qt/qt.pro

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Create the super cache so modules will add themselves to it.
2+
cache(, super)
3+
4+
!QTDIR_build: cache(CONFIG, add, $$list(QTDIR_build))
5+
6+
prl = no_install_prl
7+
CONFIG += $$prl
8+
cache(CONFIG, add stash, prl)
9+
10+
TEMPLATE = subdirs
11+
SUBDIRS = qtbase qttools qttranslations
12+
13+
qttools.depends = qtbase
14+
qttranslations.depends = qttools
15+
16+
load(qt_configure)

depends/patches/qt/qttools_src.pro

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
TEMPLATE = subdirs
2+
SUBDIRS = linguist
3+
4+
fb = force_bootstrap
5+
CONFIG += $$fb
6+
cache(CONFIG, add, fb)

0 commit comments

Comments
 (0)