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
commit74c092fc35c477999434b066572c42ea526c50e4 (patch)
tree4a9747e0a80d76d1b6d80ebb5769c5ea0c26c451 /Library
parentfb490ae87d8ed279cb8c6421e1ed09e44e597adc (diff)
downloadhomebrew-74c092fc35c477999434b066572c42ea526c50e4.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/)