Skip to content

Commit

Permalink
Use darwin.binutils on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed May 15, 2020
1 parent eb4b3fa commit fb972e2
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions bazel_tools/nixpkgs-hermetic-cc-toolchain.patch
Original file line number Diff line number Diff line change
Expand Up @@ -734,26 +734,18 @@ index fb87da4..6bf2d90 100644
this rule to specific explicitly which commands the toolchain should
diff --git a/nixpkgs/toolchains/cc.nix b/nixpkgs/toolchains/cc.nix
new file mode 100644
index 0000000..56ddae7
index 0000000..88cf785
--- /dev/null
+++ b/nixpkgs/toolchains/cc.nix
@@ -0,0 +1,277 @@
@@ -0,0 +1,279 @@
+with import <nixpkgs> { config = {}; overlays = []; };
+
+{ attribute_path ? null
+, nix_expr ? null
+}:
+
+let
+ defaultCcLinux =
+ buildEnv {
+ name = "bazel-nixpkgs-cc";
+ # XXX: `gcov` is missing in `/bin`.
+ # It exists in `stdenv.cc.cc` but that collides with `stdenv.cc`.
+ paths = [ stdenv.cc binutils ];
+ pathsToLink = [ "/bin" ];
+ };
+ defaultCcDarwin =
+ darwinCC =
+ # Work around https://github.com/NixOS/nixpkgs/issues/42059.
+ # See also https://github.com/NixOS/nixpkgs/pull/41589.
+ with darwin.apple_sdk.frameworks;
Expand Down Expand Up @@ -781,7 +773,17 @@ index 0000000..56ddae7
+ '';
+ cc =
+ if isNull nix_expr then
+ if stdenv.isDarwin then defaultCcDarwin else defaultCcLinux
+ buildEnv {
+ name = "bazel-nixpkgs-cc";
+ # XXX: `gcov` is missing in `/bin`.
+ # It exists in `stdenv.cc.cc` but that collides with `stdenv.cc`.
+ paths =
+ if stdenv.isDarwin then
+ [ (overrideCC stdenv darwinCC).cc darwin.binutils ]
+ else
+ [ stdenv.cc binutils ];
+ pathsToLink = [ "/bin" ];
+ }
+ else if isNull attribute_path then
+ nix_expr
+ else
Expand Down

0 comments on commit fb972e2

Please sign in to comment.