From 0358dccc866a392512ddb15f9fee0e24e6bc837c Mon Sep 17 00:00:00 2001 From: John Soo Date: Sat, 13 Jun 2020 23:16:11 -0700 Subject: [PATCH 4/5] gnu: Add bcc. * gnu/packages/linux.scm (bcc): New variable. --- gnu/packages/linux.scm | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index f3eec978ec..0b8b08883a 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -97,6 +97,8 @@ #:use-module (gnu packages haskell-xyz) #:use-module (gnu packages libunwind) #:use-module (gnu packages libusb) + #:use-module (gnu packages llvm) + #:use-module (gnu packages lua) #:use-module (gnu packages man) #:use-module (gnu packages maths) #:use-module (gnu packages multiprecision) @@ -131,6 +133,7 @@ #:use-module (gnu packages rsync) #:use-module (gnu packages selinux) #:use-module (gnu packages swig) + #:use-module (gnu packages version-control) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system go) @@ -7211,3 +7214,65 @@ persistent over reboots.") 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))))) + +(define-public bcc + (let* ((ver "0.14.0") + (commit (string-append "v" ver)) + (revision "1")) + (package + (name "bcc") + (version (git-version ver revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/iovisor/bcc") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "08m21avzamr48qwshd4r5hlcckk1kvgrb1i6qw373b7la89jf5an")))) + (build-system cmake-build-system) + (inputs + `(;; TODO: package optional integrations + ;; ("arping" ,argping) + ;; ("netperf" ,netperf) + ;; ("iperf" ,iperf) or ("iperf3" ,iperf3) + ("bison" ,bison) + ("clang-toolchain" ,clang-toolchain) + ("flex" ,flex) + ;; FIXME: Timestamp some other way. + ("git" ,git) + ("libbpf" ,(package-source libbpf)) + ;; LibElf required but libelf does not contain + ;; archives, only object files. + ;; https://github.com/iovisor/bcc/issues/504 + ("elfutils" ,elfutils) + ("linux-libre-headers" ,linux-libre-headers) + ("luajit" ,luajit) + ("python-wrapper" ,python-wrapper))) + (arguments + `(;; Tests all require sudo and a "standard" file heirarchy + #:tests? #f + ;; LIBBPF_INCLUDE_DIR should work with the output of libbpf - + ;; i.e. ,libbpf instead of ,(package-source libbpf) in inputs + ;; but it seems there could be a bug + ;; #:configure-flags + ;; (list + ;; (string-append + ;; "-DLIBBPF_INCLUDE_DIR=" (assoc-ref %build-inputs "libbpf") "/include")) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'copy-libbpf + (lambda* (#:key inputs #:allow-other-keys) + (delete-file-recursively "src/cc/libbpf") + (copy-recursively (assoc-ref inputs "libbpf") "src/cc/libbpf")))))) + (home-page "https://github.com/iovisor/bcc") + (synopsis "Tools for BPF on Linux") + (description + "BCC is a toolkit for creating efficient kernel tracing and +manipulation programs, and includes several useful tools and examples. It +makes use of extended BPF (Berkeley Packet Filters), formally known as eBPF, a +new feature that was first added to Linux 3.15. Much of what BCC uses requires +Linux 4.1 and above.") + (license license:asl2.0)))) -- 2.26.2