aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2011-09-06 11:21:34 +0100
committerMax Howell2011-09-06 11:22:22 +0100
commit06795b8953044966dd8eed5557039903d2f835c7 (patch)
tree2c1b1b0bc85181dde27669f48912db3d212ca74c /Library
parent65d4b2378abf9f248234ce9ada72961de6ab9d47 (diff)
downloadbrew-06795b8953044966dd8eed5557039903d2f835c7.tar.bz2
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.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV.rb6
-rw-r--r--Library/Homebrew/formula.rb2
2 files changed, 6 insertions, 2 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 155daa19b..517bcf19c 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -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
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 6e3d78e63..5f43c97da 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -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:"