From a2cd3367a8221c757f50f8cece0dcaaff10846a3 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 5 Sep 2009 12:26:13 +0100 Subject: [PATCH] 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. --- Library/Homebrew/brewkit.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb index 204213dec3..bf97e648a2 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'