nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, rocmUpdateScript
5, cmake
6, rocm-cmake
7, git
8, rocm-comgr
9, rocm-runtime
10, hwdata
11, texliveSmall
12, doxygen
13, graphviz
14, buildDocs ? true
15}:
16
17let
18 latex = lib.optionalAttrs buildDocs (texliveSmall.withPackages (ps: with ps; [
19 changepage
20 latexmk
21 varwidth
22 multirow
23 hanging
24 adjustbox
25 collectbox
26 stackengine
27 enumitem
28 alphalph
29 wasysym
30 sectsty
31 tocloft
32 newunicodechar
33 etoc
34 helvetic
35 wasy
36 courier
37 ]));
38in stdenv.mkDerivation (finalAttrs: {
39 pname = "rocdbgapi";
40 version = "6.0.2";
41
42 outputs = [
43 "out"
44 ] ++ lib.optionals buildDocs [
45 "doc"
46 ];
47
48 src = fetchFromGitHub {
49 owner = "ROCm";
50 repo = "ROCdbgapi";
51 rev = "rocm-${finalAttrs.version}";
52 hash = "sha256-+CxaTmxRt/RicqQddqIEHs8vvAPCMKXkWg7kbZvnUsQ=";
53 };
54
55 nativeBuildInputs = [
56 cmake
57 rocm-cmake
58 git
59 ] ++ lib.optionals buildDocs [
60 latex
61 doxygen
62 graphviz
63 ];
64
65 buildInputs = [
66 rocm-comgr
67 rocm-runtime
68 hwdata
69 ];
70
71 cmakeFlags = [
72 "-DPCI_IDS_PATH=${hwdata}/share/hwdata"
73 # Manually define CMAKE_INSTALL_<DIR>
74 # See: https://github.com/NixOS/nixpkgs/pull/197838
75 "-DCMAKE_INSTALL_BINDIR=bin"
76 "-DCMAKE_INSTALL_LIBDIR=lib"
77 "-DCMAKE_INSTALL_INCLUDEDIR=include"
78 ];
79
80 # Unfortunately, it seems like we have to call make on this manually
81 postBuild = lib.optionalString buildDocs ''
82 export HOME=$(mktemp -d)
83 make -j$NIX_BUILD_CORES doc
84 '';
85
86 postInstall = ''
87 substituteInPlace $out/lib/cmake/amd-dbgapi/amd-dbgapi-config.cmake \
88 --replace "/build/source/build/" ""
89
90 substituteInPlace $out/lib/cmake/amd-dbgapi/amd-dbgapi-targets.cmake \
91 --replace "/build/source/build" "$out"
92 '' + lib.optionalString buildDocs ''
93 mv $out/share/html/amd-dbgapi $doc/share/doc/amd-dbgapi/html
94 rmdir $out/share/html
95 '';
96
97 passthru.updateScript = rocmUpdateScript {
98 name = finalAttrs.pname;
99 owner = finalAttrs.src.owner;
100 repo = finalAttrs.src.repo;
101 };
102
103 meta = with lib; {
104 description = "Debugger support for control of execution and inspection state";
105 homepage = "https://github.com/ROCm/ROCdbgapi";
106 license = with licenses; [ mit ];
107 maintainers = teams.rocm.members;
108 platforms = platforms.linux;
109 broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version || versionAtLeast finalAttrs.version "7.0.0";
110 };
111})