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.
This commit is contained in:
Max Howell 2009-09-05 12:26:13 +01:00
parent 87605d534b
commit a2cd3367a8

View File

@ -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'