Add --cc= syntax for selecting compilers
This commit is contained in:
parent
774cd8b68b
commit
221bb2419f
@ -183,6 +183,10 @@ module HomebrewArgvExtension
|
|||||||
replace(old_args)
|
replace(old_args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cc
|
||||||
|
value 'cc'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def downcased_unique_named
|
def downcased_unique_named
|
||||||
|
|||||||
@ -2,6 +2,8 @@ module SharedEnvExtension
|
|||||||
CC_FLAG_VARS = %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS}
|
CC_FLAG_VARS = %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS}
|
||||||
FC_FLAG_VARS = %w{FCFLAGS FFLAGS}
|
FC_FLAG_VARS = %w{FCFLAGS FFLAGS}
|
||||||
|
|
||||||
|
COMPILERS = ['clang', 'gcc-4.0', 'gcc-4.2', 'llvm-gcc']
|
||||||
|
|
||||||
def remove_cc_etc
|
def remove_cc_etc
|
||||||
keys = %w{CC CXX OBJC OBJCXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS}
|
keys = %w{CC CXX OBJC OBJCXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS}
|
||||||
removed = Hash[*keys.map{ |key| [key, self[key]] }.flatten]
|
removed = Hash[*keys.map{ |key| [key, self[key]] }.flatten]
|
||||||
|
|||||||
@ -344,7 +344,9 @@ module Stdenv
|
|||||||
# test for --flags first so that installs can be overridden on a per
|
# 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
|
# install basis. Then test for ENVs in inverse order to flags, this is
|
||||||
# sensible, trust me
|
# 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
|
:gcc
|
||||||
elsif ARGV.include? '--use-llvm'
|
elsif ARGV.include? '--use-llvm'
|
||||||
:llvm
|
:llvm
|
||||||
|
|||||||
@ -122,7 +122,9 @@ module Superenv
|
|||||||
private
|
private
|
||||||
|
|
||||||
def determine_cc
|
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
|
gcc_installed = Formula.factory('apple-gcc42').installed? rescue false
|
||||||
# fall back to something else on systems without Apple gcc
|
# fall back to something else on systems without Apple gcc
|
||||||
if MacOS.locate('gcc-4.2') || gcc_installed
|
if MacOS.locate('gcc-4.2') || gcc_installed
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user