Allow :force for ENV.gcc

This is used with fails_with_llvm so that if GCC cannot be found (and we suspect this is the case with Xcode 4.2) the build will fail.

Quite possibly it should be the default.
This commit is contained in:
Max Howell 2011-09-06 11:21:34 +01:00
parent 65d4b2378a
commit 06795b8953
2 changed files with 6 additions and 2 deletions

View File

@ -127,11 +127,15 @@ module HomebrewEnvExtension
end
alias_method :gcc_4_0, :gcc_4_0_1
def gcc
def gcc args = {}
self['CC'] = "/usr/bin/gcc-4.2"
self['CXX'] = "/usr/bin/g++-4.2"
remove_from_cflags '-O4'
@compiler = :gcc
raise "GCC could not be found" if args[:force] and not File.exist? ENV['CC'] \
or (File.symlink? ENV['CC'] \
and File.readlink(ENV['CC']) =~ 'llvm')
end
alias_method :gcc_4_2, :gcc

View File

@ -327,7 +327,7 @@ class Formula
# bump this integer when Xcode 4.2 is released. TODO do that!
if llvm.build.to_i >= 2335
opoo "Formula will not build with LLVM, using GCC"
ENV.gcc
ENV.gcc :force => true
return
end
opoo "Building with LLVM, but this formula is reported to not work with LLVM:"