bazel_{3,4,5}: Use arm64 as arch suffix on aarch64

The official bazel wrapper script uses `$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)`
as the `os-arch` suffix.

On aarch64 Darwin, `uname -m` returns "arm64", on aarch64 Linux it returns "aarch64".
This commit is contained in:
Claudio Bley 2022-07-05 20:28:06 +02:00
parent b38a131850
commit 0917e34967
3 changed files with 9 additions and 3 deletions

View file

@ -110,7 +110,9 @@ let
# and libraries path.
# We prefetch it, patch it, and override it in a global bazelrc.
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
arch = stdenv.hostPlatform.parsed.cpu.name;
# on aarch64 Darwin, `uname -m` returns "arm64"
arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
remote_java_tools = stdenv.mkDerivation {
name = "remote_java_tools_${system}";

View file

@ -135,7 +135,9 @@ let
# and libraries path.
# We prefetch it, patch it, and override it in a global bazelrc.
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
arch = stdenv.hostPlatform.parsed.cpu.name;
# on aarch64 Darwin, `uname -m` returns "arm64"
arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
remote_java_tools = stdenv.mkDerivation {
name = "remote_java_tools_${system}";

View file

@ -126,7 +126,9 @@ let
platforms = lib.platforms.linux ++ lib.platforms.darwin;
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
arch = stdenv.hostPlatform.parsed.cpu.name;
# on aarch64 Darwin, `uname -m` returns "arm64"
arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
bazelRC = writeTextFile {
name = "bazel-rc";