aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBrett Cannon2010-06-18 14:32:25 -0700
committerAdam Vandenberg2010-06-18 16:32:19 -0700
commit3a97b2cf678557d4f07691d8d4c89727e7962ff1 (patch)
tree2e7fbb1dfd3e490a654a9346dc4fadbf2ed374cc /Library
parent43d1f6790b777b014c6cbcb11674ad1fdee63abc (diff)
downloadbrew-3a97b2cf678557d4f07691d8d4c89727e7962ff1.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
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV.rb20
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