aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-08-28 19:29:10 -0400
committerMax Howell2012-08-29 12:41:37 -0400
commit7d8954d74caf59fdc93dae255e3b5fee328c5972 (patch)
treef6e9a6ed7953b1afb688ce89464540c647bfa759 /Library
parent24bcc694e58024f47315474610ff8514fc65d074 (diff)
downloadbrew-7d8954d74caf59fdc93dae255e3b5fee328c5972.tar.bz2
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.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/cc4
-rwxr-xr-xLibrary/Homebrew/build.rb12
2 files changed, 15 insertions, 1 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 8673c7527..2342dc51e 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 3c15be352..77960f8ee 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 }