aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorcadrpear2014-01-08 00:08:52 -0500
committerJack Nagel2014-02-19 14:15:03 -0500
commitf43bb0c292963559a9a1e8d40948305ef0b9d05a (patch)
tree417652699293cfcde3c16c259e668bab0912724a /Library/Homebrew/extend
parenta1d2aa0f694b1387eb7a2a51405b547ce8610cfc (diff)
downloadbrew-f43bb0c292963559a9a1e8d40948305ef0b9d05a.tar.bz2
Fix building universal binaries on 32-bit CPUs
[jn: style, update comment] Closes Homebrew/homebrew#25728. Fixes Homebrew/homebrew#26834. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/ENV/super.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index db2a1bf2d..cbfd3dd8c 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -262,6 +262,14 @@ module Superenv
def universal_binary
self['HOMEBREW_ARCHFLAGS'] = Hardware::CPU.universal_archs.as_arch_flags
append 'HOMEBREW_CCCFG', "u", ''
+
+ # GCC doesn't accept "-march" for a 32-bit CPU with "-arch x86_64"
+ if compiler != :clang && Hardware.is_32_bit?
+ self['HOMEBREW_OPTFLAGS'] = self['HOMEBREW_OPTFLAGS'].sub(
+ /-march=\S*/,
+ "-Xarch_#{Hardware::CPU.arch_32_bit} \\0"
+ )
+ end
end
def cxx11