aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-11-11 18:33:47 -0600
committerJack Nagel2013-11-11 18:34:15 -0600
commit83cbb1e3fbc58c0722eb9a747b5ec91fab8900cb (patch)
tree11303b4c3a92e950f338a43dcd3bcffebd1cf0bf /Library
parentc95c32fbb081d277ce943f65143b234c09582f8e (diff)
downloadbrew-83cbb1e3fbc58c0722eb9a747b5ec91fab8900cb.tar.bz2
Group public ENV methods together
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV/super.rb69
1 files changed, 36 insertions, 33 deletions
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 5e8e49d54..1adbc2404 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -111,39 +111,6 @@ module Superenv
warn_about_non_apple_gcc($1) if ENV['HOMEBREW_CC'] =~ GNU_GCC_REGEXP
end
- def universal_binary
- self['HOMEBREW_ARCHS'] = Hardware::CPU.universal_archs.join(',')
- append 'HOMEBREW_CCCFG', "u", ''
- end
-
- def cxx11
- if self['HOMEBREW_CC'] == 'clang'
- append 'HOMEBREW_CCCFG', "x", ''
- append 'HOMEBREW_CCCFG', "g", ''
- elsif self['HOMEBREW_CC'] =~ /gcc-4\.(8|9)/
- append 'HOMEBREW_CCCFG', "x", ''
- else
- raise "The selected compiler doesn't support C++11: #{self['HOMEBREW_CC']}"
- end
- end
-
- def libcxx
- if self['HOMEBREW_CC'] == 'clang'
- append 'HOMEBREW_CCCFG', "g", ''
- end
- end
-
- def libstdcxx
- if self['HOMEBREW_CC'] == 'clang'
- append 'HOMEBREW_CCCFG', "h", ''
- end
- end
-
- # m32 on superenv does not add any CC flags. It prevents "-m32" from being erased.
- def m32
- append 'HOMEBREW_CCCFG', "3", ''
- end
-
private
def determine_cc
@@ -294,6 +261,7 @@ module Superenv
delete('MAKEFLAGS')
end
alias_method :j1, :deparallelize
+
COMPILER_SYMBOL_MAP.values.each do |compiler|
define_method compiler do
@compiler = compiler
@@ -301,6 +269,7 @@ module Superenv
self.cxx = self['HOMEBREW_CXX'] = determine_cxx
end
end
+
GNU_GCC_VERSIONS.each do |n|
define_method(:"gcc-4.#{n}") do
@compiler = "gcc-4.#{n}"
@@ -308,10 +277,44 @@ module Superenv
self.cxx = self['HOMEBREW_CXX'] = determine_cxx
end
end
+
def make_jobs
self['MAKEFLAGS'] =~ /-\w*j(\d)+/
[$1.to_i, 1].max
end
+
+ def universal_binary
+ self['HOMEBREW_ARCHS'] = Hardware::CPU.universal_archs.join(',')
+ append 'HOMEBREW_CCCFG', "u", ''
+ end
+
+ def cxx11
+ if self['HOMEBREW_CC'] == 'clang'
+ append 'HOMEBREW_CCCFG', "x", ''
+ append 'HOMEBREW_CCCFG', "g", ''
+ elsif self['HOMEBREW_CC'] =~ /gcc-4\.(8|9)/
+ append 'HOMEBREW_CCCFG', "x", ''
+ else
+ raise "The selected compiler doesn't support C++11: #{self['HOMEBREW_CC']}"
+ end
+ end
+
+ def libcxx
+ if self['HOMEBREW_CC'] == 'clang'
+ append 'HOMEBREW_CCCFG', "g", ''
+ end
+ end
+
+ def libstdcxx
+ if self['HOMEBREW_CC'] == 'clang'
+ append 'HOMEBREW_CCCFG', "h", ''
+ end
+ end
+
+ # m32 on superenv does not add any CC flags. It prevents "-m32" from being erased.
+ def m32
+ append 'HOMEBREW_CCCFG', "3", ''
+ end
end