3e2acf8aff
GitOrigin-RevId: d42cd445dde587e9a993cd9434cb43da07c4c5de
41 lines
1.1 KiB
Nix
41 lines
1.1 KiB
Nix
{ lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith }:
|
|
|
|
let
|
|
version = "4.1.0";
|
|
src = fetchFromGitHub {
|
|
owner = "RadeonOpenCompute";
|
|
repo = "llvm-project";
|
|
rev = "rocm-${version}";
|
|
hash = "sha256-DlId/dF5r0ULl2omYPCyu1Ic3XKlLL7ndiCA0RaF264=";
|
|
};
|
|
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"
|
|
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 {
|
|
inherit llvm version;
|
|
src = "${src}/lld";
|
|
buildLlvmTools = buildPackages.llvmPackages_rocm;
|
|
};
|
|
|
|
llvm = callPackage ./llvm {
|
|
inherit version;
|
|
src = "${src}/llvm";
|
|
};
|
|
}
|