extend/ENV/super: allow bottles with custom architectures

Currently, Homebrew recognises only the architectures listed in
`hardware.rb`. [1] Attempting to pass an unrecognised architecture to
`--bottle-arch` while building a bottle returns an error.

Let's change that by passing unrecognised bottle arches to the compiler
instead of immediately failing with a `CannotInstallFormulaError`.

Partially resolves #5815.

[1] 64b6846d60/Library/Homebrew/hardware.rb (L28-L42)
This commit is contained in:
Carlo Cabrera 2021-05-09 10:44:05 +01:00
parent 64b6846d60
commit e893f16727
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0
2 changed files with 3 additions and 4 deletions

View File

@ -261,6 +261,9 @@ module Superenv
sig { returns(String) }
def determine_optflags
Hardware::CPU.optimization_flags.fetch(effective_arch)
rescue KeyError
odebug "Building a bottle for custom architecture (#{effective_arch})..."
Hardware::CPU.arch_flag(effective_arch)
end
sig { returns(String) }

View File

@ -395,10 +395,6 @@ class FormulaInstaller
return if only_deps?
if build_bottle? && (arch = @bottle_arch) && Hardware::CPU.optimization_flags.exclude?(arch.to_sym)
raise CannotInstallFormulaError, "Unrecognized architecture for --bottle-arch: #{arch}"
end
formula.deprecated_flags.each do |deprecated_option|
old_flag = deprecated_option.old_flag
new_flag = deprecated_option.current_flag