From 6560dc2a5eedb3040bdd5fba8d8b6950b7a2b6d1 Mon Sep 17 00:00:00 2001 From: John Soo Date: Sat, 13 Jun 2020 14:53:50 -0700 Subject: [PATCH 1/5] gnu: Add libbpf. * gnu/packages/linux.scm (libbpf): New variable. --- gnu/packages/linux.scm | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index cadfd186a1..c0ac8f24bc 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -45,6 +45,7 @@ ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020 Brice Waegeneire ;;; Copyright © 2020 Morgan Smith +;;; Copyright © 2020 John Soo ;;; ;;; This file is part of GNU Guix. ;;; @@ -7139,3 +7140,48 @@ cache data store that is used by network file systems such as @code{AFS} and @code{NFS} to cache data locally on disk. The content of the cache is persistent over reboots.") (license license:gpl2+))) + +(define-public libbpf + (let* ((commit "6a1615c263b679c17ecb292fa897f159e826dc10")) + (package + (name "libbpf") + (version "0.0.8") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libbpf/libbpf") + (commit commit))) + (sha256 + (base32 + "02vbpg9v5sjcw7ihximy63cjmz82q5izkp91i44m1qp6qj5qn4sr")))) + (build-system gnu-build-system) + (inputs + `(("libelf" ,libelf) + ("pkg-config" ,pkg-config) + ("zlib" ,zlib))) + (arguments + `(#:tests? #f ; No tests + #:make-flags + (list + (string-append "PREFIX=''") + (string-append "DESTDIR=" (assoc-ref %outputs "out")) + (string-append + "CC=" (assoc-ref %build-inputs "gcc") "/bin/gcc")) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'pre-build + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "scripts/check-reallocarray.sh" + (("/bin/rm" rm) + (string-append (assoc-ref inputs "coreutils") rm))) + (chdir "src") + #t))))) + (home-page "https://github.com/libbpf/libbpf") + (synopsis "BPF CO-RE (Compile Once – Run Everywhere)") + (description + "Libbpf supports building BPF CO-RE-enabled applications, which, in +contrast to BCC, do not require Clang/LLVM runtime being deployed to target +servers and does not rely on kernel-devel headers being available.") + (license `(,license:lgpl2.1 ,license:bsd-2))))) -- 2.26.2