gnu: bcc: Update to 0.30.0, fixing build.

* gnu/packages/linux.scm (bcc): Update to 0.30.0.
[native-inputs]: Add zip.
[inputs] Remove labels.  Remove stale comment (our libelf package has a static
archive, but the build still fails using it).  Replace the libbpf source with
its binary package.  Replace clang-toolchain-9 with clang-15.  Add
bash-minimal.
[arguments]: Use gexps.
<configure-flags>: Add -DCMAKE_USE_LIBBPF_PACKAGE=ON.
<phases>: Remove copy-libbpf.

Change-Id: Ife0bec7802e7faa54689c0199bc2618ce6a39428
This commit is contained in:
Maxim Cournoyer 2024-06-22 22:18:26 -04:00
parent c5fc11488c
commit 08149c02bc
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -10021,7 +10021,7 @@ headers.")
(define-public bcc (define-public bcc
(package (package
(name "bcc") (name "bcc")
(version "0.24.0") (version "0.30.0")
(source (source
(origin (origin
(method git-fetch) (method git-fetch)
@ -10031,63 +10031,53 @@ headers.")
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"1i6xikkxf2nasfkqa91hjzdq0a88mgyzrvia4fi2i2v1d8pbmnp4")))) "0b5la0yn6x6ll73drnrm5v5yibbrzkvl86hqivkrmnpgy8cqn0cy"))))
(build-system cmake-build-system) (build-system cmake-build-system)
(native-inputs (native-inputs
(list bison flex)) (list bison
flex
(@ (gnu packages compression) zip)))
(inputs (inputs
`(("clang-toolchain" ,clang-toolchain-9) (list clang-15
("libbpf" ,(package-source libbpf)) elfutils
;; LibElf required but libelf does not contain luajit
;; archives, only object files. libbpf
;; https://github.com/iovisor/bcc/issues/504 python-wrapper))
("elfutils" ,elfutils)
("luajit" ,luajit)
("python-wrapper" ,python-wrapper)))
(arguments (arguments
`(;; Tests all require root permissions and a "standard" file hierarchy. (list
#:tests? #f ;; Tests all require root permissions and a "standard" file hierarchy.
#:configure-flags #:tests? #f
(let ((revision ,version)) #:configure-flags #~(list (string-append "-DREVISION=" #$version)
`(,(string-append "-DREVISION=" revision))) "-DCMAKE_USE_LIBBPF_PACKAGE=ON")
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
;; FIXME: Use "-DCMAKE_USE_LIBBPF_PACKAGE=ON". (add-after 'unpack 'substitute-libbc
(add-after 'unpack 'copy-libbpf (lambda _
(lambda* (#:key inputs #:allow-other-keys) (substitute* "src/python/bcc/libbcc.py"
(delete-file-recursively "src/cc/libbpf") (("(libbcc\\.so.*)\\b" _ libbcc)
(copy-recursively (string-append #$output "/lib/" libbcc)))))
(assoc-ref inputs "libbpf") "src/cc/libbpf"))) (add-after 'install 'wrap-tools
(add-after 'copy-libbpf 'substitute-libbc (lambda _
(lambda* (#:key outputs #:allow-other-keys) (use-modules (ice-9 textual-ports))
(substitute* "src/python/bcc/libbcc.py" (let* ((out #$output)
(("(libbcc\\.so.*)\\b" _ libbcc) (lib (string-append out "/lib"))
(string-append (tools (string-append out "/share/bcc/tools"))
(assoc-ref outputs "out") "/lib/" libbcc))))) (python-executable?
(add-after 'install 'wrap-tools (lambda (filename _)
(lambda* (#:key outputs #:allow-other-keys) (call-with-input-file filename
(use-modules (ice-9 textual-ports)) (lambda (port)
(let* ((out (assoc-ref outputs "out")) (string-contains (get-line port)
(lib (string-append out "/lib")) "/bin/python"))))))
(tools (string-append out "/share/bcc/tools")) (for-each (lambda (python-executable)
(python-executable? (format #t "Wrapping: ~A.~%" python-executable)
(lambda (filename _) (wrap-program python-executable
(call-with-input-file filename `("GUIX_PYTHONPATH" ":" prefix
(lambda (port) (,(string-append lib
(string-contains (get-line port) "/python"
"/bin/python")))))) #$(version-major+minor
(for-each (package-version python))
(lambda (python-executable) "/site-packages")))))
(format #t "Wrapping: ~A.~%" python-executable) (find-files tools python-executable?))))))))
(wrap-program python-executable
`("GUIX_PYTHONPATH" ":" prefix
(,(string-append lib
"/python"
,(version-major+minor
(package-version python))
"/site-packages")))))
(find-files tools python-executable?))
#t))))))
(home-page "https://github.com/iovisor/bcc") (home-page "https://github.com/iovisor/bcc")
(synopsis "Tools for BPF on Linux") (synopsis "Tools for BPF on Linux")
(description (description