1{ lib
2, stdenv
3, fetchFromGitHub
4, rocmUpdateScript
5, cmake
6, rocm-cmake
7, git
8, rocm-comgr
9, rocm-runtime
10, texlive
11, doxygen
12, graphviz
13, buildDocs ? true
14}:
15
16let
17 latex = lib.optionalAttrs buildDocs texlive.combine {
18 inherit (texlive) scheme-small
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 = "5.4.2";
41
42 outputs = [
43 "out"
44 ] ++ lib.optionals buildDocs [
45 "doc"
46 ];
47
48 src = fetchFromGitHub {
49 owner = "ROCm-Developer-Tools";
50 repo = "ROCdbgapi";
51 rev = "rocm-${finalAttrs.version}";
52 hash = "sha256-KoFa6JzoEPT5/ns9X/hMfu8bOh29HD9n2qGJ3gzhiBA=";
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 ];
69
70 # Unfortunately, it seems like we have to call make on this manually
71 postBuild = lib.optionalString buildDocs ''
72 export HOME=$(mktemp -d)
73 make -j$NIX_BUILD_CORES doc
74 '';
75
76 postInstall = ''
77 substituteInPlace $out/lib/cmake/amd-dbgapi/amd-dbgapi-config.cmake \
78 --replace "/build/source/build/" ""
79
80 substituteInPlace $out/lib/cmake/amd-dbgapi/amd-dbgapi-targets.cmake \
81 --replace "/build/source/build" "$out"
82 '' + lib.optionalString buildDocs ''
83 mv $out/share/html/amd-dbgapi $doc/share/doc/amd-dbgapi/html
84 rmdir $out/share/html
85 '';
86
87 passthru.updateScript = rocmUpdateScript {
88 name = finalAttrs.pname;
89 owner = finalAttrs.src.owner;
90 repo = finalAttrs.src.repo;
91 };
92
93 meta = with lib; {
94 description = "Debugger support for control of execution and inspection state";
95 homepage = "https://github.com/ROCm-Developer-Tools/ROCdbgapi";
96 license = with licenses; [ mit ];
97 maintainers = teams.rocm.members;
98 platforms = platforms.linux;
99 broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
100 };
101})