Detect Command Line Tools on Mavericks.
Closes Homebrew/homebrew#20774.
This commit is contained in:
parent
0d35455820
commit
59f3d0d6f6
@ -40,7 +40,13 @@ module MacOS extend self
|
||||
end
|
||||
|
||||
def dev_tools_path
|
||||
@dev_tools_path ||= if File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make"
|
||||
@dev_tools_path ||= \
|
||||
if File.exist? MacOS::CLT::STANDALONE_PKG_PATH and
|
||||
File.exist? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin/cc" and
|
||||
File.exist? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin/make"
|
||||
# In 10.9 the CLT moved from /usr into /Library/Developer/CommandLineTools.
|
||||
Pathname.new "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin"
|
||||
elsif File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make"
|
||||
# probably a safe enough assumption (the unix way)
|
||||
Pathname.new "/usr/bin"
|
||||
# Note that the exit status of system "xcrun foo" isn't always accurate
|
||||
|
||||
@ -154,16 +154,16 @@ end
|
||||
module MacOS::CLT extend self
|
||||
STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo"
|
||||
FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI"
|
||||
STANDALONE_PKG_PATH = Pathname.new("/Library/Developer/CommandLineTools")
|
||||
|
||||
# This is true ift he standard UNIX tools are present under /usr. For
|
||||
# Xcode < 4.3, this is the standard location. Otherwise, it means that
|
||||
# the user has installed the "Command Line Tools for Xcode" package.
|
||||
# TODO: handle 10.9 CLT which has headers under:
|
||||
# /Library/Developer/CommandLineTools/usr/include
|
||||
# This is true if the standard UNIX tools are present in the expected location. For
|
||||
# Mavericks and above this is /Library/Developer/CommandLineTools otherwise it is /usr.
|
||||
# For Xcode < 4.3, this is the standard location. Otherwise, it means that the user has
|
||||
# installed the "Command Line Tools for Xcode" package.
|
||||
def installed?
|
||||
return false if MacOS.version > :mountain_lion
|
||||
MacOS.dev_tools_path == Pathname.new("/usr/bin") and
|
||||
File.directory? "/usr/include"
|
||||
(MacOS.dev_tools_path == Pathname.new("#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin") \
|
||||
and File.directory? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/include") or
|
||||
(MacOS.dev_tools_path == Pathname.new("/usr/bin") and File.directory? "/usr/include")
|
||||
end
|
||||
|
||||
def latest_version?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user