Skip to content

Commit e9a1c9f

Browse files
committed
Merge #19867: build: document and cleanup Qt hacks
e1f2553 build: remove global_init_link_order from mac qt qmake.conf (fanquake) 498fa16 build: document preprocessing steps in qt package (fanquake) bd5d933 build: don't copy Info.plist.* into mkspec for macOS qt build (fanquake) bfd7e33 build: remove plugin_no_soname from mac qt qmake.conf (fanquake) fdde4c7 build: pass XCODE_VERSION through to qt macOS cross compile conf (fanquake) 49473ef build: convert "echo" usage into a patch in qt package (fanquake) Pull request description: Follow up on removing `sed` usage in #19761. Also nice to revisit & cleanup before 5.15.x. ACKs for top commit: laanwj: Code review ACK e1f2553 Tree-SHA512: 4e6489d877aaa300f69e091d7117136da49611bd80afd45adfbd7ddeb5b3c9c76fb0f87a3249cbe63ba93129df56281fd4a9389daadc852211325c5ca9ac6567
2 parents 816132e + e1f2553 commit e9a1c9f

File tree

3 files changed

+63
-17
lines changed

3 files changed

+63
-17
lines changed

depends/packages/qt.mk

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ $(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch
1212
$(package)_patches+= fix_rcc_determinism.patch fix_riscv64_arch.patch xkb-default.patch no-xlib.patch
1313
$(package)_patches+= fix_android_qmake_conf.patch fix_android_jni_static.patch dont_hardcode_pwd.patch
1414
$(package)_patches+= freetype_back_compat.patch drop_lrelease_dependency.patch fix_powerpc_libpng.patch
15+
$(package)_patches+= fix_mingw_cross_compile.patch
1516

1617
# Update OSX_QT_TRANSLATIONS when this is updated
1718
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
@@ -124,6 +125,7 @@ $(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSIO
124125
$(package)_config_opts_darwin += -device-option CROSS_COMPILE="$(host)-"
125126
$(package)_config_opts_darwin += -device-option MAC_MIN_VERSION=$(OSX_MIN_VERSION)
126127
$(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
128+
$(package)_config_opts_darwin += -device-option XCODE_VERSION=$(XCODE_VERSION)
127129
endif
128130

129131
$(package)_config_opts_linux = -qt-xkbcommon-x11
@@ -192,33 +194,52 @@ define $(package)_extract_cmds
192194
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
193195
endef
194196

197+
# Preprocessing steps work as follows:
198+
#
199+
# 1. Apply our patches to the extracted source. See each patch for more info.
200+
#
201+
# 2. Point to lrelease in qttools/bin/lrelease; otherwise Qt will look for it in
202+
# $(host)/native/bin/lrelease and not find it.
203+
#
204+
# 3. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf.
205+
#
206+
# 4. After making a copy of the mkspec for the linux-arm-gnueabi host, named
207+
# bitcoin-linux-g++, replace instances of linux-arm-gnueabi with $(host). This
208+
# way we can generically support hosts like riscv64-linux-gnu, which Qt doesn't
209+
# ship a mkspec for. See it's usage in config_opts_* above.
210+
#
211+
# 5. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds.
212+
#
213+
# 6. Do similar for the win32-g++ mkspec.
214+
#
215+
# 7. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466.
216+
#
217+
# 8. Adjust a regex in toolchain.prf, to accomodate Guix's usage of
218+
# CROSS_LIBRARY_PATH. See #15277.
195219
define $(package)_preprocess_cmds
196220
patch -p1 -i $($(package)_patch_dir)/freetype_back_compat.patch && \
197221
patch -p1 -i $($(package)_patch_dir)/fix_powerpc_libpng.patch && \
198-
sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \
199222
patch -p1 -i $($(package)_patch_dir)/drop_lrelease_dependency.patch && \
200-
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch &&\
223+
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
224+
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
225+
patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch && \
226+
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch && \
227+
patch -p1 -i $($(package)_patch_dir)/fix_rcc_determinism.patch && \
228+
patch -p1 -i $($(package)_patch_dir)/xkb-default.patch && \
229+
patch -p1 -i $($(package)_patch_dir)/fix_android_qmake_conf.patch && \
230+
patch -p1 -i $($(package)_patch_dir)/fix_android_jni_static.patch && \
231+
patch -p1 -i $($(package)_patch_dir)/fix_riscv64_arch.patch && \
232+
patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \
233+
patch -p1 -i $($(package)_patch_dir)/fix_mingw_cross_compile.patch && \
234+
sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \
201235
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
202-
cp -f qtbase/mkspecs/macx-clang/Info.plist.lib qtbase/mkspecs/macx-clang-linux/ &&\
203-
cp -f qtbase/mkspecs/macx-clang/Info.plist.app qtbase/mkspecs/macx-clang-linux/ &&\
204236
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
205237
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
206238
cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \
207239
sed -i.old "s/arm-linux-gnueabi-/$(host)-/g" qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
208-
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch &&\
209-
patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch &&\
210-
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch &&\
211-
patch -p1 -i $($(package)_patch_dir)/fix_rcc_determinism.patch &&\
212-
patch -p1 -i $($(package)_patch_dir)/xkb-default.patch &&\
213-
patch -p1 -i $($(package)_patch_dir)/fix_android_qmake_conf.patch &&\
214-
patch -p1 -i $($(package)_patch_dir)/fix_android_jni_static.patch &&\
215240
echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
216241
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
217242
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
218-
patch -p1 -i $($(package)_patch_dir)/fix_riscv64_arch.patch &&\
219-
patch -p1 -i $($(package)_patch_dir)/no-xlib.patch &&\
220-
echo "QMAKE_LINK_OBJECT_MAX = 10" >> qtbase/mkspecs/win32-g++/qmake.conf &&\
221-
echo "QMAKE_LINK_OBJECT_SCRIPT = object_script" >> qtbase/mkspecs/win32-g++/qmake.conf &&\
222243
sed -i.old "s|QMAKE_CFLAGS += |!host_build: QMAKE_CFLAGS = $($(package)_cflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \
223244
sed -i.old "s|QMAKE_CXXFLAGS += |!host_build: QMAKE_CXXFLAGS = $($(package)_cxxflags) $($(package)_cppflags) |" qtbase/mkspecs/win32-g++/qmake.conf && \
224245
sed -i.old "0,/^QMAKE_LFLAGS_/s|^QMAKE_LFLAGS_|!host_build: QMAKE_LFLAGS = $($(package)_ldflags)\n&|" qtbase/mkspecs/win32-g++/qmake.conf && \
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
commit 5a992a549adfe5a587bbcd6cd2b2cee47d236e27
2+
Author: fanquake <[email protected]>
3+
Date: Fri Sep 4 08:13:44 2020 +0800
4+
5+
Work around broken mingw cross-compilation
6+
7+
See upstream issues:
8+
https://bugreports.qt.io/browse/QTBUG-63637
9+
https://bugreports.qt.io/browse/QTBUG-63659
10+
https://codereview.qt-project.org/q/8bebded9
11+
12+
We should be able to drop this once we are building qt 5.10.1 or later.
13+
14+
Added in #12971.
15+
16+
diff --git a/qtbase/mkspecs/win32-g++/qmake.conf b/qtbase/mkspecs/win32-g++/qmake.conf
17+
index e071a0d1..ad229b10 100644
18+
--- a/qtbase/mkspecs/win32-g++/qmake.conf
19+
+++ b/qtbase/mkspecs/win32-g++/qmake.conf
20+
@@ -87,3 +87,5 @@ QMAKE_NM = $${CROSS_COMPILE}nm -P
21+
include(../common/angle.conf)
22+
23+
load(qt_config)
24+
+QMAKE_LINK_OBJECT_MAX = 10
25+
+QMAKE_LINK_OBJECT_SCRIPT = object_script

depends/patches/qt/mac-qmake.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
MAKEFILE_GENERATOR = UNIX
2-
CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname absolute_library_soname
2+
CONFIG += app_bundle incremental lib_version_first absolute_library_soname
33
QMAKE_INCREMENTAL_STYLE = sublib
44
include(../common/macx.conf)
55
include(../common/gcc-base-mac.conf)
66
include(../common/clang.conf)
77
include(../common/clang-mac.conf)
88
QMAKE_MAC_SDK_PATH=$${MAC_SDK_PATH}
9-
QMAKE_XCODE_VERSION=4.3
9+
QMAKE_XCODE_VERSION = $${XCODE_VERSION}
1010
QMAKE_XCODE_DEVELOPER_PATH=/Developer
1111
QMAKE_MACOSX_DEPLOYMENT_TARGET = $${MAC_MIN_VERSION}
1212
QMAKE_MAC_SDK=macosx

0 commit comments

Comments
 (0)