Skip to content

Commit fc1c711

Browse files
committed
hardware: add arm64?
1 parent 001e922 commit fc1c711

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

Library/Homebrew/extend/os/linux/diagnostic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def check_umask_not_zero
8282
sig { returns(T.nilable(String)) }
8383
def check_supported_architecture
8484
return if ::Hardware::CPU.intel?
85-
return if ::Hardware::CPU.arm? && ::Hardware::CPU.is_64_bit?
85+
return if ::Hardware::CPU.arm64?
8686

8787
<<~EOS
8888
Your CPU architecture (#{::Hardware::CPU.arch}) is not supported. We only support

Library/Homebrew/extend/os/linux/extend/ENV/super.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_a
4545
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
4646
m4_path_deps = ["libtool", "bison"]
4747
self["M4"] = "#{HOMEBREW_PREFIX}/opt/m4/bin/m4" if deps.any? { m4_path_deps.include?(_1.name) }
48-
if ::Hardware::CPU.arch == :arm64
48+
if ::Hardware::CPU.arm64?
4949
# Build jemalloc-sys rust crate on ARM64/AArch64 with support for page sizes up to 64K.
5050
self["JEMALLOC_SYS_WITH_LG_PAGE"] = "16"
5151

5252
# Workaround patchelf.rb bug causing segfaults and preventing bottling on ARM64/AArch64
5353
# https://github.com/Homebrew/homebrew-core/issues/163826
5454
self["CGO_ENABLED"] = "0"
55-
end
5655

57-
# Pointer authentication and BTI are hardening techniques most distros
58-
# use by default on their packages. arm64 Linux we're packaging
59-
# everything from scratch so the entire dependency tree can have it.
60-
append_to_cccfg "b" if ::Hardware::CPU.arch == :arm64 && ::DevelopmentTools.gcc_version("gcc") >= 9
56+
# Pointer authentication and BTI are hardening techniques most distros
57+
# use by default on their packages. arm64 Linux we're packaging
58+
# everything from scratch so the entire dependency tree can have it.
59+
append_to_cccfg "b" if ::DevelopmentTools.gcc_version("gcc") >= 9
60+
end
6161
end
6262

6363
sig { returns(T::Array[Pathname]) }

Library/Homebrew/extend/os/mac/hardware.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def oldest_cpu(version = nil)
1212
else
1313
MacOS.version
1414
end
15-
if ::Hardware::CPU.arch == :arm64
15+
if ::Hardware::CPU.arm64?
1616
:arm_vortex_tempest
1717
# This cannot use a newer CPU e.g. haswell because Rosetta 2 does not
1818
# support AVX instructions in bottles:

Library/Homebrew/hardware.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ def arm?
163163
type == :arm
164164
end
165165

166+
# Check whether the CPU architecture is 64-bit ARM.
167+
sig { returns(T::Boolean) }
168+
def arm64?
169+
arm? && is_64_bit?
170+
end
171+
166172
sig { returns(T::Boolean) }
167173
def little_endian?
168174
!big_endian?

Library/Homebrew/requirements/arch_requirement.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(tags)
2121
satisfy(build_env: false) do
2222
case @arch
2323
when :x86_64 then Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
24-
when :arm64 then Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
24+
when :arm64 then Hardware::CPU.arm64?
2525
when :arm, :intel, :ppc then Hardware::CPU.type == @arch
2626
end
2727
end

0 commit comments

Comments
 (0)