blob: ffa1aff95373d6a988e39a4ec0bc45cd3062a742 (
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
37
38
39
40
41
|
{ lib, stdenv, fetchFromGitHub, callPackage, wrapCCWith }:
let
version = "4.0.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "llvm-project";
rev = "rocm-${version}";
hash = "sha256-nIvqEk18NLtY8Hec2Iq6ufWMblzYJ8SOIXgqomtqa0s=";
};
in rec {
clang = wrapCCWith rec {
cc = clang-unwrapped;
extraBuildCommands = ''
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
rm $out/nix-support/add-hardening.sh
touch $out/nix-support/add-hardening.sh
'';
};
clang-unwrapped = callPackage ./clang.nix {
inherit lld llvm version;
src = "${src}/clang";
};
lld = callPackage ./lld.nix {
inherit llvm version;
src = "${src}/lld";
};
llvm = callPackage ./llvm.nix {
inherit version;
src = "${src}/llvm";
};
}
|