1 From a5848991db270ffdd9f2fa05220475bb3194d12f Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
3 Date: Fri, 3 Apr 2020 21:07:58 +0200
4 Subject: [PATCH 01/10] qtbase-mkspecs-mac
7 mkspecs/common/mac.conf | 2 +-
8 mkspecs/features/mac/default_post.prf | 206 --------------------------
9 mkspecs/features/mac/default_pre.prf | 58 --------
10 mkspecs/features/mac/sdk.mk | 25 ----
11 mkspecs/features/mac/sdk.prf | 61 --------
12 5 files changed, 1 insertion(+), 351 deletions(-)
13 delete mode 100644 mkspecs/features/mac/sdk.mk
14 delete mode 100644 mkspecs/features/mac/sdk.prf
16 diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
17 index 61bea952b2..9909dae726 100644
18 --- a/mkspecs/common/mac.conf
19 +++ b/mkspecs/common/mac.conf
20 @@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL = \
22 QMAKE_FIX_RPATH = install_name_tool -id
24 -QMAKE_LFLAGS_RPATH = -Wl,-rpath,
26 QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
28 QMAKE_LFLAGS_REL_RPATH =
29 diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
30 index ba163efc18..b80ec1e801 100644
31 --- a/mkspecs/features/mac/default_post.prf
32 +++ b/mkspecs/features/mac/default_post.prf
33 @@ -68,212 +68,6 @@ qt {
37 -# Add the same default rpaths as Xcode does for new projects.
38 -# This is especially important for iOS/tvOS/watchOS where no other option is possible.
40 - uikit: QMAKE_RPATHDIR += @executable_path/Frameworks
41 - else: QMAKE_RPATHDIR += @executable_path/../Frameworks
42 - equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
45 -# Don't pass -headerpad_max_install_names when using Bitcode.
46 -# In that case the linker emits a warning stating that the flag is ignored when
47 -# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
48 -# Using this flag is also unnecessary in practice on UIKit platforms since they
49 -# are sandboxed, and only UIKit platforms support bitcode to begin with.
50 -!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
52 -app_extension_api_only {
53 - QMAKE_CFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
54 - QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
55 - QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
56 - QMAKE_LFLAGS += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
60 - qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
61 - !isEmpty(QMAKE_PKGINFO_TYPEINFO): \
62 - qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
64 - qmake_pkginfo_typeinfo.value = "????"
65 - QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
67 - bundle_version = $$VERSION
68 - isEmpty(bundle_version): bundle_version = 1.0.0
70 - l = $$split(bundle_version, '.') 0 0 # make sure there are at least three
71 - VER_MAJ = $$member(l, 0, 0)
72 - VER_MIN = $$member(l, 1, 1)
73 - VER_PAT = $$member(l, 2, 2)
76 - qmake_full_version.name = QMAKE_FULL_VERSION
77 - qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
78 - QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
80 - qmake_short_version.name = QMAKE_SHORT_VERSION
81 - qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
82 - QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
84 - !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
85 - debug_information_format.name = DEBUG_INFORMATION_FORMAT
86 - debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
87 - debug_information_format.build = debug
88 - QMAKE_MAC_XCODE_SETTINGS += debug_information_format
93 - arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
94 - arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
95 - QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
96 - QMAKE_MAC_XCODE_SETTINGS += arch_device
99 - arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
100 - arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
101 - QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
102 - QMAKE_MAC_XCODE_SETTINGS += arch_simulator
105 - only_active_arch.name = ONLY_ACTIVE_ARCH
106 - only_active_arch.value = YES
107 - only_active_arch.build = debug
108 - QMAKE_MAC_XCODE_SETTINGS += only_active_arch
110 - device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
111 - simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
112 - VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
114 - isEmpty(VALID_ARCHS): \
115 - error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture")
117 - single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
119 - ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
120 - ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
122 - QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
124 - arch_flags = $(EXPORT_ARCH_ARGS)
126 - QMAKE_CFLAGS += $$arch_flags
127 - QMAKE_CXXFLAGS += $$arch_flags
128 - QMAKE_LFLAGS += $$arch_flags
130 - QMAKE_PCH_ARCHS = $$VALID_ARCHS
132 - macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
133 - ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
134 - tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
135 - watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
137 - # If we're doing a simulator and device build, device and simulator
138 - # architectures use different paths and flags for the sysroot and
139 - # deployment target switch, so we must multiplex them across multiple
140 - # architectures using -Xarch. Otherwise we fall back to the simple path.
141 - # This is not strictly necessary, but results in cleaner command lines
142 - # and makes it easier for people to override EXPORT_VALID_ARCHS to limit
143 - # individual rules to a different set of architecture(s) from the overall
144 - # build (such as machtest in QtCore).
146 - QMAKE_XARCH_CFLAGS =
147 - QMAKE_XARCH_LFLAGS =
148 - QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
150 - for (arch, VALID_ARCHS) {
151 - contains(VALID_SIMULATOR_ARCHS, $$arch) {
152 - sdk = $$simulator.sdk
153 - version_identifier = $$simulator.deployment_identifier
156 - version_identifier = $$device.deployment_identifier
159 - version_min_flags = \
161 - -m$${version_identifier}-version-min=$$deployment_target
162 - QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
164 - -isysroot$$xcodeSDKInfo(Path, $$sdk)
165 - QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
167 - -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
169 - QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
170 - QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
172 - QMAKE_EXTRA_VARIABLES += \
173 - QMAKE_XARCH_CFLAGS_$${arch} \
174 - QMAKE_XARCH_LFLAGS_$${arch}
177 - QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
178 - QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
179 - QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
182 - version_identifier = $$simulator.deployment_identifier
183 - sysroot_path = $$xcodeSDKInfo(Path, $$simulator.sdk)
185 - version_identifier = $$device.deployment_identifier
186 - sysroot_path = $$xcodeSDKInfo(Path, $$device.sdk)
188 - version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
189 - QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
190 - QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
191 - QMAKE_LFLAGS += -Wl,-syslibroot,$$sysroot_path $$version_min_flag
194 - # Enable precompiled headers for multiple architectures
195 - QMAKE_CFLAGS_USE_PRECOMPILE =
196 - for (arch, VALID_ARCHS) {
198 - use_flag = "-pch-use "
200 - use_flag = -include
202 - # Only use Xarch with multi-arch, as the option confuses ccache
203 - count(VALID_ARCHS, 1, greaterThan): \
204 - QMAKE_CFLAGS_USE_PRECOMPILE += \
207 - QMAKE_CFLAGS_USE_PRECOMPILE += \
208 - $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
211 - QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
212 - QMAKE_CFLAGS_USE_PRECOMPILE =
214 - QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
215 - QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
216 - QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
219 - QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
222 -!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
223 - # Explicit SDK version has been set, respect that
224 - QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
227 -cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
228 -!isEmpty(QMAKE_XCODE_VERSION): \
229 - cache(QMAKE_XCODE_VERSION, stash)
231 -QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
233 -xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
234 -xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
235 -isEmpty(xcode_product_bundle_identifier_setting.value): \
236 - xcode_product_bundle_identifier_setting.value = "com.yourcompany"
237 -xcode_product_bundle_target = $$QMAKE_BUNDLE
238 -isEmpty(xcode_product_bundle_target): \
239 - xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
240 -xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
241 -QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
244 generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
245 generate_xcode_project.target = xcodeproj
246 diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
247 index e3534561a5..3b01424e67 100644
248 --- a/mkspecs/features/mac/default_pre.prf
249 +++ b/mkspecs/features/mac/default_pre.prf
251 CONFIG = asset_catalogs rez $$CONFIG
254 -isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
255 - # Get path of Xcode's Developer directory
256 - QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
257 - isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
258 - error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
260 - # Make sure Xcode path is valid
261 - !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
262 - error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
265 -isEmpty(QMAKE_XCODEBUILD_PATH): \
266 - QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
268 -!isEmpty(QMAKE_XCODEBUILD_PATH) {
269 - # Make sure Xcode is set up properly
270 - !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
271 - error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
273 - isEmpty(QMAKE_XCODE_VERSION) {
274 - # Extract Xcode version using xcodebuild
275 - xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
276 - QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
277 - isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
278 - unset(xcode_version)
282 -isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
283 - QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
284 - exists($$QMAKE_XCODE_PREFERENCES_FILE): \
285 - QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
287 - !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
288 - cache(QMAKE_TARGET_BUNDLE_PREFIX)
291 -QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
293 -# Make the default debug info format for static debug builds
294 -# DWARF instead of DWARF with dSYM. This cuts down build times
295 -# for application debug builds significantly, as Xcode doesn't
296 -# have to pull out all the DWARF info from the Qt static libs
297 -# and put it into a dSYM file. We don't need that dSYM file in
298 -# the first place, since the information is available in the
299 -# object files inside the archives (static libraries).
300 -macx-xcode:qtConfig(static): \
301 - QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
303 -# This variable is used by the xcode_dynamic_library_suffix
304 -# feature, which allows Xcode to choose the Qt libraries to link to
305 -# at build time, depending on the current Xcode SDK and configuration.
306 -QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
308 -xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
309 -xcode_copy_phase_strip_setting.value = NO
310 -QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
311 diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
312 --- a/mkspecs/features/mac/sdk.mk
313 +++ b/mkspecs/features/mac/sdk.mk
316 -ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)
317 - CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>&1
318 - CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND))
319 - ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
320 - # We don't want to complain about out of date SDK unless the target needs to be remade.
321 - # This covers use-cases such as running 'make check' after moving the build to a
322 - # computer without Xcode or with a different Xcode version.
323 - TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0)
324 - ifeq ($(TARGET_UP_TO_DATE),0)
325 - ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),)
326 - $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.)
327 - else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),)
328 - $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.)
329 - else ifneq ($(CURRENT_MAC_SDK_VERSION),)
330 - $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
332 - $(info Unknown error resolving current platform SDK version.)
334 - $(info This requires a fresh build. Please wipe the build directory completely,)
335 - $(info including any .qmake.stash and .qmake.cache files generated by qmake.)
340 diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
341 deleted file mode 100644
342 index 3a9c2778bb..0000000000
343 --- a/mkspecs/features/mac/sdk.prf
347 -isEmpty(QMAKE_MAC_SDK): \
348 - error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
350 -contains(QMAKE_MAC_SDK, .*/.*): \
351 - error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
353 -defineReplace(xcodeSDKInfo) {
355 - equals(info, "Path"): \
356 - infoarg = --show-sdk-path
357 - equals(info, "PlatformPath"): \
358 - infoarg = --show-sdk-platform-path
359 - equals(info, "SDKVersion"): \
360 - infoarg = --show-sdk-version
363 - sdk = $$QMAKE_MAC_SDK
365 - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
366 - QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null")
367 - # --show-sdk-platform-path won't work for Command Line Tools; this is fine
368 - # only used by the XCTest backend to testlib
369 - isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \
370 - error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
371 - cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
374 - return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
377 -QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
378 -QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
379 -QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
381 -isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) {
382 - QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL
384 - for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
385 - QMAKE_INCDIR_OPENGL = $$sysrootified
388 -QMAKESPEC_NAME = $$basename(QMAKESPEC)
390 -# Resolve SDK version of various tools
391 -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)) {
392 - tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
393 - !isEmpty($$tool_variable) {
394 - $$tool = $$eval($$tool_variable)
398 - value = $$eval($$tool)
399 - isEmpty(value): next()
401 - sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
402 - isEmpty(sysrooted): next()
404 - $$tool = $$sysrooted $$member(value, 1, -1)
405 - cache($$tool_variable, set stash, $$tool)