1{
2 lib,
3 stdenv,
4 rocm-merged-llvm,
5 cmake,
6 lsb-release,
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "hipcc";
11 # In-tree with ROCm LLVM
12 inherit (rocm-merged-llvm) version;
13 src = rocm-merged-llvm.llvm-src;
14 sourceRoot = "${finalAttrs.src.name}/amd/hipcc";
15
16 nativeBuildInputs = [ cmake ];
17
18 buildInputs = [ rocm-merged-llvm ];
19
20 patches = [
21 # https://github.com/ROCm/llvm-project/pull/183
22 # Fixes always-invoked UB in hipcc
23 ./0001-hipcc-Remove-extra-definition-of-hipBinUtilPtr_-in-d.patch
24 ];
25
26 postPatch = ''
27 substituteInPlace src/hipBin_amd.h \
28 --replace-fail "/usr/bin/lsb_release" "${lsb-release}/bin/lsb_release"
29 '';
30
31 cmakeFlags = [
32 "-DCMAKE_BUILD_TYPE=Release"
33 ];
34 postInstall = ''
35 rm -r $out/hip/bin
36 ln -s $out/bin $out/hip/bin
37 '';
38
39 meta = with lib; {
40 description = "Compiler driver utility that calls clang or nvcc";
41 homepage = "https://github.com/ROCm/HIPCC";
42 license = with licenses; [ mit ];
43 maintainers = with maintainers; [ lovesegfault ];
44 teams = [ teams.rocm ];
45 platforms = platforms.linux;
46 };
47})