From faca3394938236c488cf79479829f99bada7e3f7 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 10 Sep 2011 11:24:29 +0100 Subject: [PATCH] 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 #6406. --- Library/Formula/jstalk.rb | 4 ---- Library/Formula/mogenerator.rb | 1 - Library/Homebrew/extend/ENV.rb | 9 +++++++++ Library/Homebrew/formula.rb | 10 ++++++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Library/Formula/jstalk.rb b/Library/Formula/jstalk.rb index d5d78f27ee01..d13cd3919517 100644 --- a/Library/Formula/jstalk.rb +++ b/Library/Formula/jstalk.rb @@ -11,10 +11,6 @@ def install exit 1 end - # JSTalk specifies its particular compiler needs in jstalk.xcodeproj - ENV.delete 'CC' - ENV.delete 'CXX' - args = ["-configuration", "Release", "ONLY_ACTIVE_ARCH=YES"] targets = ["JSTalk Framework", "jstalk command line", "JSTalk Editor"] diff --git a/Library/Formula/mogenerator.rb b/Library/Formula/mogenerator.rb index 119b856c8256..272729576466 100644 --- a/Library/Formula/mogenerator.rb +++ b/Library/Formula/mogenerator.rb @@ -7,7 +7,6 @@ class Mogenerator < Formula head "https://github.com/rentzsch/mogenerator.git" def install - ENV.clang system "xcodebuild -target mogenerator -configuration Release SYMROOT=symroot OBJROOT=objroot" bin.install "symroot/Release/mogenerator" diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index abad5e76a221..88cb5e2ace08 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -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 diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index ed017221925d..ca8e489c37a1 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -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 @@ -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