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
commit497ccdc41c11411184f36a2e0d0626fb9df9b99b (patch)
tree757f51e29f4a13a60a6c4c0a6fc31e6b2405e50f /Library
parentbda0a3102ffe01647ae47d21787494902ce233ca (diff)
downloadbrew-497ccdc41c11411184f36a2e0d0626fb9df9b99b.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 Homebrew/homebrew#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