summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fa9082447b5533ab24faa6fd43cee47b147a6d08 (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
# Maintainer: Tony Lambiris <tony@criticalstack.com>

pkgname=cilium-git
pkgver=1.5.3.r775.g85d2e7f21
pkgrel=1
pkgdesc="API-aware Networking and Security for Containers based on BPF"
arch=('x86_64')
url="https://cilium.io/"
license=('Apache')
depends=('docker' 'iproute2' 'clang')
makedepends=('go' 'lib32-glibc' 'bazel' 'ninja' 'docker')
optdepends=('consul' 'etcd')
conflicts=()
source=("${pkgname}::git+https://github.com/cilium/cilium" "cilium.sysusers")
sha256sums=('SKIP'
            'f47ee5b436304aa55ffad29fd68e31be4b1261d3f81ba2a7a370e522705833e8')

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

	version=$(git tag -l --sort=-v:refname | sed 's/v\([^-].*\)/\1/g' | head -1)
	release=$(git describe --long --tags | sed 's/\([^-].*\)-\([0-9]*\)-\(g.*\)/r\2.\3/g')

	echo "${version}.${release}" | sed -re 's/-//g' # strip hyphen
}

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

	mkdir -p src/github.com/cilium
	ln -s ../../../ src/github.com/cilium/cilium

	mkdir -p vendor/src
	for v in vendor/*; do
		test -z "$v" -o "$v" = "vendor/src" && continue
		if test -d "$v"; then
			mv -fv "$v" vendor/src/
		fi
	done
	export GOPATH="$(pwd):$(pwd)/vendor"

	echo "${pkgver}" > VERSION

	export PKG_BUILD=1

	export CC="/usr/bin/gcc"
	export CXX="/usr/bin/g++"

	make -C daemon apply-bindata
	make V=1 proxylib bpf daemon cilium-health bugtool operator plugins tools

	cd envoy

	unset PKG_BUILD
	make BINDIR="${PWD}" install
}

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

	export PKG_BUILD=1

	make DESTDIR="${pkgdir}" install

	install -Dm755 envoy/cilium-envoy "${pkgdir}/usr/bin"

	install -Dm644 "$srcdir/cilium.sysusers" \
		"$pkgdir/usr/lib/sysusers.d/cilium.conf"

	install -m755 -d "${pkgdir}/usr/lib/systemd/system/"

	install -Dm644 "${srcdir}/${pkgname}/contrib/systemd/"*.{service,mount} \
		"${pkgdir}/usr/lib/systemd/system/"
}