aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/ENV/std.rb
diff options
context:
space:
mode:
authorMisty De Meo2013-06-28 01:38:09 -0500
committerMisty De Meo2013-09-01 13:19:13 -0700
commit733076ec22a21bcc481afc38fc79fd0ea40700a0 (patch)
tree11562b9fbc0afdf15358c499b002878b12a70cc3 /Library/Homebrew/extend/ENV/std.rb
parent512801cd260c317a9af54a1da8bfe314ba61d6f4 (diff)
downloadhomebrew-733076ec22a21bcc481afc38fc79fd0ea40700a0.tar.bz2
Implement fails_with for non-Apple compilers
This adds support for non-Apple GCC compilers in the fails_with code. A fails_with block for a non-Apple compiler looks like: fails_with :gcc => '4.8.1' do cause 'Foo' end Non-Apple compilers don't have build numbers, so compiler failures are based on version strings instead. Internally non-Apple compilers can be distinguished because they are passed around as strings instead of symbols. In addition, this alters the priority list for compilers, with the following changes: * Apple GCC 4.2 and LLVM-GCC swap positions, with GCC now taking priority. (Maybe LLVM-GCC should just go away.) * Non-Apple GCC compilers are ranked below GCC 4.2 but above LLVM-GCC and Apple GCC 4.0.
Diffstat (limited to 'Library/Homebrew/extend/ENV/std.rb')
-rw-r--r--Library/Homebrew/extend/ENV/std.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index 67ab85952..e931b33ba 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -167,6 +167,16 @@ module Stdenv
end
alias_method :gcc_4_2, :gcc
+ GNU_GCC_VERSIONS.each do |n|
+ define_method(:"gcc-4.#{n}") do
+ gcc = "gcc-4.#{n}"
+ self.cc = self['OBJC'] = gcc
+ self.cxx = self['OBJCXX'] = gcc.gsub('c', '+')
+ set_cpu_cflags
+ @compiler = gcc
+ end
+ end
+
def llvm
self.cc = MacOS.locate("llvm-gcc")
self.cxx = MacOS.locate("llvm-g++")