Find xcrun if user doesn't ever install Xcode 4.3 helper tools
This commit is contained in:
parent
30cbb25147
commit
607c13c32b
@ -18,8 +18,8 @@ module Homebrew extend self
|
||||
value = env[k]
|
||||
if value
|
||||
results = value
|
||||
if value =~ %r{^/usr/bin/xcrun (.*)}
|
||||
path = `/usr/bin/xcrun -find #{$1}`
|
||||
if value =~ /^[^\s]*xcrun (.*)/
|
||||
path = `#{MacOS.xcrun} -find #{$1}`
|
||||
results += " => #{path}"
|
||||
elsif File.exists? value and File.symlink? value
|
||||
results += " => #{Pathname.new(value).realpath}"
|
||||
|
||||
@ -89,7 +89,7 @@ module HomebrewEnvExtension
|
||||
def xcrun tool
|
||||
if File.executable? "/usr/bin/#{tool}"
|
||||
"/usr/bin/#{tool}"
|
||||
elsif system "/usr/bin/xcrun -find #{tool} 2>1 1>/dev/null"
|
||||
elsif system "#{MacOS.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}"
|
||||
@ -106,10 +106,10 @@ module HomebrewEnvExtension
|
||||
|
||||
# if your formula doesn't like CC having spaces use this
|
||||
def expand_xcrun
|
||||
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
|
||||
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
|
||||
end
|
||||
|
||||
def gcc args = {}
|
||||
@ -126,7 +126,7 @@ module HomebrewEnvExtension
|
||||
raise "GCC could not be found" if not File.exist? ENV['CC']
|
||||
end
|
||||
|
||||
if not ENV['CC'] =~ %r{^/usr/bin/xcrun}
|
||||
if not ENV['CC'] =~ /^[^\s]*xcrun /
|
||||
raise "GCC could not be found" if Pathname.new(ENV['CC']).realpath.to_s =~ /llvm/
|
||||
end
|
||||
|
||||
|
||||
@ -266,8 +266,16 @@ 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
|
||||
end
|
||||
end
|
||||
|
||||
def default_cc
|
||||
cc = `/usr/bin/xcrun -find cc 2> /dev/null`.chomp
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user