aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorChris Hoffman2010-06-17 10:57:41 -0500
committerAdam Vandenberg2010-06-17 09:39:55 -0700
commit6aeb848bd8f7535d2c9ba7504eba53e5fe2b4240 (patch)
tree0f2ed8137cbcc9699ac4e9e193db689181f70402 /Library
parent154d0fa92d982bc485acb0922ec646caf87f0445 (diff)
downloadbrew-6aeb848bd8f7535d2c9ba7504eba53e5fe2b4240.tar.bz2
Refactor llvm compiler selection so formula can use it
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 551b2a0dd..c8c42aee8 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/)