From dbb0d2e3ab9685945b444822ff5872b17753f1d3 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 12 Sep 2021 15:29:21 +0200 Subject: [PATCH 1/5] maintainers: add wentasah --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index df80e577b2b0..e27a8a1d85ff 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -12077,6 +12077,12 @@ fingerprint = "2145 955E 3F5E 0C95 3458 41B5 11F7 BAEA 8567 43FF"; }]; }; + wentasah = { + name = "Michal Sojka"; + email = "wsh@2x.cz"; + github = "wentasah"; + githubId = 140542; + }; wheelsandmetal = { email = "jakob@schmutz.co.uk"; github = "wheelsandmetal"; From 12aa20319323106838f45a2efb715af9b98137f0 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 12 Sep 2021 15:22:16 +0200 Subject: [PATCH 2/5] libtraceevent: init at 1.4.0 This library is needed for recent versions of kernelshark. --- .../linux/libtraceevent/default.nix | 37 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 39 insertions(+) create mode 100644 pkgs/os-specific/linux/libtraceevent/default.nix diff --git a/pkgs/os-specific/linux/libtraceevent/default.nix b/pkgs/os-specific/linux/libtraceevent/default.nix new file mode 100644 index 000000000000..f28462652e08 --- /dev/null +++ b/pkgs/os-specific/linux/libtraceevent/default.nix @@ -0,0 +1,37 @@ +{ lib, stdenv, fetchgit, pkg-config, asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl }: + +stdenv.mkDerivation rec { + pname = "libtraceevent"; + version = "1.4.0"; + + src = fetchgit { + url = "git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git"; + rev = "libtraceevent-${version}"; + sha256 = "1x36qsrcssjywjpwkgyp9hz6y878kivma9pz7zrhxdsrqv2d2zs1"; + }; + + # Don't build and install html documentation + postPatch = '' + sed -i -e '/^all:/ s/html//' -e '/^install:/ s/install-html//' Documentation/Makefile + ''; + + outputs = [ "out" "dev" "devman" ]; + enableParallelBuilding = true; + nativeBuildInputs = [ pkg-config asciidoc xmlto docbook_xml_dtd_45 docbook_xsl ]; + makeFlags = [ + "prefix=${placeholder "out"}" + "doc" # build docs + ]; + installFlags = [ + "pkgconfig_dir=${placeholder "out"}/lib/pkgconfig" + "doc-install" + ]; + + meta = with lib; { + description = "Linux kernel trace event library"; + homepage = "https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/"; + license = licenses.lgpl21Only; + platforms = platforms.linux; + maintainers = with maintainers; [ wentasah ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cdc5641010d7..5650cf6983cb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21859,6 +21859,8 @@ with pkgs; libnl = callPackage ../os-specific/linux/libnl { }; + libtraceevent = callPackage ../os-specific/linux/libtraceevent {}; + lieer = callPackage ../applications/networking/lieer {}; linuxConsoleTools = callPackage ../os-specific/linux/consoletools { }; From b068cd2e1479a9ff4e3567e11edbf06b2e1ea6c5 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 12 Sep 2021 16:56:45 +0200 Subject: [PATCH 3/5] libtracefs: init at 1.2.5 This library is needed for recent versions of kernelshark. --- pkgs/os-specific/linux/libtracefs/default.nix | 38 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 40 insertions(+) create mode 100644 pkgs/os-specific/linux/libtracefs/default.nix diff --git a/pkgs/os-specific/linux/libtracefs/default.nix b/pkgs/os-specific/linux/libtracefs/default.nix new file mode 100644 index 000000000000..f3f1a393973d --- /dev/null +++ b/pkgs/os-specific/linux/libtracefs/default.nix @@ -0,0 +1,38 @@ +{ lib, stdenv, fetchgit, pkg-config, libtraceevent, asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl }: + +stdenv.mkDerivation rec { + pname = "libtracefs"; + version = "1.2.5"; + + src = fetchgit { + url = "git://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git"; + rev = "libtracefs-${version}"; + sha256 = "1rva9ysspf1wqd0zf52qwgpaasrn7jcbns4dwldc59ksk0n93qdb"; + }; + + # Don't build and install html documentation + postPatch = '' + sed -i -e '/^all:/ s/html//' -e '/^install:/ s/install-html//' Documentation/Makefile + ''; + + outputs = [ "out" "dev" "devman" ]; + enableParallelBuilding = true; + nativeBuildInputs = [ pkg-config asciidoc xmlto docbook_xml_dtd_45 docbook_xsl ]; + buildInputs = [ libtraceevent ]; + makeFlags = [ + "prefix=${placeholder "out"}" + "doc" # build docs + ]; + installFlags = [ + "pkgconfig_dir=${placeholder "out"}/lib/pkgconfig" + "install_doc" + ]; + + meta = with lib; { + description = "Linux kernel trace file system library"; + homepage = "https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/"; + license = licenses.lgpl21Only; + platforms = platforms.linux; + maintainers = with maintainers; [ wentasah ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5650cf6983cb..c31c5b66af3c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21861,6 +21861,8 @@ with pkgs; libtraceevent = callPackage ../os-specific/linux/libtraceevent {}; + libtracefs = callPackage ../os-specific/linux/libtracefs {}; + lieer = callPackage ../applications/networking/lieer {}; linuxConsoleTools = callPackage ../os-specific/linux/consoletools { }; From 3d249d1d49c6eb35d14f812ee40a6cbb6b8aa7b3 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 12 Sep 2021 20:28:46 +0200 Subject: [PATCH 4/5] trace-cmd: 2.9.1 -> 2.9.5 Besides updating trace-cmd, this commit also switches from bundled libtraceevent and libtracefs to their external sources. Upstream copied those libraries to separate repositories (see https://lore.kernel.org/linux-trace-devel/20210325172357.6e059c31@gandalf.local.home/). Another change relates to documentation building, which upstream reworked. We disable HTML documentation - previous versions did not provide it too. Finally, we enable parallel build, which is simpler if `buildPhase` is not overridden. --- pkgs/os-specific/linux/trace-cmd/default.nix | 28 +++++++++++---- .../linux/trace-cmd/fix-Makefiles.patch | 35 ------------------- 2 files changed, 21 insertions(+), 42 deletions(-) delete mode 100644 pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch diff --git a/pkgs/os-specific/linux/trace-cmd/default.nix b/pkgs/os-specific/linux/trace-cmd/default.nix index 0a7860c0238e..129ec31223c7 100644 --- a/pkgs/os-specific/linux/trace-cmd/default.nix +++ b/pkgs/os-specific/linux/trace-cmd/default.nix @@ -1,17 +1,23 @@ -{ lib, stdenv, fetchgit, asciidoc, docbook_xsl, libxslt }: +{ lib, stdenv, fetchgit, pkg-config, asciidoc, xmlto, docbook_xsl, libxslt, libtraceevent, libtracefs }: stdenv.mkDerivation rec { pname = "trace-cmd"; - version = "2.9.1"; + version = "2.9.5"; src = fetchgit { url = "git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/"; rev = "trace-cmd-v${version}"; - sha256 = "19c63a0qmcppm1456qf4k6a0d1agcvpa6jnbzrdcyc520yax6khw"; + sha256 = "0kc5cldk5i7q2zr2nyz3mvs5v7w0km6lpx7g39sy3pmhshp0wqlq"; }; - patches = [ ./fix-Makefiles.patch ]; + # Don't build and install html documentation + postPatch = '' + sed -i -e '/^all:/ s/html//' -e '/^install:/ s/install-html//' \ + Documentation{,/trace-cmd,/libtracecmd}/Makefile + ''; - nativeBuildInputs = [ asciidoc libxslt ]; + nativeBuildInputs = [ asciidoc libxslt pkg-config xmlto ]; + + buildInputs = [ libtraceevent libtracefs ]; outputs = [ "out" "lib" "dev" "man" ]; @@ -19,20 +25,28 @@ stdenv.mkDerivation rec { dontConfigure = true; - buildPhase = "make trace-cmd libs doc"; + enableParallelBuilding = true; + makeFlags = [ + "all" "libs" "doc" + # The following values appear in the generated .pc file + "prefix=${placeholder "lib"}" + "libdir=${placeholder "lib"}/lib" + "includedir=${placeholder "dev"}/include" + ]; installTargets = [ "install_cmd" "install_libs" "install_doc" ]; installFlags = [ "bindir=${placeholder "out"}/bin" "man_dir=${placeholder "man"}/share/man" "libdir=${placeholder "lib"}/lib" + "pkgconfig_dir=${placeholder "lib"}/lib/pkgconfig" "includedir=${placeholder "dev"}/include" "BASH_COMPLETE_DIR=${placeholder "out"}/share/bash-completion/completions" ]; meta = with lib; { description = "User-space tools for the Linux kernel ftrace subsystem"; - homepage = "https://kernelshark.org/"; + homepage = "https://www.trace-cmd.org/"; license = licenses.gpl2; platforms = platforms.linux; maintainers = with maintainers; [ thoughtpolice basvandijk ]; diff --git a/pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch b/pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch deleted file mode 100644 index 1e783999af68..000000000000 --- a/pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/Makefile b/Makefile -index b034042..b8a06bc 100644 ---- a/Makefile -+++ b/Makefile -@@ -338,6 +338,7 @@ libtracefs.a: $(LIBTRACEFS_STATIC) - libtracefs.so: $(LIBTRACEFS_SHARED) - - libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) $(LIBTRACEFS_SHARED) -+libs: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) $(LIBTRACEFS_STATIC) - - test: force $(LIBTRACEEVENT_STATIC) $(LIBTRACEFS_STATIC) $(LIBTRACECMD_STATIC) - ifneq ($(CUNIT_INSTALLED),1) -@@ -414,6 +415,9 @@ install_libs: libs - $(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)/trace-cmd) - $(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)/traceevent) - $(Q)$(call do_install,$(LIBTRACEFS_SHARED),$(libdir_SQ)/tracefs) -+ $(Q)$(call do_install,$(LIBTRACECMD_STATIC),$(libdir_SQ)/trace-cmd) -+ $(Q)$(call do_install,$(LIBTRACEEVENT_STATIC),$(libdir_SQ)/traceevent) -+ $(Q)$(call do_install,$(LIBTRACEFS_STATIC),$(libdir_SQ)/tracefs) - $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)/traceevent) - $(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent) - $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd) -diff --git a/kernel-shark/src/CMakeLists.txt b/kernel-shark/src/CMakeLists.txt -index 457c100..687e150 100644 ---- a/kernel-shark/src/CMakeLists.txt -+++ b/kernel-shark/src/CMakeLists.txt -@@ -92,7 +92,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND) - DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME}) - - install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy" -- DESTINATION /usr/share/polkit-1/actions/) -+ DESTINATION ${_INSTALL_PREFIX}/share/polkit-1/actions/) - - install(PROGRAMS "${KS_DIR}/bin/kshark-su-record" - DESTINATION ${_INSTALL_PREFIX}/bin/) From 393fc1f7ee8204aa335e57e4b8bea9dccf24d4ee Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 12 Sep 2021 23:11:02 +0200 Subject: [PATCH 5/5] kernelshark: 1.2 -> 2.0.2 Relevant upstream changes: - Sources were moved from trace-cmd repository to a new repository. - Makefile for building documentation is broken. Therefore, we don't build documentation. After upstream fixes it, we can build it again. --- .../linux/trace-cmd/kernelshark.nix | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/pkgs/os-specific/linux/trace-cmd/kernelshark.nix b/pkgs/os-specific/linux/trace-cmd/kernelshark.nix index 45d984c78632..4d0412edbeee 100644 --- a/pkgs/os-specific/linux/trace-cmd/kernelshark.nix +++ b/pkgs/os-specific/linux/trace-cmd/kernelshark.nix @@ -1,40 +1,31 @@ -{ lib, mkDerivation, fetchgit, qtbase, cmake, asciidoc, docbook_xsl, json_c, mesa_glu, freeglut, trace-cmd, pkg-config }: +{ lib, mkDerivation, fetchgit, qtbase, cmake, asciidoc +, docbook_xsl, json_c, mesa_glu, freeglut, trace-cmd, pkg-config +, libtraceevent, libtracefs, freefont_ttf +}: + mkDerivation rec { pname = "kernelshark"; - version = "1.2"; + version = "2.0.2"; src = fetchgit { - url = "git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/"; - rev = "kernelshark-v${version}"; - sha256 = "0wzzm2imk9n94v96v6sbvbff6j47lz4qj0snhiyv3nj3slg0anvh"; + url = "https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/"; + rev = "kernelshark-v${version}"; + sha256 = "0vy5wa1kccrxr973l870jy5hl6lac7sk3zyg3hxrwmivin1yf0cv"; }; - patches = [ ./fix-Makefiles.patch ]; + outputs = [ "out" ]; - outputs = [ "out" "doc" ]; + nativeBuildInputs = [ pkg-config cmake ]; - preConfigure = "pushd kernel-shark"; - - nativeBuildInputs = [ pkg-config cmake asciidoc ]; - - buildInputs = [ qtbase json_c mesa_glu freeglut ]; + buildInputs = [ qtbase json_c mesa_glu freeglut libtraceevent libtracefs trace-cmd ]; cmakeFlags = [ "-D_INSTALL_PREFIX=${placeholder "out"}" - "-DTRACECMD_BIN_DIR=${trace-cmd}/bin" - "-DTRACECMD_INCLUDE_DIR=${trace-cmd.dev}/include" - "-DTRACECMD_LIBRARY=${trace-cmd.lib}/lib/trace-cmd/libtracecmd.a" - "-DTRACEEVENT_LIBRARY=${trace-cmd.lib}/lib/traceevent/libtraceevent.a" - "-DTRACEFS_LIBRARY=${trace-cmd.lib}/lib/tracefs/libtracefs.a" + "-D_POLKIT_INSTALL_PREFIX=${placeholder "out"}" + "-DPKG_CONGIG_DIR=${placeholder "out"}/lib/pkgconfig" + "-DTT_FONT_FILE=${freefont_ttf}/share/fonts/truetype/FreeSans.ttf" ]; - preInstall = '' - popd - make install_doc_gui prefix=$doc \ - FIND_MANPAGE_DOCBOOK_XSL=${docbook_xsl}/share/xml/docbook-xsl-nons/manpages/docbook.xsl - pushd kernel-shark/build - ''; - meta = with lib; { description = "GUI for trace-cmd which is an interface for the Linux kernel ftrace subsystem"; homepage = "https://kernelshark.org/";