diff options
| author | Misty De Meo | 2013-08-25 14:14:53 -0700 |
|---|---|---|
| committer | Misty De Meo | 2013-08-28 20:21:06 -0700 |
| commit | 3a948bfc21c632c456c5773105795413637a9e63 (patch) | |
| tree | 2d5ce41e90e8e3d850a89764b6465db52ae420d4 /Library/Homebrew | |
| parent | 4f95ebf25cd2b68fb88b96562e113fef87a21335 (diff) | |
| download | homebrew-3a948bfc21c632c456c5773105795413637a9e63.tar.bz2 | |
Allow building bottles with custom architectures
This allows overriding the "oldest CPU" behaviour - for instance, to
build Intel bottles for a newer CPU than Core 2, to build a PPC bottle
with or without Altivec on the same computer, etc.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/extend/ARGV.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/std.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/super.rb | 11 |
3 files changed, 17 insertions, 2 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index 15ee645f8..67ebb8b30 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -133,6 +133,11 @@ module HomebrewArgvExtension include? '--build-bottle' or !ENV['HOMEBREW_BUILD_BOTTLE'].nil? end + def bottle_arch + arch = value 'bottle-arch' + arch.to_sym if arch + end + def build_from_source? include? '--build-from-source' or !ENV['HOMEBREW_BUILD_FROM_SOURCE'].nil? \ or build_head? or build_devel? or build_universal? or build_bottle? diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index f2cd17115..cacd04dca 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -324,7 +324,8 @@ module Stdenv append flags, xarch unless xarch.empty? if ARGV.build_bottle? - append flags, Hardware::CPU.optimization_flags[Hardware.oldest_cpu] + arch = ARGV.bottle_arch || Hardware.oldest_cpu + append flags, Hardware::CPU.optimization_flags[arch] 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/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 13111657b..5cf186b19 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -76,6 +76,12 @@ module Superenv self['CMAKE_LIBRARY_PATH'] = determine_cmake_library_path self['ACLOCAL_PATH'] = determine_aclocal_path + # For custom bottles, need to specify the arch in the environment + # so that the compiler shims have access + if (arch = ARGV.bottle_arch) + self['HOMEBREW_ARCHFLAGS'] = Hardware::CPU.optimization_flags[arch] + end + # The HOMEBREW_CCCFG ENV variable is used by the ENV/cc tool to control # compiler flag stripping. It consists of a string of characters which act # as flags. Some of these flags are mutually exclusive. @@ -83,6 +89,7 @@ module Superenv # u - A universal build was requested # 3 - A 32-bit build was requested # b - Installing from a bottle + # c - Installing from a bottle with a custom architecture # i - Installing from a bottle on Intel # 6 - Installing from a bottle on 64-bit Intel # p - Installing from a bottle on PPC @@ -237,7 +244,9 @@ module Superenv def determine_cccfg s = "" if ARGV.build_bottle? - s << if Hardware::CPU.type == :intel + s << if ARGV.bottle_arch + 'bc' + elsif Hardware::CPU.type == :intel if Hardware::CPU.is_64_bit? 'bi6' else |
