aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorMike McQuaid2014-04-19 09:11:52 +0100
committerMike McQuaid2014-04-23 08:10:48 +0100
commit55d277c33592f922f506aa2e07c0f81c6d33fd74 (patch)
tree2532a1a7e82160152444b104913e60b057d3bc64 /Library/Homebrew/extend
parent593702c70bed6d26d54684745b4b2f42e2f98899 (diff)
downloadbrew-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/extend')
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb24
-rw-r--r--Library/Homebrew/extend/ENV/std.rb5
-rw-r--r--Library/Homebrew/extend/ENV/super.rb5
3 files changed, 25 insertions, 9 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index 924ac77ca..2964fbd16 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -185,11 +185,29 @@ module SharedEnvExtension
append "LDFLAGS", "-B#{ld64.bin}/"
end
+ def gcc_version_formula(version)
+ gcc_formula = Formulary.factory("gcc")
+ return gcc_formula if gcc_formula.version.to_s.include?(version)
+
+ gcc_name = 'gcc' + version.delete('.')
+ Formulary.factory(gcc_name)
+ end
+
def warn_about_non_apple_gcc(gcc)
+ gcc_name = 'gcc' + gcc.delete('.')
+
begin
- gcc_name = 'gcc' + gcc.delete('.')
- gcc = Formulary.factory(gcc_name)
- if !gcc.opt_prefix.exist?
+ gcc_formula = gcc_version_formula(gcc)
+ if gcc_formula.name == "gcc"
+ return if gcc_formula.opt_prefix.exist?
+ raise <<-EOS.undent
+ The Homebrew GCC was not installed.
+ You must:
+ brew install gcc
+ EOS
+ end
+
+ if !gcc_formula.opt_prefix.exist?
raise <<-EOS.undent
The requested Homebrew GCC, #{gcc_name}, was not installed.
You must:
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index c8beee949..bbf5d3b03 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -73,9 +73,8 @@ module Stdenv
if cc =~ GNU_GCC_REGEXP
warn_about_non_apple_gcc($1)
- gcc_name = 'gcc' + $1.delete('.')
- gcc = Formulary.factory(gcc_name)
- self.append_path('PATH', gcc.opt_prefix/'bin')
+ gcc_formula = gcc_version_formula($1)
+ self.append_path('PATH', gcc_formula.opt_prefix/'bin')
end
# Add lib and include etc. from the current macosxsdk to compiler flags:
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 14253ff88..138741757 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -135,9 +135,8 @@ module Superenv
end
if self['HOMEBREW_CC'] =~ GNU_GCC_REGEXP
- gcc_name = 'gcc' + $1.delete('.')
- gcc = Formulary.factory(gcc_name)
- paths << gcc.opt_prefix/'bin'
+ gcc_formula = gcc_version_formula($1)
+ paths << gcc_formula.opt_prefix/'bin'
end
paths.to_path_s