aboutsummaryrefslogtreecommitdiffstats
path: root/community/bpftrace/APKBUILD
blob: 581e9b526b6474d44e8453f98d7f392511135679 (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
# Contributor: Konstantin Kulikov <k.kulikov2@gmail.com>
# Maintainer: Adam Jensen <acjensen@gmail.com>
pkgname=bpftrace
pkgver=0.11.4
pkgrel=0
_llvmver=10
pkgdesc="High-level tracing language for Linux eBPF"
url="https://github.com/iovisor/bpftrace"
arch="aarch64 ppc64le x86_64"
license="Apache-2.0"
makedepends="cmake llvm$_llvmver-dev llvm$_llvmver-static clang-dev clang-static
	flex-dev bison elfutils-dev linux-headers bcc-dev binutils-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/iovisor/bpftrace/archive/v$pkgver.tar.gz"
# Tests require root, network to download gmock and a few tests fail.
options="!check"
subpackages="$pkgname-doc:doc $pkgname-tools:tools:noarch $pkgname-tools-doc:tools_doc"

build() {
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DBUILD_TESTING:BOOL=OFF \
		-DLLVM_REQUESTED_VERSION=$_llvmver
	make -C build
}

# Main package contains only bpftrace binary.
package() {
	make -C build DESTDIR="$pkgdir" install

	mv "$pkgdir/usr/share/bpftrace/tools/doc" "$pkgdir/usr/share/bpftrace/tools_doc"
}

# Doc package should contain only man page for bpftrace.
doc() {
	mkdir -p "$subpkgdir/usr/share/man/man8"
	mv "$pkgdir/usr/share/man/man8/bpftrace.8.gz" "$subpkgdir/usr/share/man/man8/"
}

# Tools are not installed in PATH, because they would conflict with other tools provided by bcc or perf-tools.
tools() {
	depends="$pkgname"
	pkgdesc="$pkgdesc (tools)"
	mkdir -p "$subpkgdir/usr/share/bpftrace"
	mv "$pkgdir/usr/share/bpftrace/tools" "$subpkgdir/usr/share/bpftrace/tools"
}

# Tools docs contains man pages and examples for tools. They shouldn't go into shared MANPATH for the same reasons as tools pkg above.
tools_doc() {
	pkgdesc="$pkgdesc (tool docs and examples)"

	mkdir -p "$subpkgdir/usr/share/bpftrace"
	mv "$pkgdir/usr/share/bpftrace/tools_doc" "$subpkgdir/usr/share/bpftrace/doc"
	mv "$pkgdir/usr/share/man/man8" "$subpkgdir/usr/share/bpftrace/"
}

sha512sums="611a7e61dbd1f4cc52b7e51a1a143296ff7b2df115b3a28034c674d8eefb5d482cac551ab82d6b7cc2f6fc0668b07d2d9e283dff371fd9a3f649c80113fdca82  bpftrace-0.11.4.tar.gz"