depot/third_party/nixpkgs/pkgs/development/libraries/clang-ocl/default.nix

53 lines
1.3 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, writeScript
, cmake
, rocm-cmake
, rocm-device-libs
, clang
}:
stdenv.mkDerivation (finalAttrs: {
pname = "clang-ocl";
rocmVersion = "5.3.3";
version = finalAttrs.rocmVersion;
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "clang-ocl";
rev = "rocm-${finalAttrs.rocmVersion}";
hash = "sha256-uMSvcVJj+me2E+7FsXZ4l4hTcK6uKEegXpkHGcuist0=";
};
nativeBuildInputs = [
cmake
rocm-cmake
clang
];
buildInputs = [
rocm-device-libs
];
cmakeFlags = [
"-DCMAKE_C_COMPILER=clang"
"-DCMAKE_CXX_COMPILER=clang++"
];
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
'';
meta = with lib; {
description = "OpenCL compilation with clang compiler";
homepage = "https://github.com/RadeonOpenCompute/clang-ocl";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
broken = finalAttrs.rocmVersion != clang.version;
};
})