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