aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/ENV/shared.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/extend/ENV/shared.rb')
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb24
1 files changed, 21 insertions, 3 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: