Skip to content

Commit

Permalink
With xcodebuild don't set CC, CXX, etc.
Browse files Browse the repository at this point in the history
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#6406.
  • Loading branch information
mxcl committed Sep 10, 2011
1 parent 140dde2 commit f523721
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Library/Homebrew/extend/ENV.rb
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,13 @@ def make_jobs
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
10 changes: 10 additions & 0 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ def system cmd, *args
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
Expand All @@ -508,6 +513,11 @@ def system cmd, *args
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
Expand Down

0 comments on commit f523721

Please sign in to comment.