blob: 1795dc55b71bfe53792892ecb833ce37d079131d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
with import ./. {};
with darwin.apple_sdk.frameworks;
# XXX On Darwin, workaround
# https://github.com/NixOS/nixpkgs/issues/42059. See also
# https://github.com/NixOS/nixpkgs/pull/41589.
let cc = runCommand "cc-wrapper-bazel" {
buildInputs = [ pkgs.stdenv.cc makeWrapper ];
}
''
mkdir -p $out/bin
# Copy the content of pkgs.stdenv.cc
for i in ${pkgs.stdenv.cc}/bin/*
do
ln -sf $i $out/bin
done
# Override clang
rm $out/bin/clang
makeWrapper ${pkgs.stdenv.cc}/bin/clang $out/bin/clang \
--add-flags "-isystem ${llvmPackages.libcxx}/include/c++/v1 \
-F${CoreFoundation}/Library/Frameworks \
-F${CoreServices}/Library/Frameworks \
-F${Security}/Library/Frameworks \
-F${Foundation}/Library/Frameworks \
-L${libcxx}/lib \
-L${darwin.libobjc}/lib"
'';
stdenv = if pkgs.stdenv.isDarwin then overrideCC pkgs.stdenv cc else pkgs.stdenv;
in
buildEnv {
name = "bazel-cc-toolchain";
paths = [ stdenv.cc ] ++ (if stdenv.isDarwin then [ ] else [ binutils ]);
}
|