From 7d8954d74caf59fdc93dae255e3b5fee328c5972 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 28 Aug 2012 19:29:10 -0400 Subject: [PATCH] Warn user if they set CFLAGS, etc. with superenv Since we remove some CFLAGS under their noses, this would otherwise be quite confusing. Notably, this will now trigger in numerous formula. Sucks. --- Library/ENV/4.3/cc | 4 ++++ Library/Homebrew/build.rb | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 8673c75275..2342dc51e9 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -135,6 +135,10 @@ end ####################################################################### sanity abort "The build-tool has reset ENV. --lame-env required." unless ENV['HOMEBREW_BREW_FILE'] +%w{CPPFLAGS LDFLAGS CXXFLAGS CFLAGS}.each do |flag| + puts "#{flag} set but superenv running! Flags may be removed!" if ENV[flag] +end + ######################################################################### main cmd = Cmd.new($0, ARGV) exec "xcrun", cmd.tool, *cmd.args diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index 3c15be352a..77960f8ee9 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -57,7 +57,9 @@ def install f # Python etc. build but then pip can't build stuff. # Scons resets ENV and then can't find superenv's build-tools. stdenvs = %w{fontforge python python3 ruby ruby-enterprise-edition jruby} - ARGV.unshift '--env=std' if stdenvs.include?(f.name) or f.recursive_deps.detect{|d| d.name == 'scons' } + ARGV.unshift '--env=std' if (stdenvs.include?(f.name) or + f.recursive_deps.detect{|d| d.name == 'scons' }) and + not ARGV.include? '--env=super' keg_only_deps = f.recursive_deps.uniq.select{|dep| dep.keg_only? } @@ -82,6 +84,14 @@ def install f if superenv? ENV.deps = keg_only_deps.map(&:to_s) ENV.setup_build_environment + class << ENV + def []=(key, value) + case key when 'CFLAGS', 'CPPFLAGS', 'LDFAGS' + opoo "#{key} set with --env=super! Flags may not take effect!" + end + store(key, value) + end + end end f.recursive_requirements.each { |req| req.modify_build_environment }