aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2012-08-31 09:51:08 -0400
committerMax Howell2012-08-31 10:22:11 -0400
commitbbe75d3efbfe9cece5ee161882c0002c9697a047 (patch)
tree83db487b22f8301818fc6b01570533f9745ebd44
parentc4d95a093488fdb388ec841c4ae56a2dc677353f (diff)
downloadhomebrew-bbe75d3efbfe9cece5ee161882c0002c9697a047.tar.bz2
MacOS.sdk_path is unlicensed Xcode aware
Now we should get an sdk_path, but tools like xcodebuild, xcode-select and xcrun will still error out. But at least more of Homebrew will work. Also putting the Xcode 3 path finder last. We get bug reports because newer Xcodes are installed in parallel to older Xcodes. We want to find and use the newer Xcode's first. Xcode.prefix is pretty smart about that. Refs #14558.
-rw-r--r--Library/Homebrew/macos.rb21
-rw-r--r--Library/Homebrew/macos/xcode.rb3
2 files changed, 11 insertions, 13 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb
index a50639d20..cf80d1dd6 100644
--- a/Library/Homebrew/macos.rb
+++ b/Library/Homebrew/macos.rb
@@ -65,20 +65,17 @@ module MacOS extend self
end
end
- def sdk_path v=version
+ def sdk_path(v = version)
@sdk_path ||= {}
@sdk_path[v.to_s] ||= begin
- path = if not Xcode.bad_xcode_select_path? and File.executable? "#{Xcode.folder}/usr/bin/make"
- `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.strip
- elsif File.directory? "/Developer/SDKs/MacOS#{v}.sdk"
- # the old default (or wild wild west style)
- "/Developer/SDKs/MacOS#{v}.sdk"
- elsif File.directory? "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
- # Xcode.prefix is pretty smart, so lets look inside to find the sdk
- "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
- end
-
- Pathname.new(path) unless path.nil? or path.empty? or not File.directory? path
+ opts = []
+ # First query Xcode itself
+ opts << `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.chomp unless Xcode.bad_xcode_select_path?
+ # Xcode.prefix is pretty smart, so lets look inside to find the sdk
+ opts << "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
+ # Xcode < 4.3 style
+ opts << "/Developer/SDKs/MacOS#{v}.sdk"
+ opts.map{|a| Pathname.new(a) }.detect(&:directory?)
end
end
diff --git a/Library/Homebrew/macos/xcode.rb b/Library/Homebrew/macos/xcode.rb
index b7a3a26c9..120d9b3d2 100644
--- a/Library/Homebrew/macos/xcode.rb
+++ b/Library/Homebrew/macos/xcode.rb
@@ -7,6 +7,7 @@ module MacOS::Xcode extend self
# Locate the "current Xcode folder" via xcode-select. See:
# man xcode-select
+ # NOTE!! use Xcode.prefix rather than this generally!
def folder
@folder ||= `xcode-select -print-path 2>/dev/null`.strip
end
@@ -31,7 +32,7 @@ module MacOS::Xcode extend self
def prefix
@prefix ||= begin
- path = Pathname.new folder
+ path = Pathname.new(folder)
if path.absolute? and (path/'usr/bin/make').executable?
path
elsif File.executable? '/Developer/usr/bin/make'