From 6d89ebb66b6db58a1495ff2c78deb6491f3b785b Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 18 Jun 2010 14:32:25 -0700 Subject: Fix LLVM compilation under OS X 10.6 where cflags was not being defined. Signed-off-by: Adam Vandenberg * Unshare code between ENV.llvm and ENV.setup_build_environment --- Library/Homebrew/extend/ENV.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index c8c42aee8..a05f02d98 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -19,7 +19,12 @@ module HomebrewEnvExtension end if MACOS_VERSION >= 10.6 and (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm') - self.llvm + 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++" + ENV['LD'] = ENV['CC'] + cflags = ['-O4'] # link time optimisation baby! else # if we don't set these, many formula fail to build ENV['CC'] = '/usr/bin/cc' @@ -78,6 +83,11 @@ module HomebrewEnvExtension remove_from_cflags /-O./ append_to_cflags '-fast' end + def O4 + # LLVM link-time optimization + remove_from_cflags /-O./ + append_to_cflags '-O4' + end def O3 # Sometimes O4 just takes fucking forever remove_from_cflags /-O./ @@ -112,14 +122,12 @@ module HomebrewEnvExtension 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['CC'] = "#{xcode_path}/usr/bin/llvm-gcc" + self['CXX'] = "#{xcode_path}/usr/bin/llvm-g++" self['LD'] = self['CC'] + self.O4 end def osx_10_4 -- cgit v1.2.3