libsForQt5.qtbase: fix Darwin build by removing obsolete patches

Another existing bug exposed by
514b00cf08: the build system was
interpolating an empty SDK directory and passing `-isysroot  -g0`,
eating a compiler flag and breaking the build now that we don’t
pass a redundant `-isysroot` of our own.

Thankfully, with the new SDK pattern, we don’t need to do any of
this elaborate patching; just pointing it at the right tools from
`xcbuild` lets it figure everything out itself.
This commit is contained in:
Emily
2024-10-28 18:59:35 +00:00
parent c088f62147
commit d85a1e50fe
5 changed files with 19 additions and 790 deletions

View File

@@ -28,15 +28,7 @@ let
qtCompatVersion = srcs.qtbase.version;
patches = {
qtbase = lib.optionals stdenv.hostPlatform.isDarwin [
./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
# Patch framework detection to support X.framework/X.tbd,
# extending the current support for X.framework/X.
./qtbase.patch.d/0012-qtbase-tbd-frameworks.patch
./qtbase.patch.d/0014-aarch64-darwin.patch
] ++ [
qtbase = [
./qtbase.patch.d/0003-qtbase-mkspecs.patch
./qtbase.patch.d/0004-qtbase-replace-libdir.patch
./qtbase.patch.d/0005-qtbase-cmake.patch

View File

@@ -1,485 +0,0 @@
From 5ec1d1009d9943f20e82ffc087deabb31d447e75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
Date: Fri, 3 Apr 2020 21:07:58 +0200
Subject: [PATCH 01/11] qtbase-mkspecs-mac
---
mkspecs/common/mac.conf | 2 +-
mkspecs/features/mac/default_post.prf | 206 --------------------------
mkspecs/features/mac/default_pre.prf | 58 --------
mkspecs/features/mac/sdk.mk | 25 ----
mkspecs/features/mac/sdk.prf | 61 --------
5 files changed, 1 insertion(+), 351 deletions(-)
delete mode 100644 mkspecs/features/mac/sdk.mk
delete mode 100644 mkspecs/features/mac/sdk.prf
diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
index 61bea952b2..9909dae726 100644
--- a/mkspecs/common/mac.conf
+++ b/mkspecs/common/mac.conf
@@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL = \
QMAKE_FIX_RPATH = install_name_tool -id
-QMAKE_LFLAGS_RPATH = -Wl,-rpath,
+QMAKE_LFLAGS_RPATH =
QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
QMAKE_LFLAGS_REL_RPATH =
diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
index abc6d82ade..59b94fe5b6 100644
--- a/mkspecs/features/mac/default_post.prf
+++ b/mkspecs/features/mac/default_post.prf
@@ -1,9 +1,5 @@
load(default_post)
-# Recompute SDK version in case the user set it explicitly
-sdk_version = $$QMAKE_MAC_SDK_VERSION
-QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
-
contains(TEMPLATE, .*app) {
!macx-xcode:if(isEmpty(BUILDS)|build_pass) {
# Detect changes to the platform SDK
@@ -16,36 +12,6 @@ contains(TEMPLATE, .*app) {
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk)
}
- # Detect incompatible SDK versions
-
- isEmpty(QT_MAC_SDK_VERSION_MIN): \
- QT_MAC_SDK_VERSION_MIN = $$QT_MAC_SDK_VERSION
-
- !versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_MIN): \
- warning("Qt requires at least version $$QT_MAC_SDK_VERSION_MIN of the platform SDK," \
- "you're building against version $${QMAKE_MAC_SDK_VERSION}. Please upgrade.")
-
- !isEmpty(QT_MAC_SDK_VERSION_MAX) {
- # For Qt developers only
- !isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
- CONFIG += sdk_no_version_check
-
- QMAKE_MAC_SDK_MAJOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\\d+)(\\.\\d+)(\\.\\d+)?", \\1)
-
- !sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) {
- warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_MAX"\
- "of the platform SDK, you're using $${QMAKE_MAC_SDK_MAJOR_VERSION}.")
- warning("This is an unsupported configuration. You may experience build issues," \
- "and by using")
- warning("the $$QMAKE_MAC_SDK_VERSION SDK you are opting in to new features" \
- "that Qt has not been prepared for.")
-
- warning("Please downgrade the SDK you use to build your app to version" \
- "$$QT_MAC_SDK_VERSION_MAX, or configure")
- warning("with CONFIG+=sdk_no_version_check when running qmake" \
- "to silence this warning.")
- }
- }
}
!no_objective_c:CONFIG += objective_c
@@ -73,230 +39,6 @@ qt {
}
}
-# Add the same default rpaths as Xcode does for new projects.
-# This is especially important for iOS/tvOS/watchOS where no other option is possible.
-!no_default_rpath {
- uikit: QMAKE_RPATHDIR += @executable_path/Frameworks
- else: QMAKE_RPATHDIR += @executable_path/../Frameworks
- equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
-}
-
-# Don't pass -headerpad_max_install_names when using Bitcode.
-# In that case the linker emits a warning stating that the flag is ignored when
-# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
-# Using this flag is also unnecessary in practice on UIKit platforms since they
-# are sandboxed, and only UIKit platforms support bitcode to begin with.
-!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
-
-app_extension_api_only {
- QMAKE_CFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
- QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
- QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
-}
-
-macos {
- !isEmpty(QMAKE_APPLE_DEVICE_ARCHS) {
- # If the user has requested a specific set of architectures,
- # build all of those by default, but limited to only those.
- CONFIG -= only_active_arch
- } else {
- # Otherwise allow building all of the architectures available
- # in Qt, but only build the active arch (unless the user has
- # manually overridden this via CONFIG -= only_active_arch).
- QMAKE_APPLE_DEVICE_ARCHS = $$QT_ARCHS
- }
-}
-
-macx-xcode {
- qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
- !isEmpty(QMAKE_PKGINFO_TYPEINFO): \
- qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
- else: \
- qmake_pkginfo_typeinfo.value = "????"
- QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
-
- bundle_version = $$VERSION
- isEmpty(bundle_version): bundle_version = 1.0.0
-
- l = $$split(bundle_version, '.') 0 0 # make sure there are at least three
- VER_MAJ = $$member(l, 0, 0)
- VER_MIN = $$member(l, 1, 1)
- VER_PAT = $$member(l, 2, 2)
- unset(l)
-
- qmake_full_version.name = QMAKE_FULL_VERSION
- qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
- QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
-
- qmake_short_version.name = QMAKE_SHORT_VERSION
- qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
- QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
-
- !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
- debug_information_format.name = DEBUG_INFORMATION_FORMAT
- debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
- debug_information_format.build = debug
- QMAKE_MAC_XCODE_SETTINGS += debug_information_format
- }
-
- QMAKE_XCODE_ARCHS =
-
- arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
- arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
- QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
- QMAKE_MAC_XCODE_SETTINGS += arch_device
-
- simulator {
- arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
- arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
- QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
- QMAKE_MAC_XCODE_SETTINGS += arch_simulator
- }
-
- only_active_arch.name = ONLY_ACTIVE_ARCH
- only_active_arch.value = YES
- only_active_arch.build = debug
- QMAKE_MAC_XCODE_SETTINGS += only_active_arch
-} else {
- device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
- simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
- VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
-
- single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
-
- macos {
- only_active_arch: DEFAULT_ARCHS = $$system("uname -m")
- else: DEFAULT_ARCHS = $$VALID_ARCHS
- }
-
- ARCHS = $(filter $(EXPORT_VALID_ARCHS), \
- $(if $(ARCHS), $(ARCHS), \
- $(if $(EXPORT_DEFAULT_ARCHS), $(EXPORT_DEFAULT_ARCHS), \
- $(EXPORT_VALID_ARCHS))))
- ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ARCHS), $(EXPORT_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
-
- QMAKE_EXTRA_VARIABLES += VALID_ARCHS DEFAULT_ARCHS ARCHS ARCH_ARGS
-
- arch_flags = $(EXPORT_ARCH_ARGS)
-
- QMAKE_CFLAGS += $$arch_flags
- QMAKE_CXXFLAGS += $$arch_flags
- QMAKE_LFLAGS += $$arch_flags
-
- QMAKE_PCH_ARCHS = $$VALID_ARCHS
-
- macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
- ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
- tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
- watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
-
- # If we're doing a simulator and device build, device and simulator
- # architectures use different paths and flags for the sysroot and
- # deployment target switch, so we must multiplex them across multiple
- # architectures using -Xarch. Otherwise we fall back to the simple path.
- # This is not strictly necessary, but results in cleaner command lines
- # and makes it easier for people to override EXPORT_VALID_ARCHS to limit
- # individual rules to a different set of architecture(s) from the overall
- # build (such as machtest in QtCore).
- simulator:device {
- QMAKE_XARCH_CFLAGS =
- QMAKE_XARCH_LFLAGS =
- QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
-
- for (arch, VALID_ARCHS) {
- contains(VALID_SIMULATOR_ARCHS, $$arch) {
- sdk = $$simulator.sdk
- version_identifier = $$simulator.deployment_identifier
- } else {
- sdk = $$device.sdk
- version_identifier = $$device.deployment_identifier
- }
-
- version_min_flags = \
- -Xarch_$${arch} \
- -m$${version_identifier}-version-min=$$deployment_target
- QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
- -Xarch_$${arch} \
- -isysroot$$xcodeSDKInfo(Path, $$sdk)
- QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
- -Xarch_$${arch} \
- -isysroot$$xcodeSDKInfo(Path, $$sdk)
-
- QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
- QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
-
- QMAKE_EXTRA_VARIABLES += \
- QMAKE_XARCH_CFLAGS_$${arch} \
- QMAKE_XARCH_LFLAGS_$${arch}
- }
-
- QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
- QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
- QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
- } else {
- simulator {
- version_identifier = $$simulator.deployment_identifier
- sysroot_path = $$xcodeSDKInfo(Path, $$simulator.sdk)
- } else {
- version_identifier = $$device.deployment_identifier
- sysroot_path = $$xcodeSDKInfo(Path, $$device.sdk)
- }
- version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
- QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
- QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
- QMAKE_LFLAGS += -isysroot $$sysroot_path $$version_min_flag
- }
-
- # Enable precompiled headers for multiple architectures
- QMAKE_CFLAGS_USE_PRECOMPILE =
- for (arch, VALID_ARCHS) {
- icc_pch_style: \
- use_flag = "-pch-use "
- else: \
- use_flag = -include
-
- # Only use Xarch with multi-arch, as the option confuses ccache
- count(VALID_ARCHS, 1, greaterThan): \
- QMAKE_CFLAGS_USE_PRECOMPILE += \
- -Xarch_$${arch}
-
- QMAKE_CFLAGS_USE_PRECOMPILE += \
- $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
- }
- icc_pch_style {
- QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
- QMAKE_CFLAGS_USE_PRECOMPILE =
- } else {
- QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
- QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
- QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
- }
-
- QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
-}
-
-!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
- # Explicit SDK version has been set, respect that
- QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
-}
-
-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
-!isEmpty(QMAKE_XCODE_VERSION): \
- cache(QMAKE_XCODE_VERSION, stash)
-
-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
-
-xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
-xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
-isEmpty(xcode_product_bundle_identifier_setting.value): \
- xcode_product_bundle_identifier_setting.value = "com.yourcompany"
-xcode_product_bundle_target = $$QMAKE_BUNDLE
-isEmpty(xcode_product_bundle_target): \
- xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
-xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
-QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
-
!macx-xcode {
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
generate_xcode_project.target = xcodeproj
diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
index 2c91ba6679..a6ab233825 100644
--- a/mkspecs/features/mac/default_pre.prf
+++ b/mkspecs/features/mac/default_pre.prf
@@ -21,61 +21,3 @@ macos {
}
load(default_pre)
-
-isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
- # Get path of Xcode's Developer directory
- QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
- isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
- error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
-
- # Make sure Xcode path is valid
- !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
- error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
-}
-
-isEmpty(QMAKE_XCODEBUILD_PATH): \
- QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
-
-!isEmpty(QMAKE_XCODEBUILD_PATH) {
- # Make sure Xcode is set up properly
- !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
- error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
-
- isEmpty(QMAKE_XCODE_VERSION) {
- # Extract Xcode version using xcodebuild
- xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
- QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
- isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
- unset(xcode_version)
- }
-}
-
-isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
- QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
- exists($$QMAKE_XCODE_PREFERENCES_FILE): \
- QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
-
- !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
- cache(QMAKE_TARGET_BUNDLE_PREFIX)
-}
-
-QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
-
-# Make the default debug info format for static debug builds
-# DWARF instead of DWARF with dSYM. This cuts down build times
-# for application debug builds significantly, as Xcode doesn't
-# have to pull out all the DWARF info from the Qt static libs
-# and put it into a dSYM file. We don't need that dSYM file in
-# the first place, since the information is available in the
-# object files inside the archives (static libraries).
-macx-xcode:qtConfig(static): \
- QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
-
-# This variable is used by the xcode_dynamic_library_suffix
-# feature, which allows Xcode to choose the Qt libraries to link to
-# at build time, depending on the current Xcode SDK and configuration.
-QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
-
-xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
-xcode_copy_phase_strip_setting.value = NO
-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
--- a/mkspecs/features/mac/sdk.mk
+++ b/mkspecs/features/mac/sdk.mk
@@ -1,27 +0,0 @@
-
-ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)
- CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>/dev/null
- CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND))
- ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
- # We don't want to complain about out of date SDK unless the target needs to be remade.
- # This covers use-cases such as running 'make check' after moving the build to a
- # computer without Xcode or with a different Xcode version.
- TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0)
- ifeq ($(TARGET_UP_TO_DATE),0)
- ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),)
- $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.)
- else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),)
- $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.)
- else ifneq ($(CURRENT_MAC_SDK_VERSION),)
- $(info The $(EXPORT_QMAKE_MAC_SDK) platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
- else
- $(info Unknown error resolving current platform SDK version.)
- endif
- $(info This requires a fresh build of your project. Please wipe the build directory)
- ifneq ($(EXPORT__QMAKE_STASH_),)
- $(info including the qmake cache in $(EXPORT__QMAKE_STASH_))
- endif
- $(error ^)
- endif
- endif
-endif
diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
deleted file mode 100644
index 3a9c2778bb..0000000000
--- a/mkspecs/features/mac/sdk.prf
+++ /dev/null
@@ -1,61 +0,0 @@
-
-isEmpty(QMAKE_MAC_SDK): \
- error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
-
-contains(QMAKE_MAC_SDK, .*/.*): \
- error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
-
-defineReplace(xcodeSDKInfo) {
- info = $$1
- equals(info, "Path"): \
- infoarg = --show-sdk-path
- equals(info, "PlatformPath"): \
- infoarg = --show-sdk-platform-path
- equals(info, "SDKVersion"): \
- infoarg = --show-sdk-version
- sdk = $$2
- isEmpty(sdk): \
- sdk = $$QMAKE_MAC_SDK
-
- isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
- QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null")
- # --show-sdk-platform-path won't work for Command Line Tools; this is fine
- # only used by the XCTest backend to testlib
- isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \
- error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
- cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
- }
-
- return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
-}
-
-QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
-QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
-QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
-
-isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) {
- QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL
- sysrootified =
- for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
- QMAKE_INCDIR_OPENGL = $$sysrootified
-}
-
-QMAKESPEC_NAME = $$basename(QMAKESPEC)
-
-# Resolve SDK version of various tools
-for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) {
- tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
- !isEmpty($$tool_variable) {
- $$tool = $$eval($$tool_variable)
- next()
- }
-
- value = $$eval($$tool)
- isEmpty(value): next()
-
- sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
- isEmpty(sysrooted): next()
-
- $$tool = $$sysrooted $$member(value, 1, -1)
- cache($$tool_variable, set stash, $$tool)
-}
diff --git a/mkspecs/features/mac/toolchain.prf b/mkspecs/features/mac/toolchain.prf
deleted file mode 100644
index df191eb13c..0000000000
--- a/mkspecs/features/mac/toolchain.prf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Ensure that we process sdk.prf first, as it will update QMAKE_CXX,
-# which the default path determination uses.
-sdk: load(sdk)
-
-load(toolchain)

View File

@@ -1,15 +0,0 @@
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
index 84dbbfebd4..615bfed124 100644
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ b/src/gui/Qt5GuiConfigExtras.cmake.in
@@ -119,6 +119,10 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
if (NOT EXISTS "${Qt5Gui_${_cmake_lib_name}_LIBRARY}")
set(Qt5Gui_${_cmake_lib_name}_LIBRARY)
endif()
+ set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}.tbd")
+ if (NOT EXISTS "${Qt5Gui_${_cmake_lib_name}_LIBRARY}")
+ set(Qt5Gui_${_cmake_lib_name}_LIBRARY)
+ endif()
!!ENDIF
if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
# The above find_library call doesn\'t work for finding

View File

@@ -1,275 +0,0 @@
From abc52460201bc5c7603505bb187138b0c59291aa Mon Sep 17 00:00:00 2001
From: Mushroom <mushroom@watchingyour.tv>
Date: Sun, 20 Dec 2020 00:11:41 +0000
Subject: [PATCH] [QtBase] Split macOS platforms by architecture
Currently macOS only has one platform, which forces the default arch to
x86_64. This patch splits the platforms by architecture, and defaults to
the same as the host.
This stops M1-based macs from compiling x64 binaries by default,
instead making them compile native binaries.
[ChangeLog][QtBase][Platform Specific Changes][OS X] Split macOS
platforms so it doesn't default to the x64 architecture every time
Change-Id: I34891b107bb24f68371df1c8f087eb0ad5b5dd95
---
configure | 9 +++-
.../clang-macx-desktop.conf} | 8 ++--
mkspecs/common/macx.conf | 1 -
.../Info.plist.app | 0
.../Info.plist.dSYM.in | 0
.../Info.plist.disable_highdpi | 0
.../Info.plist.lib | 0
mkspecs/macx-clang-arm64/qmake.conf | 7 ++++
.../qplatformdefs.h | 0
mkspecs/macx-clang-x64/Info.plist.app | 24 +++++++++++
mkspecs/macx-clang-x64/Info.plist.dSYM.in | 18 ++++++++
.../macx-clang-x64/Info.plist.disable_highdpi | 8 ++++
mkspecs/macx-clang-x64/Info.plist.lib | 20 +++++++++
mkspecs/macx-clang-x64/qmake.conf | 7 ++++
mkspecs/macx-clang-x64/qplatformdefs.h | 41 +++++++++++++++++++
15 files changed, 137 insertions(+), 6 deletions(-)
rename mkspecs/{macx-clang/qmake.conf => common/clang-macx-desktop.conf} (83%)
rename mkspecs/{macx-clang => macx-clang-arm64}/Info.plist.app (100%)
rename mkspecs/{macx-clang => macx-clang-arm64}/Info.plist.dSYM.in (100%)
rename mkspecs/{macx-clang => macx-clang-arm64}/Info.plist.disable_highdpi (100%)
rename mkspecs/{macx-clang => macx-clang-arm64}/Info.plist.lib (100%)
create mode 100644 mkspecs/macx-clang-arm64/qmake.conf
rename mkspecs/{macx-clang => macx-clang-arm64}/qplatformdefs.h (100%)
create mode 100644 mkspecs/macx-clang-x64/Info.plist.app
create mode 100644 mkspecs/macx-clang-x64/Info.plist.dSYM.in
create mode 100644 mkspecs/macx-clang-x64/Info.plist.disable_highdpi
create mode 100644 mkspecs/macx-clang-x64/Info.plist.lib
create mode 100644 mkspecs/macx-clang-x64/qmake.conf
create mode 100644 mkspecs/macx-clang-x64/qplatformdefs.h
diff --git a/configure b/configure
index b6c9b462f24..a86f2ceaa5b 100755
--- a/configure
+++ b/configure
@@ -556,7 +556,14 @@ PLATFORM_NOTES=
if [ -z "$PLATFORM" ]; then
case "$UNAME_SYSTEM:$UNAME_RELEASE" in
Darwin:*)
- PLATFORM=macx-clang
+ case "$UNAME_MACHINE" in
+ arm64)
+ PLATFORM=macx-clang-arm64
+ ;;
+ *)
+ PLATFORM=macx-clang-x64
+ ;;
+ esac
;;
AIX:*)
#PLATFORM=aix-g++
diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/common/clang-macx-desktop.conf
similarity index 83%
rename from mkspecs/macx-clang/qmake.conf
rename to mkspecs/common/clang-macx-desktop.conf
index 0cf1f31b60d..042319a2aa3 100644
--- a/mkspecs/macx-clang/qmake.conf
+++ b/mkspecs/common/clang-macx-desktop.conf
@@ -24,9 +24,9 @@ QMAKE_LIBS_X11 = -lX11 -lXext -lm
QMAKE_LIBDIR_X11 = /opt/X11/lib
QMAKE_INCDIR_X11 = /opt/X11/include
-include(../common/macx.conf)
-include(../common/gcc-base-mac.conf)
-include(../common/clang.conf)
-include(../common/clang-mac.conf)
+include(macx.conf)
+include(gcc-base-mac.conf)
+include(clang.conf)
+include(clang-mac.conf)
load(qt_config)
diff --git a/mkspecs/macx-clang/Info.plist.app b/mkspecs/macx-clang-arm64/Info.plist.app
similarity index 100%
rename from mkspecs/macx-clang/Info.plist.app
rename to mkspecs/macx-clang-arm64/Info.plist.app
diff --git a/mkspecs/macx-clang/Info.plist.dSYM.in b/mkspecs/macx-clang-arm64/Info.plist.dSYM.in
similarity index 100%
rename from mkspecs/macx-clang/Info.plist.dSYM.in
rename to mkspecs/macx-clang-arm64/Info.plist.dSYM.in
diff --git a/mkspecs/macx-clang/Info.plist.disable_highdpi b/mkspecs/macx-clang-arm64/Info.plist.disable_highdpi
similarity index 100%
rename from mkspecs/macx-clang/Info.plist.disable_highdpi
rename to mkspecs/macx-clang-arm64/Info.plist.disable_highdpi
diff --git a/mkspecs/macx-clang/Info.plist.lib b/mkspecs/macx-clang-arm64/Info.plist.lib
similarity index 100%
rename from mkspecs/macx-clang/Info.plist.lib
rename to mkspecs/macx-clang-arm64/Info.plist.lib
diff --git a/mkspecs/macx-clang-arm64/qmake.conf b/mkspecs/macx-clang-arm64/qmake.conf
new file mode 100644
index 00000000000..0cc2361e696
--- /dev/null
+++ b/mkspecs/macx-clang-arm64/qmake.conf
@@ -0,0 +1,7 @@
+#
+# qmake configuration for Clang on OS X (arm64)
+#
+
+QMAKE_APPLE_DEVICE_ARCHS=arm64
+
+include(../common/clang-macx-desktop.conf)
diff --git a/mkspecs/macx-clang/qplatformdefs.h b/mkspecs/macx-clang-arm64/qplatformdefs.h
similarity index 100%
rename from mkspecs/macx-clang/qplatformdefs.h
rename to mkspecs/macx-clang-arm64/qplatformdefs.h
diff --git a/mkspecs/macx-clang-x64/Info.plist.app b/mkspecs/macx-clang-x64/Info.plist.app
new file mode 100644
index 00000000000..fa592af0897
--- /dev/null
+++ b/mkspecs/macx-clang-x64/Info.plist.app
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string>${ASSETCATALOG_COMPILER_APPICON_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>${QMAKE_PKGINFO_TYPEINFO}</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>${MACOSX_DEPLOYMENT_TARGET}</string>
+ <key>NOTE</key>
+ <string>This file was generated by Qt/QMake.</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
+ <true/>
+</dict>
+</plist>
diff --git a/mkspecs/macx-clang-x64/Info.plist.dSYM.in b/mkspecs/macx-clang-x64/Info.plist.dSYM.in
new file mode 100644
index 00000000000..a8c8d0d4fb5
--- /dev/null
+++ b/mkspecs/macx-clang-x64/Info.plist.dSYM.in
@@ -0,0 +1,18 @@
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
+<plist version=\"1.0\">
+ <dict>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+!!IF !isEmpty(VERSION)
+ <key>CFBundleShortVersionString</key>
+ <string>$${VER_MAJ}.$${VER_MIN}</string>
+ <key>CFBundleVersion</key>
+ <string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
+!!ENDIF
+ </dict>
+</plist>
diff --git a/mkspecs/macx-clang-x64/Info.plist.disable_highdpi b/mkspecs/macx-clang-x64/Info.plist.disable_highdpi
new file mode 100644
index 00000000000..a9b89888ad4
--- /dev/null
+++ b/mkspecs/macx-clang-x64/Info.plist.disable_highdpi
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>NSHighResolutionCapable</key>
+ <string>NO</string>
+</dict>
+</plist>
diff --git a/mkspecs/macx-clang-x64/Info.plist.lib b/mkspecs/macx-clang-x64/Info.plist.lib
new file mode 100644
index 00000000000..34752ec40d9
--- /dev/null
+++ b/mkspecs/macx-clang-x64/Info.plist.lib
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${QMAKE_SHORT_VERSION}</string>
+ <key>CFBundleSignature</key>
+ <string>${QMAKE_PKGINFO_TYPEINFO}</string>
+ <key>CFBundleVersion</key>
+ <string>${QMAKE_FULL_VERSION}</string>
+ <key>NOTE</key>
+ <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string>
+</dict>
+</plist>
diff --git a/mkspecs/macx-clang-x64/qmake.conf b/mkspecs/macx-clang-x64/qmake.conf
new file mode 100644
index 00000000000..1ac373b53b4
--- /dev/null
+++ b/mkspecs/macx-clang-x64/qmake.conf
@@ -0,0 +1,7 @@
+#
+# qmake configuration for Clang on OS X (arm64)
+#
+
+QMAKE_APPLE_DEVICE_ARCHS=x86_64
+
+include(../common/clang-macx-desktop.conf)
diff --git a/mkspecs/macx-clang-x64/qplatformdefs.h b/mkspecs/macx-clang-x64/qplatformdefs.h
new file mode 100644
index 00000000000..063491dd900
--- /dev/null
+++ b/mkspecs/macx-clang-x64/qplatformdefs.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../common/mac/qplatformdefs.h"
+

View File

@@ -146,13 +146,24 @@ stdenv.mkDerivation (finalAttrs: ({
patchShebangs ./bin
'' + (
if stdenv.hostPlatform.isDarwin then ''
for file in \
configure \
mkspecs/features/mac/asset_catalogs.prf \
mkspecs/features/mac/default_pre.prf \
mkspecs/features/mac/sdk.mk \
mkspecs/features/mac/sdk.prf
do
substituteInPlace "$file" \
--replace-quiet /usr/bin/xcode-select '${lib.getExe' xcbuild "xcode-select"}' \
--replace-quiet /usr/bin/xcrun '${lib.getExe' xcbuild "xcrun"}' \
--replace-quiet /usr/libexec/PlistBuddy '${lib.getExe' xcbuild "PlistBuddy"}'
done
substituteInPlace configure \
--replace-fail '/usr/bin/xcode-select' '${lib.getBin xcbuild}/bin/xcode-select' \
--replace-fail '/usr/bin/xcrun' '${lib.getBin xcbuild}/bin/xcrun' \
--replace-fail '/System/Library/Frameworks/Cocoa.framework' "$SDKROOT/System/Library/Frameworks/Cocoa.framework"
substituteInPlace ./mkspecs/common/mac.conf \
--replace-fail "/System/Library/Frameworks/OpenGL.framework/" "$SDKROOT/System/Library/Frameworks/OpenGL.framework/" \
--replace-fail "/System/Library/Frameworks/AGL.framework/" "$SDKROOT/System/Library/Frameworks/AGL.framework/"
--replace-fail /System/Library/Frameworks/Cocoa.framework "$SDKROOT/System/Library/Frameworks/Cocoa.framework"
substituteInPlace mkspecs/common/macx.conf \
--replace-fail 'CONFIG += ' 'CONFIG += no_default_rpath '
'' else lib.optionalString libGLSupported ''
sed -i mkspecs/common/linux.conf \
-e "/^QMAKE_INCDIR_OPENGL/ s|$|${lib.getDev libGL}/include|" \
@@ -326,6 +337,7 @@ stdenv.mkDerivation (finalAttrs: ({
"-qt-freetype"
"-qt-libpng"
"-no-framework"
"-no-rpath"
] else [
"-rpath"
] ++ [