summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: add99534734684ba2ee30f68f6e55e81ca6e41a2 (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
# Maintainer: Tony Lambiris <tony@libpcap.net>

pkgname=cilium-git
pkgver=1.7.0rc4.r490.gb676c4c6c7
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
}


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

	install -m755 -d "${srcdir}/go/src/github.com/cilium/"
	ln -sf "${srcdir}/${pkgname}" "${srcdir}/go/src/github.com/cilium/cilium"
}

build() {
	cd "${srcdir}/go/src/github.com/cilium/cilium"
	export GOPATH="${srcdir}/go"

	echo "${pkgver}" > VERSION
	make PKG_BUILD=1 V=1 build
}

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

	make DESTDIR="${pkgdir}" PKG_BUILD=1 V=1 -i install
	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/"
}