···140 # on aarch64 Darwin, `uname -m` returns "arm64"
141 arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
142143- #build --extra_toolchains=@local_jdk//:all
144- #build --tool_java_runtime_version=local_jdk
145- #build --java_runtime_version=local_jdk
146- #build --repo_env=JAVA_HOME=${buildJdk}${if isDarwin then "/zulu-11.jdk/Contents/Home" else "/lib/openjdk"}
147-148 bazelRC = writeTextFile {
149 name = "bazel-rc";
150 text = ''
···223 # argument if it's found to be an empty string.
224 ../trim-last-argument-to-gcc-if-empty.patch
225226- # XXX: This seems merged / not a real problem. See PR.
227- # TODO: Remove when protobuf tests confirm it is not needed.
228- # `java_proto_library` ignores `strict_proto_deps`
229- # https://github.com/bazelbuild/bazel/pull/16146
230- # ./strict_proto_deps.patch
231-232- # On Darwin, using clang 6 to build fails because of a linker error (see #105573),
233- # but using clang 7 fails because libarclite_macosx.a cannot be found when linking
234- # the xcode_locator tool.
235- # This patch removes using the -fobjc-arc compiler option and makes the code
236- # compile without automatic reference counting. Caveat: this leaks memory, but
237- # we accept this fact because xcode_locator is only a short-lived process used during the build.
238- ./no-arc.patch
239-240 # --experimental_strict_action_env (which may one day become the default
241 # see bazelbuild/bazel#2574) hardcodes the default
242 # action environment to a non hermetic value (e.g. "/usr/local/bin").
···303 # nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead
304 sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc
305306- # clang installed from Xcode has a compatibility wrapper that forwards
307- # invocations of gcc to clang, but vanilla clang doesn't
308- sed -i -e 's;_find_generic(repository_ctx, "gcc", "CC", overriden_tools);_find_generic(repository_ctx, "clang", "CC", overriden_tools);g' tools/cpp/unix_cc_configure.bzl
309-310- # This is necessary to avoid:
311- # "error: no visible @interface for 'NSDictionary' declares the selector
312- # 'initWithContentsOfURL:error:'"
313- # This can be removed when the apple_sdk is upgraded beyond 10.13+
314- sedVerbose tools/osx/xcode_locator.m \
315- -e '/initWithContentsOfURL:versionPlistUrl/ {
316- N
317- s/error:nil\];/\];/
318- }'
319-320 sed -i -e 's;"/usr/bin/libtool";_find_generic(repository_ctx, "libtool", "LIBTOOL", overriden_tools);g' tools/cpp/unix_cc_configure.bzl
321 wrappers=( tools/cpp/osx_cc_wrapper.sh.tpl )
322 for wrapper in "''${wrappers[@]}"; do
···502 # $out/bin/bazel-{version}-{os_arch} The binary _must_ exist with this
503 # naming if your project contains a .bazelversion file.
504 cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel
505- wrapProgram $out/bin/bazel $wrapperfile --suffix PATH : ${defaultShellPath}
506- mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch}
0507508 mkdir $out/share
509 cp ./bazel_src/output/parser_deploy.jar $out/share/parser_deploy.jar
···525 ./bazel_src/output/bazel-complete.fish
526 '';
527528- # Install check fails on `aarch64-darwin`
529- # https://github.com/NixOS/nixpkgs/issues/145587
530- doInstallCheck = false; #stdenv.hostPlatform.system != "aarch64-darwin";
531 installCheckPhase = ''
532 export TEST_TMPDIR=$(pwd)
533···595 inherit Foundation bazel_self lockfile repoCache;
596 };
597598- updater = throw "TODO";
599-600 inherit distDir repoCache;
601 };
602}
···140 # on aarch64 Darwin, `uname -m` returns "arm64"
141 arch = with stdenv.hostPlatform; if isDarwin && isAarch64 then "arm64" else parsed.cpu.name;
14200000143 bazelRC = writeTextFile {
144 name = "bazel-rc";
145 text = ''
···218 # argument if it's found to be an empty string.
219 ../trim-last-argument-to-gcc-if-empty.patch
22000000000000000221 # --experimental_strict_action_env (which may one day become the default
222 # see bazelbuild/bazel#2574) hardcodes the default
223 # action environment to a non hermetic value (e.g. "/usr/local/bin").
···284 # nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead
285 sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc
286287+ # XXX: What do these do ?
0000000000000288 sed -i -e 's;"/usr/bin/libtool";_find_generic(repository_ctx, "libtool", "LIBTOOL", overriden_tools);g' tools/cpp/unix_cc_configure.bzl
289 wrappers=( tools/cpp/osx_cc_wrapper.sh.tpl )
290 for wrapper in "''${wrappers[@]}"; do
···470 # $out/bin/bazel-{version}-{os_arch} The binary _must_ exist with this
471 # naming if your project contains a .bazelversion file.
472 cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel
473+ versionned_bazel="$out/bin/bazel-${version}-${system}-${arch}"
474+ mv ./bazel_src/output/bazel "$versionned_bazel"
475+ wrapProgram "$versionned_bazel" --suffix PATH : ${defaultShellPath}
476477 mkdir $out/share
478 cp ./bazel_src/output/parser_deploy.jar $out/share/parser_deploy.jar
···494 ./bazel_src/output/bazel-complete.fish
495 '';
496000497 installCheckPhase = ''
498 export TEST_TMPDIR=$(pwd)
499···561 inherit Foundation bazel_self lockfile repoCache;
562 };
563564+ # For ease of debugging
0565 inherit distDir repoCache;
566 };
567}