2022-11-04 12:27:35 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-11-27 09:42:12 +00:00
|
|
|
, writeScript
|
2022-11-04 12:27:35 +00:00
|
|
|
, cmake
|
|
|
|
, rocm-cmake
|
|
|
|
, rocm-device-libs
|
|
|
|
, clang
|
|
|
|
}:
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-11-04 12:27:35 +00:00
|
|
|
pname = "clang-ocl";
|
2022-11-27 09:42:12 +00:00
|
|
|
rocmVersion = "5.3.3";
|
|
|
|
version = finalAttrs.rocmVersion;
|
2022-11-04 12:27:35 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "RadeonOpenCompute";
|
|
|
|
repo = "clang-ocl";
|
2022-11-27 09:42:12 +00:00
|
|
|
rev = "rocm-${finalAttrs.rocmVersion}";
|
2022-11-04 12:27:35 +00:00
|
|
|
hash = "sha256-uMSvcVJj+me2E+7FsXZ4l4hTcK6uKEegXpkHGcuist0=";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
rocm-cmake
|
|
|
|
clang
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
rocm-device-libs
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_C_COMPILER=clang"
|
|
|
|
"-DCMAKE_CXX_COMPILER=clang++"
|
|
|
|
];
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl jq common-updater-scripts
|
|
|
|
rocmVersion="$(curl -sL "https://api.github.com/repos/RadeonOpenCompute/clang-ocl/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
|
|
|
|
update-source-version clang-ocl "$rocmVersion" --ignore-same-hash --version-key=rocmVersion
|
|
|
|
'';
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "OpenCL compilation with clang compiler";
|
|
|
|
homepage = "https://github.com/RadeonOpenCompute/clang-ocl";
|
|
|
|
license = with licenses; [ mit ];
|
2022-11-27 09:42:12 +00:00
|
|
|
maintainers = teams.rocm.members;
|
|
|
|
broken = finalAttrs.rocmVersion != clang.version;
|
2022-11-04 12:27:35 +00:00
|
|
|
};
|
2022-11-27 09:42:12 +00:00
|
|
|
})
|