Remember compiler setting when it is changed via eg. ENV.gcc
Thus it will be correct after the setting is changed.
This commit is contained in:
parent
6d075a3b17
commit
65d4b2378a
@ -28,8 +28,11 @@ module HomebrewEnvExtension
|
|||||||
end
|
end
|
||||||
|
|
||||||
# we must have a working compiler!
|
# we must have a working compiler!
|
||||||
ENV['CC'] = '/usr/bin/cc' unless File.exist? ENV['CC']
|
unless File.exist? ENV['CC'] and File.exist? ENV['CXX']
|
||||||
ENV['CXX'] = '/usr/bin/c++' unless File.exist? ENV['CXX']
|
ENV['CC'] = '/usr/bin/cc'
|
||||||
|
ENV['CXX'] = '/usr/bin/c++'
|
||||||
|
@compiler = MacOS.default_compiler
|
||||||
|
end
|
||||||
|
|
||||||
# In rare cases this may break your builds, as the tool for some reason wants
|
# In rare cases this may break your builds, as the tool for some reason wants
|
||||||
# to use a specific linker. However doing this in general causes formula to
|
# to use a specific linker. However doing this in general causes formula to
|
||||||
@ -120,6 +123,7 @@ module HomebrewEnvExtension
|
|||||||
remove_from_cflags '-O4'
|
remove_from_cflags '-O4'
|
||||||
remove_from_cflags '-march=core2'
|
remove_from_cflags '-march=core2'
|
||||||
remove_from_cflags %r{-msse4(\.\d)?}
|
remove_from_cflags %r{-msse4(\.\d)?}
|
||||||
|
@compiler = :gcc
|
||||||
end
|
end
|
||||||
alias_method :gcc_4_0, :gcc_4_0_1
|
alias_method :gcc_4_0, :gcc_4_0_1
|
||||||
|
|
||||||
@ -127,17 +131,20 @@ module HomebrewEnvExtension
|
|||||||
self['CC'] = "/usr/bin/gcc-4.2"
|
self['CC'] = "/usr/bin/gcc-4.2"
|
||||||
self['CXX'] = "/usr/bin/g++-4.2"
|
self['CXX'] = "/usr/bin/g++-4.2"
|
||||||
remove_from_cflags '-O4'
|
remove_from_cflags '-O4'
|
||||||
|
@compiler = :gcc
|
||||||
end
|
end
|
||||||
alias_method :gcc_4_2, :gcc
|
alias_method :gcc_4_2, :gcc
|
||||||
|
|
||||||
def llvm
|
def llvm
|
||||||
self['CC'] = "/usr/bin/llvm-gcc"
|
self['CC'] = "/usr/bin/llvm-gcc"
|
||||||
self['CXX'] = "/usr/bin/llvm-g++"
|
self['CXX'] = "/usr/bin/llvm-g++"
|
||||||
|
@compiler = :llvm
|
||||||
end
|
end
|
||||||
|
|
||||||
def clang
|
def clang
|
||||||
self['CC'] = "/usr/bin/clang"
|
self['CC'] = "/usr/bin/clang"
|
||||||
self['CXX'] = "/usr/bin/clang++"
|
self['CXX'] = "/usr/bin/clang++"
|
||||||
|
@compiler = :clang
|
||||||
end
|
end
|
||||||
|
|
||||||
def fortran
|
def fortran
|
||||||
@ -295,6 +302,7 @@ Please take one of the following actions:
|
|||||||
remove 'CXXFLAGS', f
|
remove 'CXXFLAGS', f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# actually c-compiler, so cc would be a better name
|
||||||
def compiler
|
def compiler
|
||||||
# TODO seems that ENV.clang in a Formula.install should warn when called
|
# TODO seems that ENV.clang in a Formula.install should warn when called
|
||||||
# if the user has set something that is tested here
|
# if the user has set something that is tested here
|
||||||
@ -302,7 +310,7 @@ Please take one of the following actions:
|
|||||||
# 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
|
||||||
if ARGV.include? '--use-gcc'
|
@compiler ||= if ARGV.include? '--use-gcc'
|
||||||
:gcc
|
:gcc
|
||||||
elsif ARGV.include? '--use-llvm'
|
elsif ARGV.include? '--use-llvm'
|
||||||
:llvm
|
:llvm
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user