nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 # FIXME: The following packages are used in the Doxygen table
41 # workaround, can be removed once
42 # https://github.com/doxygen/doxygen/issues/11634 is fixed, depending
43 # on what the fix is
44 tabularray
45 ninecolors
46 codehigh
47 catchfile
48 environ
49 ]
50 )
51 );
52in
53stdenv.mkDerivation (finalAttrs: {
54 pname = "rocdbgapi";
55 version = "6.3.3";
56
57 outputs = [
58 "out"
59 ]
60 ++ lib.optionals buildDocs [
61 "doc"
62 ];
63
64 src = fetchFromGitHub {
65 owner = "ROCm";
66 repo = "ROCdbgapi";
67 rev = "rocm-${finalAttrs.version}";
68 hash = "sha256-6itfBrWVspobU47aiJAOQoxT8chwrq9scRn0or3bXto=";
69 };
70
71 # FIXME: remove once https://github.com/doxygen/doxygen/issues/11634 is resolved
72 # Applies workaround based on what was suggested in
73 # https://github.com/doxygen/doxygen/issues/11634#issuecomment-3027000655,
74 # but rewritten to use the `tabularray` LaTeX package. Unfortunately,
75 # verbatim code snippets in the documentation are not formatted very nicely
76 # with this workaround.
77 postPatch = ''
78 substituteInPlace doc/Doxyfile.in --replace 'LATEX_EXTRA_STYLESHEET =' 'LATEX_EXTRA_STYLESHEET = ${./override_doxygen_tables.sty}'
79 '';
80
81 nativeBuildInputs = [
82 cmake
83 rocm-cmake
84 git
85 ]
86 ++ lib.optionals buildDocs [
87 latex
88 doxygen
89 graphviz
90 ];
91
92 buildInputs = [
93 rocm-comgr
94 rocm-runtime
95 hwdata
96 ];
97
98 cmakeFlags = [
99 "-DPCI_IDS_PATH=${hwdata}/share/hwdata"
100 # Manually define CMAKE_INSTALL_<DIR>
101 # See: https://github.com/NixOS/nixpkgs/pull/197838
102 "-DCMAKE_INSTALL_BINDIR=bin"
103 "-DCMAKE_INSTALL_LIBDIR=lib"
104 "-DCMAKE_INSTALL_INCLUDEDIR=include"
105 ];
106
107 # Unfortunately, it seems like we have to call make on this manually
108 postBuild = lib.optionalString buildDocs ''
109 export HOME=$(mktemp -d)
110 make -j$NIX_BUILD_CORES doc
111 '';
112
113 postInstall = lib.optionalString buildDocs ''
114 mv $out/share/html/amd-dbgapi $doc/share/doc/amd-dbgapi/html
115 rmdir $out/share/html
116 '';
117
118 passthru.updateScript = rocmUpdateScript {
119 name = finalAttrs.pname;
120 inherit (finalAttrs.src) owner;
121 inherit (finalAttrs.src) repo;
122 };
123
124 meta = with lib; {
125 description = "Debugger support for control of execution and inspection state";
126 homepage = "https://github.com/ROCm/ROCdbgapi";
127 license = with licenses; [ mit ];
128 teams = [ teams.rocm ];
129 platforms = platforms.linux;
130 };
131})