Make ENV.O4 a no-op

On older Apple compilers "-O4" is known to cause build errors. On recent
clang, it's the same as "-O3" and you have to pass "-O3 -flto" to get
the old behavior.
This commit is contained in:
Jack Nagel 2014-04-29 00:09:07 -05:00
parent a31393f2cd
commit 6a2fa253cd
2 changed files with 4 additions and 7 deletions

View File

@ -103,9 +103,9 @@ module Stdenv
alias_method :j1, :deparallelize
# These methods are no-ops for compatibility.
%w{fast Og}.each { |opt| define_method(opt) {} }
%w{fast O4 Og}.each { |opt| define_method(opt) {} }
%w{O4 O3 O2 O1 O0 Os}.each do |opt|
%w{O3 O2 O1 O0 Os}.each do |opt|
define_method opt do
remove_from_cflags(/-O./)
append_to_cflags "-#{opt}"
@ -116,7 +116,6 @@ module Stdenv
# we don't use locate because gcc 4.0 has not been provided since Xcode 4
self.cc = "#{MacOS.dev_tools_path}/gcc-4.0"
self.cxx = "#{MacOS.dev_tools_path}/g++-4.0"
replace_in_cflags '-O4', '-O3'
set_cpu_cflags '-march=nocona -mssse3'
@compiler = :gcc_4_0
end
@ -130,7 +129,6 @@ module Stdenv
self.cc = MacOS.locate("gcc-4.2")
self.cxx = MacOS.locate("g++-4.2")
replace_in_cflags '-O4', '-O3'
set_cpu_cflags
@compiler = :gcc
end
@ -276,7 +274,6 @@ module Stdenv
def universal_binary
append_to_cflags Hardware::CPU.universal_archs.as_arch_flags
replace_in_cflags '-O4', '-O3' # O4 seems to cause the build to fail
append 'LDFLAGS', Hardware::CPU.universal_archs.as_arch_flags
if compiler != :clang && Hardware.is_32_bit?

View File

@ -294,7 +294,7 @@ module Superenv
append 'HOMEBREW_CCCFG', "3", ''
end
%w{O4 O3 O2 O1 O0 Os}.each do |opt|
%w{O3 O2 O1 O0 Os}.each do |opt|
define_method opt do
self['HOMEBREW_OPTIMIZATION_LEVEL'] = opt
end
@ -305,7 +305,7 @@ module Superenv
# These methods are no longer necessary under superenv, but are needed to
# maintain an interface compatible with stdenv.
noops.concat %w{fast Og libxml2 x11 set_cpu_flags macosxsdk remove_macosxsdk}
noops.concat %w{fast O4 Og libxml2 x11 set_cpu_flags macosxsdk remove_macosxsdk}
# These methods provide functionality that has not yet been ported to
# superenv.