aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-11-12 12:00:18 -0600
committerJack Nagel2013-11-12 13:53:29 -0600
commit4cb824b92eb6c474324cb065296fa93c07d4ba83 (patch)
tree480dff4f110b8d3d2861fd009cb6d752fb161196
parentc7b7fdf0ca45d0b139c28f55caf9392023f6f0ad (diff)
downloadbrew-4cb824b92eb6c474324cb065296fa93c07d4ba83.tar.bz2
Allow changing the optimization level under superenv
-rwxr-xr-xLibrary/ENV/4.3/cc2
-rw-r--r--Library/Homebrew/extend/ENV/super.rb9
2 files changed, 9 insertions, 2 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index fced0780a..eeb87e332 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -181,7 +181,7 @@ class Cmd
end
def optflags
args = []
- args << '-Os'
+ args << "-#{ENV['HOMEBREW_OPTIMIZATION_LEVEL']}"
# When bottling use the oldest supported CPU type.
if cccfg? 'bc'
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 1adbc2404..7a7476276 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -70,6 +70,7 @@ module Superenv
self['PKG_CONFIG_PATH'] = determine_pkg_config_path
self['PKG_CONFIG_LIBDIR'] = determine_pkg_config_libdir
self['HOMEBREW_CCCFG'] = determine_cccfg
+ self['HOMEBREW_OPTIMIZATION_LEVEL'] = 'Os'
self['HOMEBREW_BREW_FILE'] = HOMEBREW_BREW_FILE
self['HOMEBREW_SDKROOT'] = "#{MacOS.sdk_path}" if MacOS::Xcode.without_clt?
self['HOMEBREW_DEVELOPER_DIR'] = determine_developer_dir # used by our xcrun shim
@@ -252,7 +253,7 @@ module Superenv
### NO LONGER NECESSARY OR NO LONGER SUPPORTED
def noop(*args); end
- %w[m64 gcc_4_0_1 fast O4 O3 O2 Os Og O1 libxml2 minimal_optimization
+ %w[m64 gcc_4_0_1 fast Og libxml2 minimal_optimization
no_optimization enable_warnings x11
set_cpu_flags
macosxsdk remove_macosxsdk].each{|s| alias_method s, :noop }
@@ -315,6 +316,12 @@ module Superenv
def m32
append 'HOMEBREW_CCCFG', "3", ''
end
+
+ %w{O4 O3 O2 O1 O0 Os}.each do |opt|
+ define_method opt do
+ self['HOMEBREW_OPTIMIZATION_LEVEL'] = opt
+ end
+ end
end