1{
2 lib,
3 stdenv,
4 fetchzip,
5 pkg-config,
6 asciidoc,
7 xmlto,
8 docbook_xsl,
9 docbook_xml_dtd_45,
10 libxslt,
11 libtraceevent,
12 libtracefs,
13 zstd,
14 sourceHighlight,
15 gitUpdater,
16}:
17stdenv.mkDerivation rec {
18 pname = "trace-cmd";
19 version = "3.3.3";
20
21 src = fetchzip {
22 url = "https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/snapshot/trace-cmd-v${version}.tar.gz";
23 hash = "sha256-B3bwHV+f6IuoNESz5B4ij5KsIcCcpUPmoSnJeJj0J0Y=";
24 };
25
26 # Don't build and install html documentation
27 postPatch = ''
28 sed -i -e '/^all:/ s/html//' -e '/^install:/ s/install-html//' \
29 Documentation{,/trace-cmd,/libtracecmd}/Makefile
30 patchShebangs check-manpages.sh
31 '';
32
33 nativeBuildInputs = [
34 asciidoc
35 libxslt
36 pkg-config
37 xmlto
38 docbook_xsl
39 docbook_xml_dtd_45
40 sourceHighlight
41 ];
42
43 buildInputs = [
44 libtraceevent
45 libtracefs
46 zstd
47 ];
48
49 outputs = [
50 "out"
51 "lib"
52 "dev"
53 "man"
54 "devman"
55 ];
56
57 MANPAGE_DOCBOOK_XSL = "${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl";
58
59 dontConfigure = true;
60
61 enableParallelBuilding = true;
62 makeFlags = [
63 # The following values appear in the generated .pc file
64 "prefix=${placeholder "lib"}"
65 ];
66
67 # We do not mention targets (like "doc") explicitly in makeFlags
68 # because the Makefile would not print warnings about too old
69 # libraries (see "warning:" in the Makefile)
70 postBuild = ''
71 make libs doc -j$NIX_BUILD_CORES
72 '';
73
74 installTargets = [
75 "install_cmd"
76 "install_libs"
77 "install_doc"
78 ];
79 installFlags = [
80 "LDCONFIG=false"
81 "bindir=${placeholder "out"}/bin"
82 "mandir=${placeholder "man"}/share/man"
83 "libdir=${placeholder "lib"}/lib"
84 "pkgconfig_dir=${placeholder "dev"}/lib/pkgconfig"
85 "includedir=${placeholder "dev"}/include"
86 "completion_dir=${placeholder "out"}/share/bash-completion/completions"
87 ];
88
89 passthru.updateScript = gitUpdater {
90 # No nicer place to find latest release.
91 url = "https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git";
92 rev-prefix = "trace-cmd-v";
93 };
94
95 meta = with lib; {
96 description = "User-space tools for the Linux kernel ftrace subsystem";
97 mainProgram = "trace-cmd";
98 homepage = "https://www.trace-cmd.org/";
99 license = with licenses; [
100 lgpl21Only
101 gpl2Only
102 ];
103 platforms = platforms.linux;
104 maintainers = with maintainers; [
105 thoughtpolice
106 basvandijk
107 wentasah
108 ];
109 };
110}