void-packages/srcpkgs/bcc/template
Leah Neukirchen 85c4ba04cc bcc: link LLVM dynamically.
As a distro, we want this anyway, but static linking also broke, e.g.
bpftrace: https://github.com/iovisor/bpftrace/issues/1855
2021-08-06 15:28:44 +02:00

78 lines
2.7 KiB
Bash

# Template file for 'bcc'
pkgname=bcc
version=0.21.0
revision=4
wrksrc="bcc"
build_style=cmake
configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
hostmakedepends="flex python3"
makedepends="clang clang-tools-extra elfutils-devel flex lld-devel llvm
ncurses-devel python3-devel zlib-devel"
short_desc="BPF-based Linux IO analysis, networking, monitoring, and more"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="Apache-2.0"
homepage="https://github.com/iovisor/bcc"
# use a newer libbpf to fix compile issues on various targets
# you should be able to drop this for the next update
distfiles="https://github.com/iovisor/bcc/releases/download/v${version}/bcc-src-with-submodule.tar.gz>bcc-${version}.tar.gz
https://github.com/libbpf/libbpf/archive/506a544834573905ada61da8e00f54b04f0caf43.tar.gz"
checksum="5323e2a505f6868976d973a234202332ec25dc36f0bf7c118c23fc24f6147215
e1db8edc20997270a7d7c4d6e5d881abb941828601f113866ebb4073168c1f87"
python_version="3"
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
makedepends+=" libatomic-devel"
fi
post_extract() {
sed -i '/tests/d' CMakeLists.txt # break on musl
sed -i 's/<error.h>/<errno.h>/' examples/cpp/KModRetExample.cc
# use a newer libbpf with fixes
rm -rf src/cc/libbpf
mv ../libbpf* src/cc/libbpf
}
bcc-tools_package() {
short_desc+=" - tools"
depends="python3-bcc>=${version}_${revision}"
case "$XBPS_TARGET_MACHINE" in
# only add linux-headers for archs it's currently built for
i686*|x86_64*|ppc*|aarch64*) depends+=" linux-headers";;
esac
pkg_install() {
vmove usr/share/bcc/man/man8
mv ${PKGDESTDIR}/usr/share/bcc/man ${PKGDESTDIR}/usr/share/man
gunzip ${PKGDESTDIR}/usr/share/man/*/*.gz
vmkdir usr/share/doc
vmove usr/share/bcc/tools
mv ${PKGDESTDIR}/usr/share/bcc/tools/doc ${PKGDESTDIR}/usr/share/doc/bcc-tools
mv ${PKGDESTDIR}/usr/share/bcc/tools ${PKGDESTDIR}/usr/bin
rm -rf ${PKGDESTDIR}/usr/bin/old
mv ${PKGDESTDIR}/usr/bin/lib/* ${PKGDESTDIR}/usr/bin
rm -rf ${PKGDESTDIR}/usr/bin/lib
rm -f ${PKGDESTDIR}/usr/bin/*.c
vmove usr/share/bcc/introspection
vbin ${PKGDESTDIR}/usr/share/bcc/introspection/bps
rm -rf ${PKGDESTDIR}/usr/share/bcc/introspection
mv ${PKGDESTDIR}/usr/bin/trace ${PKGDESTDIR}/usr/bin/trace-bcc
mv ${PKGDESTDIR}/usr/share/man/man8/trace.8 ${PKGDESTDIR}/usr/share/man/man8/trace-bcc.8
}
}
bcc-devel_package() {
short_desc+=" - development files"
depends="${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove usr/include
vmove usr/lib/*.so
vmove usr/lib/pkgconfig
vmove usr/share/bcc/examples
}
}
python3-bcc_package() {
lib32disabled=yes
depends="python3"
short_desc+=" - Python 3 module"
depends="${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove "usr/lib/python*"
}
}