aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-05-11 12:18:25 +0100
committerMike McQuaid2013-05-11 12:18:25 +0100
commit646150ade992c0af25c2d6ca906b436c6fda025d (patch)
tree301b1d59187712830fef71e71a1b4de8ee09c0fb /Library
parent8e2cce64a7e2c9648956c5bb0b51103827f5c501 (diff)
downloadhomebrew-646150ade992c0af25c2d6ca906b436c6fda025d.tar.bz2
Fix --build-bottle CFLAGS.
The CFLAGS were previously not generic enough. References #18944. References #19179.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/cc23
-rw-r--r--Library/Homebrew/extend/ENV.rb2
-rw-r--r--Library/Homebrew/macos.rb12
-rw-r--r--Library/Homebrew/superenv.rb12
4 files changed, 38 insertions, 11 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 85f57817d..3d6241c1f 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -148,17 +148,22 @@ class Cmd
args
end
def cflags
- if cccfg? 'Ob'
- %w{-mtune=generic -Oz}
- elsif cccfg? 'O'
- args = %w{-pipe -w -Os}
- args << '-march=native' if tool =~ /clang/
- args += %w{-arch i386 -arch x86_64} if cccfg? 'u'
- args << "-std=#{@arg0}" if @arg0 =~ /c[89]9/
- args
+ return [] unless cccfg? 'O'
+
+ args = %w{-pipe -w -Os}
+
+ # When bottling use the oldest supported CPU type.
+ if cccfg? 'bi6'
+ args << '-march=core2'
+ elsif cccfg? 'bi'
+ args << '-march=prescott'
else
- []
+ args << '-march=native' if tool =~ /clang/
end
+
+ args += %w{-arch i386 -arch x86_64} if cccfg? 'u'
+ args << "-std=#{@arg0}" if @arg0 =~ /c[89]9/
+ args
end
def syslibpath
# We reject brew's lib as we explicitly add this as a -L flag, thus it
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 097f002d2..8b36a5b3d 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -326,7 +326,7 @@ module HomebrewEnvExtension
append flags, xarch unless xarch.empty?
if ARGV.build_bottle?
- append flags, '-mtune=generic'
+ append flags, Hardware::CPU.optimization_flags[MacOS.oldest_cpu]
else
# Don't set -msse3 and older flags because -march does that for us
append flags, map.fetch(Hardware::CPU.family, default)
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb
index 802da0de6..bae263f37 100644
--- a/Library/Homebrew/macos.rb
+++ b/Library/Homebrew/macos.rb
@@ -34,6 +34,18 @@ module MacOS extend self
cat.to_s.gsub('_', '').to_sym
end
+ def oldest_cpu
+ if Hardware::CPU.type == :intel
+ if Hardware::CPU.is_64_bit?
+ :core2
+ else
+ :core
+ end
+ else
+ Hardware::CPU.family
+ end
+ end
+
def locate tool
# Don't call tools (cc, make, strip, etc.) directly!
# Give the name of the binary you look for as a string to this method
diff --git a/Library/Homebrew/superenv.rb b/Library/Homebrew/superenv.rb
index 8c2d522b8..b8dfa7f25 100644
--- a/Library/Homebrew/superenv.rb
+++ b/Library/Homebrew/superenv.rb
@@ -182,7 +182,17 @@ class << ENV
def determine_cccfg
s = ""
- s << 'b' if ARGV.build_bottle?
+ if ARGV.build_bottle?
+ s << if Hardware::CPU.type == :intel
+ if Hardware::CPU.is_64_bit?
+ 'bi6'
+ else
+ 'bi'
+ end
+ else
+ 'b'
+ end
+ end
# Fix issue with sed barfing on unicode characters on Mountain Lion
s << 's' if MacOS.version >= :mountain_lion
# Fix issue with 10.8 apr-1-config having broken paths