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.
This commit is contained in:
Max Howell 2012-08-28 19:29:10 -04:00
parent 24bcc694e5
commit 7d8954d74c
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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 }