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