aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorMax Howell2012-02-18 01:53:42 +0000
committerMax Howell2012-02-18 01:53:55 +0000
commitc98549bde1dd5e56e06bff696d1fe3c10015924d (patch)
tree445f285637242e3142ab2b460df1c6d74437a0dc /Library/Homebrew/utils.rb
parent21d3517e9700445a4f616c30d0ead8a9cd713d0e (diff)
downloadhomebrew-c98549bde1dd5e56e06bff696d1fe3c10015924d.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/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 1fcb23591..a0491a255 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -266,17 +266,18 @@ module MacOS extend self
end
end
- def xcrun
- @xcrun ||= begin
- path = "#{xcode_prefix}/usr/bin/xcrun"
- path = "xcrun" unless File.file? path # just in case
- path
+ def default_cc
+ cc = `/usr/bin/xcrun -find cc 2> /dev/null`.chomp
+ cc = "#{dev_tools_path}/cc" if cc.empty? or not $?.success?
+
+ unless File.executable? cc
+ # If xcode-select isn't setup then xcrun fails and on Xcode 4.3
+ # the cc binary is not at #{dev_tools_path}. This return is almost
+ # worthless however since in this particular setup nothing much builds
+ # but I wrote the code now and maybe we'll fix the other issues later.
+ cc = "#{xcode_prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"
end
- end
- def default_cc
- cc = `#{xcrun} -find cc 2> /dev/null`.chomp
- cc = "#{dev_tools_path}/cc" if cc.empty?
Pathname.new(cc).realpath.basename.to_s rescue nil
end