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/macos.rb | |
| 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/macos.rb')
| -rw-r--r-- | Library/Homebrew/macos.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 8e379ad2a..de109ade3 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -151,6 +151,16 @@ module MacOS extend self end end + def non_apple_gcc_version(cc) + return unless path = locate(cc) + + ivar = "@#{cc.gsub(/(-|\.)/, '')}_version" + return instance_variable_get(ivar) if instance_variable_defined?(ivar) + + `#{path} --version` =~ /gcc-\d.\d \(GCC\) (\d\.\d\.\d)/ + instance_variable_set(ivar, $1) + end + # See these issues for some history: # http://github.com/mxcl/homebrew/issues/#issue/13 # http://github.com/mxcl/homebrew/issues/#issue/41 |
