diff options
| author | Jack Nagel | 2012-03-21 11:58:32 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-03-21 12:22:22 -0500 |
| commit | 01c14f877574ab451e499fa5986f3cfebe957b3d (patch) | |
| tree | 2f2675b216f801d096b770bf5275740e1b09f42d | |
| parent | a161058bcdf07fa3181dc878ca9310e569fb4903 (diff) | |
| download | brew-01c14f877574ab451e499fa5986f3cfebe957b3d.tar.bz2 | |
ENV: normalize usage of "self" and "ENV"
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
| -rw-r--r-- | Library/Homebrew/extend/ENV.rb | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index ce38bf82d..03594de00 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -10,7 +10,7 @@ module HomebrewEnvExtension remove_cc_etc # make any aclocal stuff installed in Homebrew available - ENV['ACLOCAL_PATH'] = "#{HOMEBREW_PREFIX}/share/aclocal" if MacOS.xcode_version < "4.3" + self['ACLOCAL_PATH'] = "#{HOMEBREW_PREFIX}/share/aclocal" if MacOS.xcode_version < "4.3" self['MAKEFLAGS'] = "-j#{self.make_jobs}" @@ -29,12 +29,12 @@ module HomebrewEnvExtension self.send self.compiler # we must have a working compiler! - unless ENV['CC'] + unless self['CC'] @compiler = MacOS.default_compiler self.send @compiler - ENV['CC'] = '/usr/bin/cc' - ENV['CXX'] = '/usr/bin/c++' - ENV['OBJC'] = ENV['CC'] + self['CC'] = '/usr/bin/cc' + self['CXX'] = '/usr/bin/c++' + self['OBJC'] = self['CC'] end # In rare cases this may break your builds, as the tool for some reason wants @@ -125,11 +125,11 @@ module HomebrewEnvExtension # if your formula doesn't like CC having spaces use this def expand_xcrun - ENV['CC'] =~ %r{/usr/bin/xcrun (.*)} - ENV['CC'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1 - ENV['CXX'] =~ %r{/usr/bin/xcrun (.*)} - ENV['CXX'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1 - ENV['OBJC'] = ENV['CC'] + self['CC'] =~ %r{/usr/bin/xcrun (.*)} + self['CC'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1 + self['CXX'] =~ %r{/usr/bin/xcrun (.*)} + self['CXX'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1 + self['OBJC'] = self['CC'] end def gcc @@ -137,19 +137,19 @@ module HomebrewEnvExtension # However they still provide a gcc symlink to llvm # But we don't want LLVM of course. - ENV['CC'] = xcrun "gcc-4.2" - ENV['CXX'] = xcrun "g++-4.2" - ENV['OBJC'] = ENV['CC'] + self['CC'] = xcrun "gcc-4.2" + self['CXX'] = xcrun "g++-4.2" + self['OBJC'] = self['CC'] - unless ENV['CC'] - ENV['CC'] = "#{HOMEBREW_PREFIX}/bin/gcc-4.2" - ENV['CXX'] = "#{HOMEBREW_PREFIX}/bin/g++-4.2" - ENV['OBJC'] = ENV['CC'] - raise "GCC could not be found" if not File.exist? ENV['CC'] + unless self['CC'] + self['CC'] = "#{HOMEBREW_PREFIX}/bin/gcc-4.2" + self['CXX'] = "#{HOMEBREW_PREFIX}/bin/g++-4.2" + self['OBJC'] = self['CC'] + raise "GCC could not be found" if not File.exist? self['CC'] end - if not ENV['CC'] =~ %r{^/usr/bin/xcrun } - raise "GCC could not be found" if Pathname.new(ENV['CC']).realpath.to_s =~ /llvm/ + if not self['CC'] =~ %r{^/usr/bin/xcrun } + raise "GCC could not be found" if Pathname.new(self['CC']).realpath.to_s =~ /llvm/ end replace_in_cflags '-O4', '-O3' @@ -434,9 +434,9 @@ Please take one of the following actions: def remove_cc_etc keys = %w{CC CXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS} - removed = Hash[*keys.map{ |key| [key, ENV[key]] }.flatten] + removed = Hash[*keys.map{ |key| [key, self[key]] }.flatten] keys.each do |key| - ENV[key] = nil + self[key] = nil end removed end |
