diff options
| author | Misty De Meo | 2013-10-19 23:09:09 -0700 |
|---|---|---|
| committer | Misty De Meo | 2013-10-19 23:13:50 -0700 |
| commit | e6ff2aaefc41a68e0809e3d80b3fb5986a714620 (patch) | |
| tree | 9ffe407d7121119d6426513ef3aa816ec15ee205 /Library/Homebrew | |
| parent | f3fc0e23e8cfbc70d5f5f1722a050df8026af1a0 (diff) | |
| download | homebrew-e6ff2aaefc41a68e0809e3d80b3fb5986a714620.tar.bz2 | |
MacOS.gcc_build_version: find GCC when unlinked
MacOS.gcc_42_build_version was returning nil if apple-gcc42 was
installed but unlinked, which was disjoint with how other parts of
Homebrew tried to see if it was present.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/os/mac.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 832f3f52b..87393d653 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -130,8 +130,15 @@ module OS def gcc_42_build_version @gcc_42_build_version ||= - if (path = locate("gcc-4.2")) && path.realpath.basename.to_s !~ /^llvm/ - %x{#{path} --version}[/build (\d{4,})/, 1].to_i + begin + gcc = MacOS.locate('gcc-4.2') || Formula.factory('apple-gcc42').opt_prefix/'bin/gcc-4.2' + raise unless gcc.exist? + rescue + gcc = nil + end + + if gcc && gcc.realpath.basename.to_s !~ /^llvm/ + %x{#{gcc} --version}[/build (\d{4,})/, 1].to_i end end alias_method :gcc_build_version, :gcc_42_build_version |
