diff options
| author | Misty De Meo | 2013-06-28 01:38:09 -0500 |
|---|---|---|
| committer | Misty De Meo | 2013-09-01 13:19:13 -0700 |
| commit | ef1d9c0cd04c21b5b19cae17e83bbdc6ef28d712 (patch) | |
| tree | e65e63fa2b446cc0ec80694f2572acba589b70e7 /Library/Homebrew/extend | |
| parent | 71268b7f16f017a94304488e3b3cbc4c1ca3bfe7 (diff) | |
| download | brew-ef1d9c0cd04c21b5b19cae17e83bbdc6ef28d712.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')
| -rw-r--r-- | Library/Homebrew/extend/ENV/std.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/super.rb | 7 |
2 files changed, 17 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++") diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 2b3957209..9ca88750c 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -266,6 +266,13 @@ module Superenv self.cc = self['HOMEBREW_CC'] = "clang" self.cxx = "clang++" end + GNU_GCC_VERSIONS.each do |n| + define_method(:"gcc-4.#{n}") do + gcc = "gcc-4.#{n}" + self.cc = self['HOMEBREW_CC'] = gcc + self.cxx = gcc.gsub('c', '+') + end + end def make_jobs self['MAKEFLAGS'] =~ /-\w*j(\d)+/ [$1.to_i, 1].max |
