1{ lib, stdenv, fetchgit, pkg-config, asciidoc, xmlto, docbook_xsl, docbook_xml_dtd_45, libxslt, libtraceevent, libtracefs, zstd, sourceHighlight }:
2stdenv.mkDerivation rec {
3 pname = "trace-cmd";
4 version = "3.1.2";
5
6 src = fetchgit {
7 url = "git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/";
8 rev = "trace-cmd-v${version}";
9 sha256 = "sha256-wxrMEE7ZgMHM59Rv6Gk3f0zdpULuXLnY0UY797YF1a0=";
10 };
11
12 # Don't build and install html documentation
13 postPatch = ''
14 sed -i -e '/^all:/ s/html//' -e '/^install:/ s/install-html//' \
15 Documentation{,/trace-cmd,/libtracecmd}/Makefile
16 '';
17
18 nativeBuildInputs = [ asciidoc libxslt pkg-config xmlto docbook_xsl docbook_xml_dtd_45 sourceHighlight ];
19
20 buildInputs = [ libtraceevent libtracefs zstd ];
21
22 outputs = [ "out" "lib" "dev" "man" ];
23
24 MANPAGE_DOCBOOK_XSL="${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl";
25
26 dontConfigure = true;
27
28 enableParallelBuilding = true;
29 makeFlags = [
30 # The following values appear in the generated .pc file
31 "prefix=${placeholder "lib"}"
32 ];
33
34 # We do not mention targets (like "doc") explicitly in makeFlags
35 # because the Makefile would not print warnings about too old
36 # libraries (see "warning:" in the Makefile)
37 postBuild = ''
38 make libs doc -j$NIX_BUILD_CORES
39 '';
40
41 installTargets = [
42 "install_cmd"
43 "install_libs"
44 "install_doc"
45 ];
46 installFlags = [
47 "LDCONFIG=false"
48 "bindir=${placeholder "out"}/bin"
49 "mandir=${placeholder "man"}/share/man"
50 "libdir=${placeholder "lib"}/lib"
51 "pkgconfig_dir=${placeholder "dev"}/lib/pkgconfig"
52 "includedir=${placeholder "dev"}/include"
53 "BASH_COMPLETE_DIR=${placeholder "out"}/share/bash-completion/completions"
54 ];
55
56 meta = with lib; {
57 description = "User-space tools for the Linux kernel ftrace subsystem";
58 homepage = "https://www.trace-cmd.org/";
59 license = with licenses; [ lgpl21Only gpl2Only ];
60 platforms = platforms.linux;
61 maintainers = with maintainers; [ thoughtpolice basvandijk ];
62 };
63}