diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix index 6ab217245156..f3435169bce8 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix @@ -175,7 +175,10 @@ stdenv.mkDerivation rec { # This patch removes using the -fobjc-arc compiler option and makes the code # compile without automatic reference counting. Caveat: this leaks memory, but # we accept this fact because xcode_locator is only a short-lived process used during the build. - ./no-arc.patch + (substituteAll { + src = ./no-arc.patch; + multiBinPatch = if stdenv.hostPlatform.system == "aarch64-darwin" then "-arch arm64 -Wl,-no_adhoc_codesign" else ""; + }) # --experimental_strict_action_env (which may one day become the default # see bazelbuild/bazel#2574) hardcodes the default diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/no-arc.patch b/pkgs/development/tools/build-managers/bazel/bazel_5/no-arc.patch index b4483311d31d..b41e193876dc 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_5/no-arc.patch +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/no-arc.patch @@ -9,7 +9,7 @@ index 990afe3e8c..cd5b7b1b7a 100644 - /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \ - -framework Foundation -arch arm64 -arch x86_64 -Wl,-no_adhoc_codesign -Wl,-no_uuid -o $@ $< && \ + /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -framework CoreServices \ -+ -framework Foundation -arch x86_64 -Wl,-no_uuid -o $@ $< && \ ++ -framework Foundation -arch x86_64 @multiBinPatch@ -Wl,-no_uuid -o $@ $< && \ env -i codesign --identifier $@ --force --sign - $@ """