aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/os/mac.rb
diff options
context:
space:
mode:
authorMike McQuaid2014-04-19 09:11:52 +0100
committerMike McQuaid2014-04-23 08:10:48 +0100
commit94be72ad7b45de8978939d371a3beb41e4a02c10 (patch)
tree3012e802791ac13561a0c09f808ec40425fc48d7 /Library/Homebrew/os/mac.rb
parentc3dd9fe05e2addd54599ea2f39b3b732c926e639 (diff)
downloadhomebrew-94be72ad7b45de8978939d371a3beb41e4a02c10.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 #28418.
Diffstat (limited to 'Library/Homebrew/os/mac.rb')
-rw-r--r--Library/Homebrew/os/mac.rb14
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: