From 04500fd3a2d1feecd2a6b138d3d88eef1f52fa22 Mon Sep 17 00:00:00 2001 From: r2r-dev Date: Tue, 25 Jan 2022 01:51:29 +0100 Subject: [PATCH] bazel_5: Build xcode-locator as a universal binary only on "aarch64-darwin" --- .../tools/build-managers/bazel/bazel_5/default.nix | 5 ++++- .../tools/build-managers/bazel/bazel_5/no-arc.patch | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 - $@ """