diff options
| author | Jack Nagel | 2013-08-19 12:32:58 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-08-19 12:32:58 -0500 |
| commit | 9699c0764efddbc7f9f398ed0fd1726db28523b3 (patch) | |
| tree | 2625ad02e22087f298d28e42e62f4a9ca6bc050c /Library/Homebrew | |
| parent | ce31c16a14ef00afa0fa85044df756afc77e7b92 (diff) | |
| download | brew-9699c0764efddbc7f9f398ed0fd1726db28523b3.tar.bz2 | |
Re-enable superenv ENV[] hack
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/superenv.rb | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/Library/Homebrew/superenv.rb b/Library/Homebrew/superenv.rb index c8c21e172..58a801ca5 100644 --- a/Library/Homebrew/superenv.rb +++ b/Library/Homebrew/superenv.rb @@ -17,6 +17,30 @@ module Superenv def self.extended(base) base.keg_only_deps = [] base.deps = [] + + # Many formula assume that CFLAGS etc. will not be nil. This should be + # a safe hack to prevent that exception cropping up. Main consequence of + # this is that self['CFLAGS'] is never nil even when it is which can break + # if checks, but we don't do such a check in our code. Redefinition must be + # done on the singleton class, because in MRI all ENV methods are defined + # on its singleton class, precluding the use of extend. + class << base + def [] key + if has_key? key + fetch(key) + elsif %w{CPPFLAGS CFLAGS LDFLAGS}.include? key + class << (a = "") + attr_accessor :key + def + value + ENV[key] = value + end + alias_method '<<', '+' + end + a.key = key + a + end + end + end end def self.bin @@ -279,26 +303,6 @@ module Superenv self['MAKEFLAGS'] =~ /-\w*j(\d)+/ [$1.to_i, 1].max end - - # Many formula assume that CFLAGS etc. will not be nil. - # This should be a safe hack to prevent that exception cropping up. - # Main consqeuence of this is that self['CFLAGS'] is never nil even when it - # is which can break if checks, but we don't do such a check in our code. - def [] key - if has_key? key - fetch(key) - elsif %w{CPPFLAGS CFLAGS LDFLAGS}.include? key - class << (a = "") - attr_accessor :key - def + value - ENV[key] = value - end - alias_method '<<', '+' - end - a.key = key - a - end - end end |
