aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJosé Martínez2011-06-16 16:42:15 +0200
committerAdam Vandenberg2011-06-16 20:45:52 -0700
commit61cec92985f1b60bf7c974bedf4eab84629dc600 (patch)
treee3084091b7a61b4c3050d2e761591f5d91c9ccc5 /Library
parentd1f301e902182efef585345d44521af44789f060 (diff)
downloadhomebrew-61cec92985f1b60bf7c974bedf4eab84629dc600.tar.bz2
Add clang compiler option
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/--env.rb3
-rw-r--r--Library/Homebrew/extend/ENV.rb6
2 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb
index 2f6e421a0..2a11d1e0b 100644
--- a/Library/Homebrew/cmd/--env.rb
+++ b/Library/Homebrew/cmd/--env.rb
@@ -9,8 +9,9 @@ module Homebrew extend self
end
def dump_build_env env
+ puts %["--use-clang" was specified] if ARGV.include? '--use-clang'
puts %["--use-llvm" was specified] if ARGV.include? '--use-llvm'
- puts "\"--use-gcc\" was specified" if ARGV.include? '--use-gcc'
+ puts %["--use-gcc" was specified] if ARGV.include? '--use-gcc'
%w[ CC CXX LD ].each do |k|
value = env[k]
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 08e145cdc..b9a45cc42 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -18,7 +18,11 @@ module HomebrewEnvExtension
self['CMAKE_PREFIX_PATH'] = "#{HOMEBREW_PREFIX}"
end
- if MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm')
+ if MACOS_VERSION >= 10.6 and ARGV.include? '--use-clang'
+ self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/clang"
+ self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/clang++"
+ cflags = ['-O3'] # -O4 makes the linker fail on some formulae
+ elsif MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm')
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-gcc"
self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/llvm-g++"
cflags = ['-O4'] # link time optimisation baby!