archrelease: copy trunk to community-any
[ArchLinux/community.git] / cni-plugins / trunk / PKGBUILD
blobb7c4972dc2871432eed969b5c86ad2cef9573ab9
1 # Maintainer: Morten Linderud <foxboron@archlinux.org>
2 # Maintainer: David Runge <dvzrv@archlinux.org>
3 # Contributor: BartÅ‚omiej Piotrowski <bpiotrowski@archlinux.org>
5 _name=plugins
6 pkgname=cni-plugins
7 pkgver=1.3.0
8 pkgrel=1
9 pkgdesc='Some standard networking plugins, maintained by the CNI team'
10 arch=(x86_64)
11 url="https://github.com/containernetworking/plugins"
12 license=(Apache)
13 depends=(glibc)
14 makedepends=(go)
15 provides=(container-network-stack=1)
16 options=(
17   !lto  # unable to build with LTO: https://github.com/containernetworking/plugins/issues/706
18   emptydirs  # NOTE: we need /etc/cni/net.d/ for configs
20 source=($url/archive/v$pkgver/$_name-v$pkgver.tar.gz)
21 sha512sums=('87e186b3cd64f66280f5b2293dcdd1fc22cb8f51a248124fb622adc48a893348419ba4c29c4769dede4d9e60f2e9fea5d4198f10badb4ecd20a1551e0b344e10')
22 b2sums=('c5599f1d8ac3bffb802877ae8c49024a9dea1940923316e534397a8dc7e467f6fe3ceef514a41522611a8f06c4f4ba0788105081e68a4712e2eefade33226c7b')
24 prepare() {
25   mkdir -vp $_name-$pkgver/bin
28 build() {
29   cd $_name-$pkgver
31   export CGO_CPPFLAGS="${CPPFLAGS}"
32   export CGO_CFLAGS="${CFLAGS}"
33   export CGO_CXXFLAGS="${CXXFLAGS}"
34   export CGO_LDFLAGS="${LDFLAGS}"
35   export GOPATH="${srcdir}"
36   export GOFLAGS="-buildmode=pie -mod=readonly -modcacherw"
38   # custom go build calls, since build_linux.sh is not flexible enough
39   for plugin in plugins/meta/* plugins/main/* plugins/ipam/*; do
40     if [[ -d "$plugin"  && "$plugin" != *windows ]]; then
41       printf "Building plugin: %s\n" "$(basename $plugin)"
42       go build -o bin/ -ldflags "-compressdwarf=false -linkmode external" "./$plugin"
43     fi
44   done
47 # tests are broken
48 # check() {
49 #   cd $_name-$pkgver
50 #   go test ./...
51 # }
53 package() {
54   cd $_name-$pkgver
55   install -vDm755 bin/* -t "$pkgdir/usr/lib/cni/"
56   # strip files manually because makepkg doesn't do it: https://gitlab.archlinux.org/pacman/pacman/-/merge_requests/38
57   strip "$pkgdir/usr/lib/cni/"*
58   # some applications would build their own versions of CNI plugins in
59   # /opt/cni/bin if they are not found (as non-symlink files), so we have to
60   # install them twice... ;_;
61   install -vDm755 bin/* -t "$pkgdir/opt/cni/bin/"
62   install -vdm755 "$pkgdir/etc/cni/net.d/"
63   install -vDm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
64   install -vDm644 plugins/ipam/dhcp/systemd/* -t "$pkgdir/usr/lib/systemd/system/"