From 6aeb848bd8f7535d2c9ba7504eba53e5fe2b4240 Mon Sep 17 00:00:00 2001 From: Chris Hoffman Date: Thu, 17 Jun 2010 10:57:41 -0500 Subject: [PATCH] Refactor llvm compiler selection so formula can use it Signed-off-by: Adam Vandenberg --- Library/Homebrew/extend/ENV.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index 551b2a0dd6..c8c42aee8f 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -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/)