aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMisty De Meo2013-09-19 23:35:53 -0700
committerMisty De Meo2013-09-19 23:36:15 -0700
commit9dcf69d4942a93784a7e2497161fc87ac252ea2f (patch)
treef403c9b99ddc4af56f9e5530501da6240363cd8e /Library
parentcf8493d63dbed1b84690da6b3bfa211ba05efa54 (diff)
downloadhomebrew-9dcf69d4942a93784a7e2497161fc87ac252ea2f.tar.bz2
ENV: Ensure @compiler is set
If @compiler isn't set/checked by ENV.compiler and the ENV.clang/etc. methods, ENV.compiler may return unexpected results after fails_with picks a fallback compiler. See #22674.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV/shared.rb2
-rw-r--r--Library/Homebrew/extend/ENV/super.rb5
2 files changed, 5 insertions, 2 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index de5c14384..33f2ee5a8 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -82,7 +82,7 @@ module SharedEnvExtension
def fcflags; self['FCFLAGS']; end
def compiler
- if (cc = ARGV.cc)
+ @compiler ||= if (cc = ARGV.cc)
COMPILER_SYMBOL_MAP.fetch(cc) do |other|
if other =~ GNU_GCC_REGEXP then other
else
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index d02013bd4..5a7b4bd89 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -263,16 +263,19 @@ module Superenv
alias_method :j1, :deparallelize
def gcc
self['HOMEBREW_CC'] = "gcc-4.2"
+ @compiler = :gcc
end
def llvm
self['HOMEBREW_CC'] = "llvm-gcc"
+ @compiler = :llvm
end
def clang
self['HOMEBREW_CC'] = "clang"
+ @compiler = :clang
end
GNU_GCC_VERSIONS.each do |n|
define_method(:"gcc-4.#{n}") do
- self['HOMEBREW_CC'] = "gcc-4.#{n}"
+ @compiler = self['HOMEBREW_CC'] = "gcc-4.#{n}"
end
end
def make_jobs