summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorRyan Sundberg <ryan@arctype.co>2022-12-29 02:53:51 -0800
committerLudovic Courtès <ludo@gnu.org>2023-04-07 17:38:42 +0200
commit110dc3fde90de3b8f2c8dfe8d531c46d6f074145 (patch)
tree239987e84b85c2129bfe0cc456c01ab03df8879c /gnu
parent9635e45b1e1c8d3276b515f41e0ae4970edce378 (diff)
downloadguix-110dc3fde90de3b8f2c8dfe8d531c46d6f074145.tar.gz
gnu: Add bpftool.
* gnu/packages/linux.scm (bpftool): New variable.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/linux.scm39
1 files changed, 39 insertions, 0 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index cbbab25fe8..90dd9e5357 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -61,6 +61,7 @@
 ;;; Copyright © 2021 Olivier Dion <olivier.dion@polymtl.ca>
 ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
 ;;; Copyright © 2021, 2022 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
 ;;; Copyright © 2022 Artyom V. Poptsov <poptsov.artyom@gmail.com>
 ;;; Copyright © 2022 Rene Saavedra <nanuui@protonmail.com>
 ;;; Copyright © 2022 muradm <mail@muradm.net>
@@ -9466,6 +9467,44 @@ that was first added to Linux 3.15.  Much of what BCC uses requires Linux 4.1
 and above.")
     (license license:asl2.0)))
 
+(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
+                  (delete 'configure)
+                  (replace 'build
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (invoke "make" "-C" "tools/bpf/bpftool"
+                              ,(string-append "CC=" (cc-for-target)))))
+                  (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" "tools/bpf/bpftool"
+                                "install")))))))
+    (inputs (list elfutils                        ;provides libelf
+                  readline libcap zlib))
+    (native-inputs (list bison python-3))
+    ;; This tool does not have a proper web page.
+    (home-page
+     "https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/bpf/bpftool")
+    (synopsis "Tool for inspection and manipulation of eBPF programs and maps")
+    (description "@command{bpftool} allows for inspection and simple
+modification of BPF objects on the system.")
+    (license (package-license linux-libre))))
+
 (define-public bpftrace
   (package
     (name "bpftrace")