diff options
| author | Misty De Meo | 2013-08-23 22:25:35 -0700 |
|---|---|---|
| committer | Misty De Meo | 2013-08-30 07:52:12 -0700 |
| commit | 4834418af3171f9ff91529c701abf516079ab7fa (patch) | |
| tree | 641f355be359dd655adf76a2ed206706146cbe9a /Library | |
| parent | 3b0fa87f4e9cdd50ece8579f6faf31b2a2c387c7 (diff) | |
| download | homebrew-4834418af3171f9ff91529c701abf516079ab7fa.tar.bz2 | |
Add --cc= syntax for selecting compilers
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/ARGV.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/shared.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/std.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/super.rb | 4 |
4 files changed, 12 insertions, 2 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index 67ebb8b30..45d2f1168 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -183,6 +183,10 @@ module HomebrewArgvExtension replace(old_args) end + def cc + value 'cc' + end + private def downcased_unique_named diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index f3bc50d58..aeb7ca479 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -2,6 +2,8 @@ module SharedEnvExtension CC_FLAG_VARS = %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS} FC_FLAG_VARS = %w{FCFLAGS FFLAGS} + COMPILERS = ['clang', 'gcc-4.0', 'gcc-4.2', 'llvm-gcc'] + def remove_cc_etc keys = %w{CC CXX OBJC OBJCXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS} removed = Hash[*keys.map{ |key| [key, self[key]] }.flatten] diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index cacd04dca..a01e38efe 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -344,7 +344,9 @@ module Stdenv # test for --flags first so that installs can be overridden on a per # install basis. Then test for ENVs in inverse order to flags, this is # sensible, trust me - @compiler ||= if ARGV.include? '--use-gcc' + @compiler ||= if (cc = ARGV.cc) + COMPILERS.grep(cc).pop ? cc : raise("Invalid value for --cc: #{cc}") + elsif ARGV.include? '--use-gcc' :gcc elsif ARGV.include? '--use-llvm' :llvm diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 5cf186b19..a24a0668d 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -122,7 +122,9 @@ module Superenv private def determine_cc - if ARGV.include? '--use-gcc' + if (cc = ARGV.cc) + COMPILERS.grep(cc).pop ? cc : raise("Invalid value for --cc: #{cc}") + elsif ARGV.include? '--use-gcc' gcc_installed = Formula.factory('apple-gcc42').installed? rescue false # fall back to something else on systems without Apple gcc if MacOS.locate('gcc-4.2') || gcc_installed |
