3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/llvm/rocm/default.nix

42 lines
1.1 KiB
Nix
Raw Normal View History

{ lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith }:
2020-07-10 18:28:08 +01:00
let
2021-03-24 07:43:58 +00:00
version = "4.1.0";
2020-07-10 18:28:08 +01:00
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "llvm-project";
rev = "rocm-${version}";
2021-03-24 07:43:58 +00:00
hash = "sha256-DlId/dF5r0ULl2omYPCyu1Ic3XKlLL7ndiCA0RaF264=";
2020-07-10 18:28:08 +01:00
};
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 "${lib.getLib cc}/lib/clang/$clang_version/include" "$rsrc"
2020-07-10 18:28:08 +01:00
echo "-resource-dir=$rsrc" >> $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 {
2020-07-10 18:28:08 +01:00
inherit llvm version;
src = "${src}/lld";
buildLlvmTools = buildPackages.llvmPackages_rocm;
2020-07-10 18:28:08 +01:00
};
llvm = callPackage ./llvm {
2020-07-10 18:28:08 +01:00
inherit version;
src = "${src}/llvm";
};
}