Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / compilers / llvm / rocm / default.nix
blob6a11ded0529a4c2cb845184bdeb8fb420e57ec89
1 { lib, fetchFromGitHub, callPackage, wrapCCWith }:
3 let
4   version = "4.1.0";
5   src = fetchFromGitHub {
6     owner = "RadeonOpenCompute";
7     repo = "llvm-project";
8     rev = "rocm-${version}";
9     hash = "sha256-DlId/dF5r0ULl2omYPCyu1Ic3XKlLL7ndiCA0RaF264=";
10   };
11 in rec {
12   clang = wrapCCWith rec {
13     cc = clang-unwrapped;
14     extraBuildCommands = ''
15       clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
16       rsrc="$out/resource-root"
17       mkdir "$rsrc"
18       ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
19       echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
20       echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
21       rm $out/nix-support/add-hardening.sh
22       touch $out/nix-support/add-hardening.sh
23     '';
24   };
26   clang-unwrapped = callPackage ./clang.nix {
27     inherit lld llvm version;
28     src = "${src}/clang";
29   };
31   lld = callPackage ./lld {
32     inherit llvm version;
33     src = "${src}/lld";
34   };
36   llvm = callPackage ./llvm {
37     inherit version;
38     src = "${src}/llvm";
39   };