make fails_with_llvm work when cc is llvm-gcc

Closes Homebrew/homebrew#4693.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Camillo Lugaresi 2011-03-16 02:46:46 +01:00 committed by Mike McQuaid
parent ec0ae5ee99
commit 22afb1cc43
3 changed files with 15 additions and 1 deletions

View File

@ -14,6 +14,10 @@ def dump_build_env env
Homebrew.dump_build_env env Homebrew.dump_build_env env
end end
def default_cc
MacOS.default_cc
end
def gcc_42_build def gcc_42_build
MacOS.gcc_42_build_version MacOS.gcc_42_build_version
end end

View File

@ -265,7 +265,10 @@ class Formula
end end
def fails_with_llvm msg="", data=nil def fails_with_llvm msg="", data=nil
return unless (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm') unless (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm')
ENV.gcc_4_2 if default_cc =~ /llvm/
return
end
build = data.delete :build rescue nil build = data.delete :build rescue nil
msg = "(No specific reason was given)" if msg.empty? msg = "(No specific reason was given)" if msg.empty?

View File

@ -1,3 +1,5 @@
require 'pathname'
class Tty class Tty
class <<self class <<self
def blue; bold 34; end def blue; bold 34; end
@ -208,6 +210,11 @@ def nostdout
end end
module MacOS extend self module MacOS extend self
def default_cc
Pathname.new("/usr/bin/cc").realpath.basename.to_s
end
def gcc_42_build_version def gcc_42_build_version
`/usr/bin/gcc-4.2 -v 2>&1` =~ /build (\d{4,})/ `/usr/bin/gcc-4.2 -v 2>&1` =~ /build (\d{4,})/
if $1 if $1