nixpkgs/pkgs/development/libraries/rocm-thunk/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, stdenv
2020-07-10 15:01:24 +00:00
, fetchFromGitHub
2021-09-08 14:14:29 +00:00
, writeScript
2020-07-10 15:01:24 +00:00
, cmake
, pkg-config
2021-11-08 10:08:20 +00:00
, libdrm
2020-07-10 15:01:24 +00:00
, numactl
}:
stdenv.mkDerivation (finalAttrs: {
2020-07-10 15:01:24 +00:00
pname = "rocm-thunk";
version = "5.4.0";
2020-07-10 15:01:24 +00:00
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCT-Thunk-Interface";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-EU5toaKzVeZpdm/YhaQ0bXq0eoYwYQ5qGLUJzxgZVjE=";
2020-07-10 15:01:24 +00:00
};
preConfigure = ''
export cmakeFlags="$cmakeFlags "
'';
nativeBuildInputs = [ cmake pkg-config ];
2021-11-08 10:08:20 +00:00
buildInputs = [ libdrm numactl ];
2020-07-10 15:01:24 +00:00
# https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/issues/75
postPatch = ''
substituteInPlace libhsakmt.pc.in \
--replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
'';
2020-07-10 15:01:24 +00:00
postInstall = ''
cp -r $src/include $out
'';
2021-09-08 14:14:29 +00:00
passthru.updateScript = writeScript "update.sh" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/RadeonOpenCompute/ROCT-Thunk-Interface/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
update-source-version rocm-thunk "$version" --ignore-same-hash
2021-09-08 14:14:29 +00:00
'';
meta = with lib; {
2020-07-10 15:01:24 +00:00
description = "Radeon open compute thunk interface";
homepage = "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface";
license = with licenses; [ bsd2 mit ];
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
2020-07-10 15:01:24 +00:00
};
})