diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 7c68ae5e3d06dd2a96e7f0680e7d30db81290f18..c258e9f34f8fe58045dd0c7decfcfcb08046abdc 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -101,8 +101,8 @@ module SharedEnvExtension :llvm elsif ARGV.include? '--use-clang' :clang - elsif self['HOMEBREW_CC'] - cc = COMPILER_ALIASES.fetch(self['HOMEBREW_CC'], self['HOMEBREW_CC']) + elsif homebrew_cc + cc = COMPILER_ALIASES.fetch(homebrew_cc, homebrew_cc) COMPILER_SYMBOL_MAP.fetch(cc) { MacOS.default_compiler } else MacOS.default_compiler @@ -245,4 +245,8 @@ module SharedEnvExtension def cxx= val self["CXX"] = self["OBJCXX"] = val.to_s end + + def homebrew_cc + self["HOMEBREW_CC"] + end end diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 5b3b8c5c5884cefd3f7b35456cf62fe798fc9991..cb05ec9647ada6836b1ded80eeb2fb78913d45ab 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -87,7 +87,7 @@ module Superenv # s - apply fix for sed's Unicode support # a - apply fix for apr-1-config path - warn_about_non_apple_gcc($1) if self["HOMEBREW_CC"] =~ GNU_GCC_REGEXP + warn_about_non_apple_gcc($1) if homebrew_cc =~ GNU_GCC_REGEXP end private @@ -125,7 +125,7 @@ module Superenv # Homebrew's apple-gcc42 will be outside the PATH in superenv, # so xcrun may not be able to find it - case self["HOMEBREW_CC"] + case homebrew_cc when "gcc-4.2" begin apple_gcc42 = Formulary.factory('apple-gcc42') @@ -272,14 +272,14 @@ module Superenv end def cxx11 - case self["HOMEBREW_CC"] + case homebrew_cc when "clang" append 'HOMEBREW_CCCFG', "x", '' append 'HOMEBREW_CCCFG', "g", '' when /gcc-4\.(8|9)/ append 'HOMEBREW_CCCFG', "x", '' else - raise "The selected compiler doesn't support C++11: #{self['HOMEBREW_CC']}" + raise "The selected compiler doesn't support C++11: #{homebrew_cc}" end end