aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorStephen Allred2010-10-01 20:56:55 +0100
committerAdam Vandenberg2011-03-12 11:55:06 -0800
commit618617da7354befd8d6930bd7c2cda9a47988d76 (patch)
tree188dfc87090712ece0ec843cd162c34d61e0e4e8 /Library/Homebrew
parentf4ffb754c37d3a83906d31a141245d367688996f (diff)
downloadbrew-618617da7354befd8d6930bd7c2cda9a47988d76.tar.bz2
Added --use-gcc flag.
This allows you to use llvm as your default compiler and keep the cc symlink pointed at llvm, while allowing you to build forumla that requires the gcc. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/--env.rb3
-rw-r--r--Library/Homebrew/cmd/doctor.rb3
-rw-r--r--Library/Homebrew/extend/ENV.rb4
3 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb
index 07623171d..2f6e421a0 100644
--- a/Library/Homebrew/cmd/--env.rb
+++ b/Library/Homebrew/cmd/--env.rb
@@ -10,6 +10,7 @@ module Homebrew extend self
def dump_build_env env
puts %["--use-llvm" was specified] if ARGV.include? '--use-llvm'
+ puts "\"--use-gcc\" was specified" if ARGV.include? '--use-gcc'
%w[ CC CXX LD ].each do |k|
value = env[k]
@@ -24,7 +25,7 @@ module Homebrew extend self
end
%w[ CFLAGS CXXFLAGS CPPFLAGS LDFLAGS MACOSX_DEPLOYMENT_TARGET MAKEFLAGS PKG_CONFIG_PATH
- HOMEBREW_DEBUG HOMEBREW_VERBOSE HOMEBREW_USE_LLVM HOMEBREW_SVN ].each do |k|
+ HOMEBREW_DEBUG HOMEBREW_VERBOSE HOMEBREW_USE_GCC HOMEBREW_USE_LLVM HOMEBREW_SVN ].each do |k|
value = env[k]
puts "#{k}: #{value}" if value
end
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 7ea616d76..9cbc9b832 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -147,6 +147,9 @@ def check_cc_symlink
To force Homebrew to use LLVM, you can set the "HOMEBREW_LLVM" environmental
variable, or pass "--use-llvm" to "brew install".
+ To force Homebrew to use gcc, you can set the "HOMEBREW_GCC" environmental
+ variable, or pass "--use-gcc" to "brew install".
+
EOS
end
end
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index bb2bbd544..fc4dc96ae 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -24,6 +24,10 @@ module HomebrewEnvExtension
self['CC'] = "#{xcode_path}/usr/bin/llvm-gcc"
self['CXX'] = "#{xcode_path}/usr/bin/llvm-g++"
cflags = ['-O4'] # link time optimisation baby!
+ elsif MACOS_VERSION >= 10.6 and (self['HOMEBREW_USE_GCC'] or ARGV.include? '--use-gcc')
+ self['CC'] = '/usr/bin/gcc'
+ self['CXX'] = '/usr/bin/g++'
+ cflags = ['-O3']
else
# If these aren't set, many formulae fail to build
self['CC'] = '/usr/bin/cc'