Merge pull request #7134 from Bo98/sdk

Fix SDK issues on Mojave and High Sierra
This commit is contained in:
Mike McQuaid 2020-03-09 19:52:11 +00:00 committed by GitHub
commit 82f5b510c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 18 deletions

View File

@ -81,23 +81,14 @@ module OS
# are available) is returned. # are available) is returned.
# 3. If no SDKs are available, nil is returned. # 3. If no SDKs are available, nil is returned.
# #
# If no specific SDK is requested: # If no specific SDK is requested, the SDK matching the OS version is returned,
# # if available. Otherwise, the latest SDK is returned.
# 1. For Xcode >= 7, the latest SDK is returned even if the latest SDK is
# named after a newer OS version than the running OS. The
# `MACOSX_DEPLOYMENT_TARGET` must be set to the OS for which you're
# actually building (usually the running OS version).
# - https://github.com/Homebrew/legacy-homebrew/pull/50355
# - https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/Introduction.html#//apple_ref/doc/uid/TP40004626
# Section "About SDKs and Simulator"
# 2. For Xcode < 7, proceed as if the SDK for the running OS version had
# specifically been requested according to the rules above.
def sdk(v = nil) def sdk(v = nil)
@locator ||= if Xcode.installed? @locator ||= if CLT.installed? && CLT.provides_sdk?
XcodeSDKLocator.new
else
CLTSDKLocator.new CLTSDKLocator.new
else
XcodeSDKLocator.new
end end
@locator.sdk_if_applicable(v) @locator.sdk_if_applicable(v)
@ -110,7 +101,7 @@ module OS
end end
def sdk_path_if_needed(v = nil) def sdk_path_if_needed(v = nil)
# Prefer Xcode SDK when both Xcode and the CLT are installed. # Prefer CLT SDK when both Xcode and the CLT are installed.
# Expected results: # Expected results:
# 1. On Xcode-only systems, return the Xcode SDK. # 1. On Xcode-only systems, return the Xcode SDK.
# 2. On Xcode-and-CLT systems where headers are provided by the system, return nil. # 2. On Xcode-and-CLT systems where headers are provided by the system, return nil.
@ -120,7 +111,7 @@ module OS
# If there's no CLT SDK, return early # If there's no CLT SDK, return early
return if MacOS::CLT.installed? && !MacOS::CLT.provides_sdk? return if MacOS::CLT.installed? && !MacOS::CLT.provides_sdk?
# If the CLT is installed and provides headers, return early # If the CLT is installed and headers are provided by the system, return early
return if MacOS::CLT.installed? && !MacOS::CLT.separate_header_package? return if MacOS::CLT.installed? && !MacOS::CLT.separate_header_package?
sdk_path(v) sdk_path(v)

View File

@ -33,7 +33,7 @@ module OS
def sdk_if_applicable(v = nil) def sdk_if_applicable(v = nil)
sdk = begin sdk = begin
if v.nil? if v.nil?
(source_version.to_i >= 7) ? latest_sdk : sdk_for(OS::Mac.version) sdk_for OS::Mac.version
else else
sdk_for v sdk_for v
end end

View File

@ -200,7 +200,7 @@ module OS
end end
def separate_header_package? def separate_header_package?
version >= "10" version >= "10" && MacOS.version >= "10.14"
end end
def provides_sdk? def provides_sdk?