+
+(define-public bcc
+ (package
+ (name "bcc")
+ (version "0.15.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/iovisor/bcc")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1d5j9zanffa1c7lpi5fcrdlx1n7hy86xl82fam2xqr0s41q4ipxw"))))
+ (build-system cmake-build-system)
+ (native-inputs
+ `(("bison" ,bison)
+ ("flex" ,flex)))
+ (inputs
+ `(("clang-toolchain" ,clang-toolchain)
+ ("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 root permissions and a "standard" file hierarchy.
+ #:tests? #f
+ #:configure-flags
+ (let ((revision ,version))
+ `(,(string-append "-DREVISION=" revision)))
+ #:phases
+ (modify-phases %standard-phases
+ ;; FIXME: Use "-DCMAKE_USE_LIBBPF_PACKAGE=ON".
+ (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")))
+ (add-after 'copy-libbpf 'substitute-libbc
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "src/python/bcc/libbcc.py"
+ (("(libbcc\\.so.*)\\b" _ libbcc)
+ (string-append
+ (assoc-ref outputs "out") "/lib/" libbcc)))))
+ (add-after 'install 'wrap-tools
+ (lambda* (#:key outputs #:allow-other-keys)
+ (use-modules (ice-9 textual-ports))
+ (let* ((out (assoc-ref outputs "out"))
+ (lib (string-append out "/lib"))
+ (tools (string-append out "/share/bcc/tools"))
+ (python-executable?
+ (lambda (filename _)
+ (call-with-input-file filename
+ (lambda (port)
+ (string-contains (get-line port)
+ "/bin/python"))))))
+ (for-each
+ (lambda (python-executable)
+ (format #t "Wrapping: ~A.~%" python-executable)
+ (wrap-program python-executable
+ `("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")
+ (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)))
+
+(define-public bpftrace
+ (package
+ (name "bpftrace")
+ (version "0.10.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/iovisor/bpftrace")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "023ardywbw5w8815j2ny9rrp2xlpxndqaa7v2njjm8109p7ilsdn"))
+ (patches (search-patches "bpftrace-disable-bfd-disasm.patch"))))
+ (build-system cmake-build-system)
+ (native-inputs
+ `(("bison" ,bison)
+ ("flex" ,flex)))
+ (inputs
+ `(("bcc" ,bcc)
+ ("clang-toolchain" ,clang-toolchain)
+ ("elfutils" ,elfutils)
+ ("libbpf" ,libbpf)
+ ("linux-libre-headers" ,linux-libre-headers)))
+ (arguments
+ `(#:tests? #f ;Tests require googletest sources.
+ #:configure-flags
+ '("-DBUILD_TESTING=OFF"
+ ;; FIXME: libbfd misses some link dependencies, when fixed, remove
+ ;; the associated patch.
+ "-DHAVE_BFD_DISASM=OFF")))
+ (home-page "https://github.com/iovisor/bpftrace")
+ (synopsis "High-level tracing language for Linux eBPF")
+ (description
+ "bpftrace is a high-level tracing language for Linux enhanced Berkeley
+Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses
+LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for
+interacting with the Linux BPF system, as well as existing Linux tracing
+capabilities: kernel dynamic tracing (kprobes), user-level dynamic
+tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk
+and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was
+created by Alastair Robertson.")
+ (license license:asl2.0)))
+
+(define-public ttyebus-linux-module
+ (let ((revision "0")
+ (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f"))
+ (package
+ (name "ttyebus-linux-module")
+ (version (git-version "1.5" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/eBUS/ttyebus.git")
+ (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f")))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1i66xjs9vln5cca6wx7aiiw7jihrlsk9hjdqyczp36fvm1b1bani"))))
+ (supported-systems '("armhf-linux" "aarch64-linux"))
+ (build-system linux-module-build-system)
+ (arguments
+ `(#:tests? #f))
+ (home-page "https://github.com/eBUS/ttyebus")
+ (synopsis "Low-latency Raspberry Pi UART driver")
+ (description "This package provides a Linux kernel module that will
+provide a serial device @code{/dev/ttyebus} with almost no latency upon
+receiving. It is dedicated to the PL011 UART of the Raspberry Pi.")
+ (license license:gpl3+))))