From 87104ca47671801f34848326a17f4eb453dc3c9a Mon Sep 17 00:00:00 2001 From: Ryan Sundberg Date: Sun, 6 Jun 2021 09:53:43 -0700 Subject: [PATCH] gnu: Add bpftool in sync with the Linux kernel version. * gnu/packages/linux.scm (bpftool): New variable Signed-off-by: Ryan Sundberg --- gnu/packages/linux.scm | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index c8ec310665..5d4d1669c2 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -54,6 +54,7 @@ ;;; Copyright © 2020 David Dashyan ;;; Copyright © 2020 pukkamustard ;;; Copyright © 2021 B. Wilson +;;; Copyright © 2021 Ryan Sundberg ;;; ;;; This file is part of GNU Guix. ;;; @@ -8108,3 +8109,48 @@ Availability and Serviceability} reports from Linux kernel trace events. These trace events are logged in @file{/sys/kernel/debug/tracing} and reported through standard log mechanisms like syslog.") (license license:gpl2))) + +(define-public bpftool + (package + (name "bpftool") + (version (package-version linux-libre)) + (source (package-source linux-libre)) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; This package has no tests. + #:phases + (modify-phases %standard-phases + (add-before 'configure 'chdir + (lambda _ (chdir "tools/bpf") #t)) + (delete 'configure) + (replace 'build + (lambda _ (invoke "make" + ,(string-append "CC=" (cc-for-target)) + "bpftool") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out"))) + (mkdir-p (string-append out "/sbin")) + (mkdir-p (string-append out "/share/bash-completion/completions")) + (invoke "make" + (string-append "prefix=" out) + (string-append "bash_compdir=" out + "/share/bash-completion/completions") + "-C" "bpftool" + "install") + #t)))))) + (inputs + `(("readline" ,readline) + ("libcap" ,libcap) + ("libelf" ,libelf) + ("zlib" ,zlib))) + (native-inputs + `(("bison" ,bison) + ("python" ,python-3))) + ; This tool does not have a proper web page. + (home-page "https://lwn.net/Articles/739357/") + (synopsis "Tool for inspection and simple manipulation of eBPF programs and maps") + (description "bpftool allows for inspection and simple modification of BPF +objects on the system.") + (license (package-license linux-libre)))) -- 2.31.1