Implement MacOS.dev_tools_prefix a different way
Avoid producing a dev_tools_path of "//usr/bin". Fixes Homebrew/homebrew#24751. Closes Homebrew/homebrew#24754.
This commit is contained in:
parent
acd2bd0738
commit
06bf1c0f02
@ -51,24 +51,22 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def dev_tools_prefix
|
def dev_tools_prefix
|
||||||
@dev_tools_prefix ||= if tools_in_prefix? CLT::MAVERICKS_PKG_PATH
|
dev_tools_path.parent.parent
|
||||||
Pathname.new CLT::MAVERICKS_PKG_PATH
|
|
||||||
elsif tools_in_prefix? "/"
|
|
||||||
# probably a safe enough assumption (the unix way)
|
|
||||||
Pathname.new "/"
|
|
||||||
elsif not Xcode.bad_xcode_select_path? and not `/usr/bin/xcrun -find make 2>/dev/null`.empty?
|
|
||||||
# Note that the exit status of system "xcrun foo" isn't always accurate
|
|
||||||
# Wherever "make" is there are the dev tools.
|
|
||||||
Pathname.new(`/usr/bin/xcrun -find make`.chomp.sub('/usr/bin/make', ''))
|
|
||||||
elsif File.exist? "#{Xcode.prefix}/usr/bin/make"
|
|
||||||
# cc stopped existing with Xcode 4.3, there are c89 and c99 options though
|
|
||||||
Pathname.new Xcode.prefix
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def dev_tools_path
|
def dev_tools_path
|
||||||
@dev_tools_path ||= if File.exist? "#{dev_tools_prefix}/usr/bin/make"
|
@dev_tools_path ||= if tools_in_prefix? CLT::MAVERICKS_PKG_PATH
|
||||||
Pathname.new "#{dev_tools_prefix}/usr/bin"
|
Pathname.new "#{CLT::MAVERICKS_PKG_PATH}/usr/bin"
|
||||||
|
elsif tools_in_prefix? "/"
|
||||||
|
# probably a safe enough assumption (the unix way)
|
||||||
|
Pathname.new "/usr/bin"
|
||||||
|
elsif not Xcode.bad_xcode_select_path? and not `/usr/bin/xcrun -find make 2>/dev/null`.empty?
|
||||||
|
# Note that the exit status of system "xcrun foo" isn't always accurate
|
||||||
|
# Wherever "make" is there are the dev tools.
|
||||||
|
Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname
|
||||||
|
elsif File.exist? "#{Xcode.prefix}/usr/bin/make"
|
||||||
|
# cc stopped existing with Xcode 4.3, there are c89 and c99 options though
|
||||||
|
Pathname.new "#{Xcode.prefix}/usr/bin"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user