aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula.rb
diff options
context:
space:
mode:
authorMisty De Meo2013-06-28 01:38:09 -0500
committerMisty De Meo2013-09-01 13:19:13 -0700
commitef1d9c0cd04c21b5b19cae17e83bbdc6ef28d712 (patch)
treee65e63fa2b446cc0ec80694f2572acba589b70e7 /Library/Homebrew/formula.rb
parent71268b7f16f017a94304488e3b3cbc4c1ca3bfe7 (diff)
downloadbrew-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/formula.rb')
-rw-r--r--Library/Homebrew/formula.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index bbcb1dab2..29e87af06 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -212,7 +212,12 @@ class Formula
def fails_with? cc
cc = Compiler.new(cc) unless cc.is_a? Compiler
(self.class.cc_failures || []).any? do |failure|
- failure.compiler == cc.name && failure.build >= cc.build
+ if cc.version
+ # non-Apple GCCs don't have builds, just version numbers
+ failure.compiler == cc.name && failure.version >= cc.version
+ else
+ failure.compiler == cc.name && failure.build >= cc.build
+ end
end
end