2020-10-10 14:16:11 +02:00
|
|
|
# typed: strict
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2025-06-13 16:59:10 +01:00
|
|
|
module OS
|
|
|
|
module Mac
|
|
|
|
module Hardware
|
|
|
|
module ClassMethods
|
|
|
|
sig { params(version: T.nilable(MacOSVersion)).returns(Symbol) }
|
|
|
|
def oldest_cpu(version = nil)
|
|
|
|
version = if version
|
|
|
|
MacOSVersion.new(version.to_s)
|
|
|
|
else
|
|
|
|
MacOS.version
|
|
|
|
end
|
|
|
|
if ::Hardware::CPU.arch == :arm64
|
|
|
|
:arm_vortex_tempest
|
|
|
|
# This cannot use a newer CPU e.g. haswell because Rosetta 2 does not
|
|
|
|
# support AVX instructions in bottles:
|
|
|
|
# https://github.com/Homebrew/homebrew-core/issues/67713
|
|
|
|
elsif version >= :ventura
|
|
|
|
:westmere
|
|
|
|
elsif version >= :mojave
|
|
|
|
:nehalem
|
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-12-20 20:10:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2025-06-13 16:59:10 +01:00
|
|
|
|
|
|
|
Hardware.singleton_class.prepend(OS::Mac::Hardware::ClassMethods)
|