diff options
| author | Brett Cannon | 2010-06-18 14:32:25 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-06-18 16:32:19 -0700 |
| commit | 6d89ebb66b6db58a1495ff2c78deb6491f3b785b (patch) | |
| tree | d9326baebc664e936036231f2fdf838e0c781656 | |
| parent | 79634fe3088bf582eb991f37620063248bd859aa (diff) | |
| download | homebrew-6d89ebb66b6db58a1495ff2c78deb6491f3b785b.tar.bz2 | |
Fix LLVM compilation under OS X 10.6 where cflags was not being defined.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
* Unshare code between ENV.llvm and ENV.setup_build_environment
| -rw-r--r-- | Library/Homebrew/extend/ENV.rb | 20 |
1 files changed, 14 insertions, 6 deletions
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 |
