Skip to content

Commit 160d236

Browse files
committed
Merge bitcoin/bitcoin#28851: build: Patch Qt to handle minimum macOS version properly
05aca09 build: Patch Qt to handle minimum macOS version properly (Hennadii Stepanov) Pull request description: This PR is: - required to [switch](bitcoin/bitcoin#28622) to macOS 14 SDK (Xcode 15). - an alternative to bitcoin/bitcoin#28732 and bitcoin/bitcoin#28775. Qt relies on the `__MAC_OS_X_VERSION_MIN_REQUIRED` macro, which is set in the `AvailabilityInternal.h` SDK header to the value provided by the Clang driver from the `-mmacos-version-min` / `-mmacosx-version-min` option. Xcode 12 SDK expects the OS-specific `__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__` macro: ```c++ #ifndef __MAC_OS_X_VERSION_MIN_REQUIRED #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ /* compiler for Mac OS X sets __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ */ #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #endif #endif /* __MAC_OS_X_VERSION_MIN_REQUIRED*/ ``` In the other hand, Xcode 15 SDK expects a general `__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__` macro: ```c++ #ifndef __MAC_OS_X_VERSION_MIN_REQUIRED #if defined(__has_builtin) && __has_builtin(__is_target_os) #if __is_target_os(macos) #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_14_0 #endif #elif __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_14_0 #endif /* __has_builtin(__is_target_os) && __is_target_os(macos) */ #endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */ ``` The latter macro is not provided by LLVM Clang until llvm/llvm-project@c8e2dd8, which is available in Clang 17. The suggested patch makes Qt "borrow" the `__MAC_OS_X_VERSION_MIN_REQUIRED` value from `MAC_OS_X_VERSION_MIN_REQUIRED`, which is set in the `AvailabilityMacros.h` SDK header. ACKs for top commit: maflcko: lgtm ACK 05aca09 Tree-SHA512: 8891aefde4b8a48885abf0648f4ec71a22f7fcfca1e17ebb8c70ce1ef44751ea5db6b8b652de6ee8a716ca5f96f720fef01600bc23986162d0146c946e2e8743
2 parents 5aa37ca + 05aca09 commit 160d236

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

depends/packages/qt.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ $(package)_patches += guix_cross_lib_path.patch
2323
$(package)_patches += fix-macos-linker.patch
2424
$(package)_patches += memory_resource.patch
2525
$(package)_patches += windows_lto.patch
26+
$(package)_patches += fix-minimum-macos.patch
2627

2728
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
2829
$(package)_qttranslations_sha256_hash=a31785948c640b7c66d9fe2db4993728ca07f64e41c560b3625ad191b276ff20
@@ -239,6 +240,7 @@ endef
239240
define $(package)_preprocess_cmds
240241
cp $($(package)_patch_dir)/qt.pro qt.pro && \
241242
cp $($(package)_patch_dir)/qttools_src.pro qttools/src/src.pro && \
243+
patch -p1 -i $($(package)_patch_dir)/fix-minimum-macos.patch && \
242244
patch -p1 -i $($(package)_patch_dir)/fix-macos-linker.patch && \
243245
patch -p1 -i $($(package)_patch_dir)/dont_hardcode_pwd.patch && \
244246
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch && \
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Ensure that Qt handles the minimum macOS version properly
2+
3+
This patch can be dropped for LLVM Clang 17+, after commit
4+
https://github.com/llvm/llvm-project/commit/c8e2dd8c6f490b68e41fe663b44535a8a21dfeab
5+
6+
7+
--- a/qtbase/src/corelib/global/qsystemdetection.h
8+
+++ b/qtbase/src/corelib/global/qsystemdetection.h
9+
@@ -220,6 +220,9 @@
10+
# include <Availability.h>
11+
# include <AvailabilityMacros.h>
12+
#
13+
+# undef __MAC_OS_X_VERSION_MIN_REQUIRED
14+
+# define __MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_MIN_REQUIRED
15+
+#
16+
# ifdef Q_OS_MACOS
17+
# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
18+
# undef __MAC_OS_X_VERSION_MIN_REQUIRED

0 commit comments

Comments
 (0)