aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2011-09-10 11:24:29 +0100
committerMax Howell2011-09-10 11:30:00 +0100
commitbf3433bde788b84c2005e373bbde4b8bcf75d63c (patch)
treee43632cf26bc8ea7bbb35715b3b0353298ca7a1d
parent0a0187feed4e9f1cb5c393c1d110cfddcc23388f (diff)
downloadbrew-bf3433bde788b84c2005e373bbde4b8bcf75d63c.tar.bz2
With xcodebuild don't set CC, CXX, etc.
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use. Fixes Homebrew/homebrew#6406.
-rw-r--r--Library/Homebrew/extend/ENV.rb9
-rw-r--r--Library/Homebrew/formula.rb10
2 files changed, 19 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index abad5e76a..88cb5e2ac 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -351,4 +351,13 @@ Please take one of the following actions:
Hardware.processor_count
end
end
+
+ def remove_cc_etc
+ keys = %w{CC CXX LD CPP LDFLAGS CFLAGS CPPFLAGS}
+ removed = Hash[*keys.map{ |key| [key, ENV[key]] }.flatten]
+ keys.each do |key|
+ ENV[key] = nil
+ end
+ removed
+ end
end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index ed0172219..ca8e489c3 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -488,6 +488,11 @@ protected
pretty_args.delete "--disable-dependency-tracking" if cmd == "./configure" and not ARGV.verbose?
ohai "#{cmd} #{pretty_args*' '}".strip
+ removed_ENV_variables = case if args.empty? then cmd.split(' ').first else cmd end
+ when "xcodebuild"
+ ENV.remove_cc_etc
+ end
+
if ARGV.verbose?
safe_system cmd, *args
else
@@ -508,6 +513,11 @@ protected
raise
end
end
+
+ removed_ENV_variables.each do |key, value|
+ ENV[key] = value # ENV.kind_of? Hash # => false
+ end if removed_ENV_variables
+
rescue
raise BuildError.new(self, cmd, args, $?)
end