depot/third_party/nixpkgs/pkgs/development/libraries/clang-ocl/default.nix
Default email a71eb02b76 Project import generated by Copybara.
GitOrigin-RevId: a115bb9bd56831941be3776c8a94005867f316a7
2022-11-27 10:42:12 +01:00

52 lines
1.3 KiB
Nix

{ 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;
};
})