aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorMax Howell2012-02-18 01:53:42 +0000
committerMax Howell2012-02-18 01:53:55 +0000
commite1461b9d2055f893a0693c695ac89d787ab5178c (patch)
treebd3378dae46edeae8a4356001c056b22d405f244 /Library/Homebrew/extend
parent1e9a4dbfe49b666d6441507d90948e8030594b8a (diff)
downloadbrew-e1461b9d2055f893a0693c695ac89d787ab5178c.tar.bz2
OTT handling for various Xcode-4.3/CLI-Tools edge cases
Also xcrun can only exist at /usr/bin/xcrun. Most of these edges are non-buildable environments, but I didn't know that when writing it, so it may as well stay, since it still does make brew --env more correct.
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 8689d977a..f3ba9c0c5 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -89,7 +89,7 @@ module HomebrewEnvExtension
def xcrun tool
if File.executable? "/usr/bin/#{tool}"
"/usr/bin/#{tool}"
- elsif system "#{MacOS.xcrun} -find #{tool} 2>1 1>/dev/null"
+ elsif system "/usr/bin/xcrun -find #{tool} 2>1 1>/dev/null"
# xcrun was provided first with Xcode 4.3 and allows us to proxy
# tool usage thus avoiding various bugs
"/usr/bin/xcrun #{tool}"
@@ -99,17 +99,26 @@ module HomebrewEnvExtension
if File.executable? fn
fn
else
- nil
+ # This is for the use-case where xcode-select is not set up with
+ # Xcode 4.3. The tools in Xcode 4.3 are split over two locations,
+ # usually xcrun would figure that out for us, but it won't work if
+ # xcode-select is not configured properly.
+ fn = "#{MacOS.xcode_prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin/#{tool}"
+ if File.executable? fn
+ fn
+ else
+ nil
+ end
end
end
end
# if your formula doesn't like CC having spaces use this
def expand_xcrun
- ENV['CC'] =~ %r{#{MacOS.xcrun} (.*)}
- ENV['CC'] = `#{MacOS.xcrun} -find #{$1}`.chomp if $1
- ENV['CXX'] =~ %r{#{MacOS.xcrun} (.*)}
- ENV['CXX'] = `#{MacOS.xcrun} -find #{$1}`.chomp if $1
+ ENV['CC'] =~ %r{/usr/bin/xcrun (.*)}
+ ENV['CC'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1
+ ENV['CXX'] =~ %r{/usr/bin/xcrun (.*)}
+ ENV['CXX'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1
end
def gcc args = {}
@@ -126,7 +135,7 @@ module HomebrewEnvExtension
raise "GCC could not be found" if not File.exist? ENV['CC']
end
- if not ENV['CC'] =~ /^[^\s]*xcrun /
+ if not ENV['CC'] =~ %{^/usr/bin/xcrun }
raise "GCC could not be found" if Pathname.new(ENV['CC']).realpath.to_s =~ /llvm/
end