aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-09-05 12:26:13 +0100
committerMax Howell2009-09-05 14:38:38 +0100
commit3fb7c33397b7ce35bb553f4efc8d6b4c3bc8475e (patch)
treeccf75e637eadfafc7ffed5c002d2bf477807fd3e /Library
parentc4e1abcad993e7384a413a31b4c8a8784f862c6b (diff)
downloadhomebrew-3fb7c33397b7ce35bb553f4efc8d6b4c3bc8475e.tar.bz2
ENV.no_optimization
For when we optimize too much and things seem to break. In my experience the GCC optimizer is pretty safe nowadays, but at least this allows you to test the hypothesis the optimization is breaking the build.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brewkit.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb
index 204213dec..bf97e648a 100644
--- a/Library/Homebrew/brewkit.rb
+++ b/Library/Homebrew/brewkit.rb
@@ -40,12 +40,11 @@ ENV['MACOSX_DEPLOYMENT_TARGET']=$1
# ignore existing build vars, thus we should have less bugs to deal with
ENV['LDFLAGS']=""
-cflags=%w[-O3]
-
# optimise all the way to eleven, references:
# http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel
# http://forums.mozillazine.org/viewtopic.php?f=12&t=577299
# http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/i386-and-x86_002d64-Options.html
+cflags=[]
if MACOS_VERSION >= 10.6
case Hardware.intel_family
when :penryn, :core2
@@ -80,7 +79,8 @@ end
# -w: keep signal to noise high
# -fomit-frame-pointer: we are not debugging this software, we are using it
-ENV['CFLAGS']=ENV['CXXFLAGS']="#{cflags*' '} -w -pipe -fomit-frame-pointer -mmacosx-version-min=#{MACOS_VERSION}"
+BREWKIT_SAFE_FLAGS="-w -pipe -fomit-frame-pointer -mmacosx-version-min=#{MACOS_VERSION}"
+ENV['CFLAGS']=ENV['CXXFLAGS']="-O3 #{cflags*' '} #{BREWKIT_SAFE_FLAGS}"
# compile faster
ENV['MAKEFLAGS']="-j#{Hardware.processor_count}"
@@ -115,8 +115,12 @@ module HomebrewEnvExtension
self['MACOSX_DEPLOYMENT_TARGET']=nil
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)
end
- def generic_i386
- %w[-mfpmath=sse -msse3 -mmmx -march=\w+].each {|s| remove_from_cflags s}
+ def minimal_optimization
+ self['CFLAGS']=self['CXXFLAGS']="-Os #{BREWKIT_SAFE_FLAGS}"
+
+ end
+ def no_optimization
+ self['CFLAGS']=self['CXXFLAGS']=BREWKIT_SAFE_FLAGS
end
def libxml2
append_to_cflags ' -I/usr/include/libxml2'