From 9dcf69d4942a93784a7e2497161fc87ac252ea2f Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Thu, 19 Sep 2013 23:35:53 -0700 Subject: 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. --- Library/Homebrew/extend/ENV/shared.rb | 2 +- Library/Homebrew/extend/ENV/super.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Library') 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 -- cgit v1.2.3