summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 955a22ead81768908f7aede54a030ac8f275682f (plain)
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
# Maintainer: Gordian Edenhofer <gordian.edenhofer@gmail.com>
# Contributor: Omar Sandoval <osandov@osandov.com>
# Contributor: Troy Engel <troyengel+arch@gmail.com>
# Contributor: Manuel Mendez <mmendez534@gmail.com>

pkgbase=bcc-git
pkgname=('bcc-git' 'bcc-tools-git' 'python-bcc-git')
pkgver=0.11.0.dev0+r1564.g3d21000a
pkgrel=1
pkgdesc='BPF Compiler Collection - latest git code'
arch=('x86_64')
url='https://github.com/iovisor/bcc'
license=('Apache')
makedepends=('cmake' 'clang' 'llvm' 'flex' 'bison' 'python' 'git')
checkdepends=('netperf' 'iperf')
source=('bcc-git::git+https://github.com/iovisor/bcc')
sha256sums=('SKIP')

pkgver() {
	cd "${srcdir}/${pkgname}"
	( set -o pipefail
	git describe --long 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/dev0+r\1/;s/-/./g' \
	|| printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
	)
}

build() {
	cd "${srcdir}/${pkgname}"

	rm -rf build/
	mkdir -p build/
	cd build/

	export CFLAGS+=" -ffat-lto-objects"
	export CXXFLAGS+=" -ffat-lto-objects"

	# The python version is irrelevant at this stage
	cmake -DREVISION=$pkgver \
	  -DCMAKE_INSTALL_PREFIX=/usr \
	  -DCMAKE_INSTALL_LIBDIR=/usr/lib .. \
	  -DENABLE_LLVM_SHARED=1   # FS#71163

	make
}

package_bcc-git() {
	pkgdesc='BPF Compiler Collection - C library and examples - latest git code'
	depends=('clang' 'libelf')
	optdepends=('linux-headers: build modules against the Arch kernel'
		'linux-lts-headers: build modules against the LTS kernel'
		'linux-zen-headers: build modules against the ZEN kernel'
		'linux-hardened-headers: build modules against the HARDENED kernel'
		'bcc-tools: Python utilites using the BCC library'
		'python-bcc: Python 3 bindings for BCC')
	provides=("bcc=${pkgver}" "libbcc=${pkgver}")
	conflicts=('bcc' 'libbcc')

	cd "${srcdir}/${pkgbase}/build"

	# Install the kitchen sink
	make DESTDIR="${pkgdir}" install

	# These go in a split package python*-bcc-git
	rm -rf "${pkgdir}"/usr/lib/python*
	# These go in a split package bcc-tools-git
	rm -rf "${pkgdir}"/usr/share/bcc/{tools,man}
}

package_bcc-tools-git() {
	pkgdesc='BPF Compiler Collection - Tools - latest git code'
	arch=('any')
	depends=('bcc-git' 'libedit' 'ethtool')
	optdepends=('python-bcc-git: Python bindings for BCC'
		'luajit: Lua bindings for BCC')
	provides=("bcc-tools=${pkgver}")
	conflicts=('bcc-tools')

	cd "${srcdir}/${pkgbase}/build"

	make -C tools/ DESTDIR="${pkgdir}" install
	make -C man/ DESTDIR="${pkgdir}" install
}

package_python-bcc-git() {
	pkgdesc='BPF Compiler Collection - Python 3 bindings - latest git code'
	arch=('any')
	depends=('bcc-git' 'python')
	optdepends=('python-netaddr: Network address representation and manipulation'
		'python-pyroute2: Netlink and Linux network configuration')
	provides=("python-bcc=${pkgver}")
	conflicts=('python-bcc')

	cd "${srcdir}/${pkgbase}/build"

	# Force a quick python3 binding build (C library is already built)
	cmake -DREVISION="${pkgver}" \
		-DPYTHON_CMD="python" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib ..
	make -C src/python

	# Install just those bindings
	make -C src/python DESTDIR="${pkgdir}" install
}