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