Merge pull request #3453 from MikeMcQuaid/check_if_xcode_needs_clt_installed

diagnostic: check if Xcode needs CLT installed.
This commit is contained in:
Mike McQuaid 2017-11-18 08:50:15 +00:00 committed by GitHub
commit 46bc5ecb3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 9 deletions

View File

@ -19,6 +19,7 @@ module Homebrew
%w[ %w[
check_xcode_minimum_version check_xcode_minimum_version
check_clt_minimum_version check_clt_minimum_version
check_if_xcode_needs_clt_installed
].freeze ].freeze
end end
@ -124,6 +125,15 @@ module Homebrew
EOS EOS
end end
def check_if_xcode_needs_clt_installed
return unless MacOS::Xcode.needs_clt_installed?
<<~EOS
Xcode alone is not sufficient on #{MacOS.version.pretty_name}.
#{DevelopmentTools.installation_instructions}
EOS
end
def check_for_osx_gcc_installer def check_for_osx_gcc_installer
return unless MacOS.version < "10.7" || ((MacOS::Xcode.version || "0") > "4.1") return unless MacOS.version < "10.7" || ((MacOS::Xcode.version || "0") > "4.1")
return unless DevelopmentTools.clang_version == "2.1" return unless DevelopmentTools.clang_version == "2.1"

View File

@ -9,7 +9,7 @@ module Superenv
end end
def effective_sysroot def effective_sysroot
MacOS::Xcode.without_clt? ? MacOS.sdk_path.to_s : nil MacOS.sdk_path.to_s if MacOS::Xcode.without_clt?
end end
def homebrew_extra_paths def homebrew_extra_paths
@ -91,10 +91,8 @@ module Superenv
generic_setup_build_environment(formula) generic_setup_build_environment(formula)
self["HOMEBREW_SDKROOT"] = effective_sysroot self["HOMEBREW_SDKROOT"] = effective_sysroot
if MacOS::Xcode.without_clt? || 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 if MacOS::Xcode.without_clt?
self["SDKROOT"] = MacOS.sdk_path
end
# Filter out symbols known not to be defined since GNU Autotools can't # Filter out symbols known not to be defined since GNU Autotools can't
# reliably figure this out with Xcode 8 and above. # reliably figure this out with Xcode 8 and above.

View File

@ -31,16 +31,25 @@ module OS
@version = nil @version = nil
end end
def prerelease? def latest_sdk_version
# TODO: bump version when new OS is released # TODO: bump version when new Xcode macOS SDK is released
version >= "10.14" Version.new "10.13"
end
def latest_stable_version
# TODO: bump version when new macOS is released
Version.new "10.13"
end end
def outdated_release? def outdated_release?
# TODO: bump version when new OS is released # TODO: bump version when new macOS is released
version < "10.11" version < "10.11"
end end
def prerelease?
version > latest_stable_version
end
def cat def cat
version.to_sym version.to_sym
end end

View File

@ -40,6 +40,15 @@ module OS
version < minimum_version version < minimum_version
end end
def latest_sdk_version?
OS::Mac.version == OS::Mac.latest_sdk_version
end
def needs_clt_installed?
return false if latest_sdk_version?
without_clt?
end
def outdated? def outdated?
return false unless installed? return false unless installed?
version < latest_version version < latest_version