Skip to content

Commit

Permalink
bazel: make toolchain available at build time [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
timokau committed Jun 25, 2019
1 parent 4a1577a commit 8d237ee
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkgs/development/tools/build-managers/bazel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
, bazel
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, python, gawk, gnused, gnutar, gnugrep, gzip, findutils
, binutils
, gcc
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
Expand Down Expand Up @@ -88,7 +90,7 @@ let
# ],
# )
#
[ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip ];
[ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip binutils.bintools gcc ];

# Java toolchain used for the build and tests
javaToolchain = "@bazel_tools//tools/jdk:toolchain_host${buildJdkName}";
Expand Down Expand Up @@ -334,6 +336,13 @@ stdenv.mkDerivation rec {

buildInputs = [
buildJdk

# bazel detects default tool locations during build time using `which` (in
# tools/cpp/unic_cc_configure.bzl:_find_tool). Make sure the tools are in
# PATH.
# binutils.bintools # for ar, dwp, nm, objcopy, objdump, strip
# gcc # for ld, cpp, gcc
# gcc.cc # for gcov
];

# when a command can’t be found in a bazel build, you might also
Expand All @@ -345,6 +354,11 @@ stdenv.mkDerivation rec {
makeWrapper
which
customBash

# TODO add this in the correct way for cross compilation (e.g. buildInputs but so that it ends up in path)
binutils.bintools # for ar, dwp, nm, objcopy, objdump, strip
gcc # for ld, cpp, gcc
gcc.cc # for gcov
] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];

# Bazel makes extensive use of symlinks in the WORKSPACE.
Expand Down

0 comments on commit 8d237ee

Please sign in to comment.