Refactor llvm compiler selection so formula can use it

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Chris Hoffman 2010-06-17 10:57:41 -05:00 committed by Adam Vandenberg
parent 154d0fa92d
commit 6aeb848bd8

View File

@ -19,13 +19,7 @@ module HomebrewEnvExtension
end
if MACOS_VERSION >= 10.6 and (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm')
# you can install Xcode wherever you like you know.
xcode_path = `/usr/bin/xcode-select -print-path`.chomp
xcode_path = "/Developer" if xcode_path.to_s.empty?
ENV['CC'] = "#{xcode_path}/usr/bin/llvm-gcc"
ENV['CXX'] = "#{xcode_path}/usr/bin/llvm-g++"
cflags = %w{-O4} # link time optimisation baby!
self.llvm
else
# if we don't set these, many formula fail to build
ENV['CC'] = '/usr/bin/cc'
@ -117,6 +111,17 @@ module HomebrewEnvExtension
self.O3
end
def llvm
# you can install Xcode wherever you like you know.
xcode_path = `/usr/bin/xcode-select -print-path`.chomp
xcode_path = "/Developer" if xcode_path.to_s.empty?
ENV['CC'] = "#{xcode_path}/usr/bin/llvm-gcc"
ENV['CXX'] = "#{xcode_path}/usr/bin/llvm-g++"
cflags = %w{-O4} # link time optimisation baby!
self['LD'] = self['CC']
end
def osx_10_4
self['MACOSX_DEPLOYMENT_TARGET']="10.4"
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)