aboutsummaryrefslogtreecommitdiffstats
path: root/community/bcc/APKBUILD
blob: 74edd9901124d05e4e5d6e127cc83bc564a04a13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Contributor: Adam Jensen <adam@acj.sh>
# Maintainer: Adam Jensen <adam@acj.sh>
pkgname=bcc
pkgver=0.24.0
pkgrel=2
pkgdesc="A toolkit for creating efficient kernel tracing and manipulation programs"
url="https://github.com/iovisor/bcc/"
# s390x build fails
arch="all !s390x"
license="Apache-2.0"
_llvmver=14
makedepends="
	bison
	clang-dev
	cmake
	elfutils-dev
	flex-dev
	iperf
	libbpf-dev
	linux-headers
	llvm$_llvmver-dev
	llvm$_llvmver-static
	python3
	samurai
	zlib-dev
	"
subpackages="
	$pkgname-static
	$pkgname-dev
	$pkgname-doc
	$pkgname-tools
	py3-$pkgname:_py:noarch
	"
source="https://github.com/iovisor/bcc/archive/v$pkgver/$pkgname-$pkgver.tar.gz"

case "$CARCH" in
	ppc64le | riscv64) ;;
	*) makedepends="$makedepends luajit-dev"
	   subpackages="$subpackages $pkgname-lua:_lua"
	   ;;
esac

prepare() {
	rm -rf tests/* && touch tests/CMakeLists.txt
	rm -rf examples/* && touch examples/CMakeLists.txt

	default_prepare

	sed -i "s|^#!/usr/bin/python$|#!/usr/bin/python3|" \
		tools/*.py tools/*/*.py
}

build() {
	# use libbpf installed uapi headers as we need something
	# newer than linux-headers provides
	export CFLAGS="$CFLAGS -I/usr/include/bpf/uapi"
	export CXXFLAGS="$CXXFLAGS -I/usr/include/bpf/uapi"

	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
		-DCMAKE_USE_LIBBPF_PACKAGE=ON \
		-DENABLE_LLVM_SHARED=ON \
		-DPYTHON_CMD=python3 \
		-DREVISION="$pkgver"
	cmake --build build
}

check() {
	PYTHONPATH="$builddir/build/src/python/bcc-python3" \
		LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$builddir/build/src/cc" \
		python3 -c "import bcc"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

doc() {
	default_doc

	amove usr/share/bcc/man
	amove usr/share/bcc/tools/doc
}

tools() {
	pkgdesc="Command line tools for BPF Compiler Collection (BCC)"
	depends="py3-$pkgname=$pkgver-r$pkgrel"

	amove usr/share/bcc/tools
	amove usr/share/bcc/introspection
}

_py() {
	pkgdesc="Python3 bindings for BPF Compiler Collection (BCC)"
	depends="$pkgname=$pkgver-r$pkgrel python3"

	amove usr/lib/python3*
}

_lua() {
	pkgdesc="Standalone tool to run BCC tracers written in Lua"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove usr/bin/bcc-lua
}

sha512sums="
951672e3a8e5ad56eedf513477317ec3d3b4cf2d594bbfce20f3d19ddf7ce255e9dcfc69d9b05bb765a16e769c8e42d7c57071ddb86fb32437f527d3d25d19b6  bcc-0.24.0.tar.gz
"