Xcode 7 MACOSX_DEPLOYMENT_TARGET and SDK fixes

SDK 10.10 isn't something that exists for Xcode 7, so stop looking for
it and rely on MACOSX_DEPLOYMENT_TARGET instead.

See PR Homebrew/homebrew#50137 Yosemite build failure

Closes Homebrew/homebrew#50355.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
ilovezfs 2016-03-23 04:34:21 -07:00 committed by Xu Cheng
parent 9bbaaca98c
commit 45e138ffc6
2 changed files with 11 additions and 6 deletions

View File

@ -67,7 +67,7 @@ module Superenv
self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths
self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths
if MacOS::Xcode.without_clt? if MacOS::Xcode.without_clt? || (MacOS::Xcode.installed? && MacOS::Xcode.version.to_i >= 7)
self["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version.to_s self["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version.to_s
self["SDKROOT"] = MacOS.sdk_path self["SDKROOT"] = MacOS.sdk_path
end end

View File

@ -90,19 +90,24 @@ module OS
# If the requested SDK is not installed returns either: # If the requested SDK is not installed returns either:
# a) The newest SDK (if any SDKs are available), or # a) The newest SDK (if any SDKs are available), or
# b) nil # b) nil
def sdk(v = version) def sdk(v = nil)
@locator ||= SDKLocator.new @locator ||= SDKLocator.new
begin begin
@locator.sdk_for v sdk = if v.nil?
Xcode.version.to_i >= 7 ? @locator.latest_sdk : @locator.sdk_for(version)
else
@locator.sdk_for v
end
rescue SDKLocator::NoSDKError rescue SDKLocator::NoSDKError
sdk = @locator.latest_sdk sdk = @locator.latest_sdk
# don't return an SDK that's older than the OS version ensure
sdk unless sdk.nil? || sdk.version < version # only return an SDK older than the OS version if it was specifically requested
sdk if v || (!sdk.nil? && sdk.version >= version)
end end
end end
# Returns the path to an SDK or nil, following the rules set by #sdk. # Returns the path to an SDK or nil, following the rules set by #sdk.
def sdk_path(v = version) def sdk_path(v = nil)
s = sdk(v) s = sdk(v)
s.path unless s.nil? s.path unless s.nil?
end end