unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Ryan Sundberg via Guix-patches via <guix-patches@gnu.org>
To: 60401@debbugs.gnu.org
Cc: Ryan Sundberg <ryan@arctype.co>
Subject: [bug#60401] [PATCH] gnu: bpftool: New package
Date: Thu, 29 Dec 2022 02:53:51 -0800	[thread overview]
Message-ID: <20221229105351.2318-1-ryan@arctype.co> (raw)

Provides a package for `bpftool` from the Linux kernel source.

* gnu/packages/linux.scm (bpftool): New variable
---
 gnu/packages/linux.scm | 53 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 568c2b6b92..2f625267dc 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>
@@ -9361,6 +9362,58 @@ (define-public bcc
 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)
+              (let* ((binutils* (assoc-ref inputs "binutils"))
+                     (ldflags (string-append "-I" (string-append binutils* "/include"))))
+                (invoke "make"
+                        "-C"
+                        "tools/bpf/bpftool"
+                        ,(string-append "CC=" (cc-for-target))
+                        ; We need to explicitly set the RUNPATH for these libraries
+                        (string-append "LDFLAGS=-Wl"
+                                       ",-rpath=" (assoc-ref inputs "elfutils") "/lib"
+                                       ",-rpath=" (assoc-ref inputs "libcap") "/lib"
+                                       ",-rpath=" (assoc-ref inputs "zlib") "/lib"))
+                #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" "tools/bpf/bpftool"
+                        "install")
+                #t))))))
+    (inputs
+      `(("elfutils", elfutils) ; Provides libelf
+        ("readline" ,readline)
+        ("libcap" ,libcap)
+        ("zlib" ,zlib)))
+    (native-inputs
+      `(("bison" ,bison)
+        ("python" ,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 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))))
+
 (define-public bpftrace
   (package
     (name "bpftrace")
-- 
2.37.2





             reply	other threads:[~2022-12-29 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 10:53 Ryan Sundberg via Guix-patches via [this message]
2023-04-07 15:36 ` bug#60401: [PATCH] gnu: bpftool: New package Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221229105351.2318-1-ryan@arctype.co \
    --to=guix-patches@gnu.org \
    --cc=60401@debbugs.gnu.org \
    --cc=ryan@arctype.co \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).