diff options
| author | Mike McQuaid | 2014-04-19 09:11:52 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-04-23 08:10:48 +0100 |
| commit | 55d277c33592f922f506aa2e07c0f81c6d33fd74 (patch) | |
| tree | 2532a1a7e82160152444b104913e60b057d3bc64 /Library/Homebrew/os | |
| parent | 593702c70bed6d26d54684745b4b2f42e2f98899 (diff) | |
| download | brew-55d277c33592f922f506aa2e07c0f81c6d33fd74.tar.bz2 | |
Support core GCC formula as a GCC compiler.
It is activated by the same mechanism as the Homebrew/versions compilers
which now check if the GCC formula uses the same, correct version.
References Homebrew/homebrew#28418.
Diffstat (limited to 'Library/Homebrew/os')
| -rw-r--r-- | Library/Homebrew/os/mac.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index a64329484..2d06fe7e0 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -131,8 +131,9 @@ module OS def gcc_42_build_version @gcc_42_build_version ||= begin - gcc = MacOS.locate('gcc-4.2') || Formula.factory('apple-gcc42').opt_prefix/'bin/gcc-4.2' - raise unless gcc.exist? + gcc = MacOS.locate('gcc-4.2') + gcc ||= Formula.factory('apple-gcc42').opt_prefix/'bin/gcc-4.2' rescue nil + raise if gcc.nil? || !gcc.exist? rescue gcc = nil end @@ -167,13 +168,16 @@ module OS end def non_apple_gcc_version(cc) - return unless path = locate(cc) + path = Formula.factory("gcc").opt_prefix/"bin/#{cc}" + path = nil unless path.exist? + + 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) + `#{path} --version` =~ /gcc(-\d\.\d \(GCC\))? (\d\.\d\.\d)/ + instance_variable_set(ivar, $2) end # See these issues for some history: |
