From 77688d0a455f896107577bbff76d1f995b03b3ec Mon Sep 17 00:00:00 2001 From: Ken Micklas Date: Thu, 10 Feb 2022 18:22:37 -0500 Subject: [PATCH] Interpret arm64 output from uname as aarch64 on mac OS --- toolchain/defs.bzl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl index 693e2da..2b572d3 100644 --- a/toolchain/defs.bzl +++ b/toolchain/defs.bzl @@ -222,12 +222,15 @@ def _zig_repository_impl(repository_ctx): res = repository_ctx.execute(["uname", "-m"]) if res.return_code != 0: fail("failed to run uname -m") - uname = res.stdout.strip() + arch = res.stdout.strip() + os = "linux" if repository_ctx.os.name.lower().startswith("mac os"): - host_platform = "macos-{}".format(uname) - else: - host_platform = "linux-{}".format(uname) + os = "macos" + if arch == "arm64": + # uname -m reports arm64 on an M1 Mac. + arch = "aarch64" + host_platform = "{}-{}".format(os, arch) zig_include_root = repository_ctx.attr.host_platform_include_root[host_platform] zig_sha256 = repository_ctx.attr.host_platform_sha256[host_platform]