# Maintainer: Morten Linderud # Maintainer: David Runge # Contributor: Bartłomiej Piotrowski _name=plugins pkgname=cni-plugins pkgver=1.3.0 pkgrel=1 pkgdesc='Some standard networking plugins, maintained by the CNI team' arch=(x86_64) url="https://github.com/containernetworking/plugins" license=(Apache) depends=(glibc) makedepends=(go) provides=(container-network-stack=1) options=( !lto # unable to build with LTO: https://github.com/containernetworking/plugins/issues/706 emptydirs # NOTE: we need /etc/cni/net.d/ for configs ) source=($url/archive/v$pkgver/$_name-v$pkgver.tar.gz) sha512sums=('87e186b3cd64f66280f5b2293dcdd1fc22cb8f51a248124fb622adc48a893348419ba4c29c4769dede4d9e60f2e9fea5d4198f10badb4ecd20a1551e0b344e10') b2sums=('c5599f1d8ac3bffb802877ae8c49024a9dea1940923316e534397a8dc7e467f6fe3ceef514a41522611a8f06c4f4ba0788105081e68a4712e2eefade33226c7b') prepare() { mkdir -vp $_name-$pkgver/bin } build() { cd $_name-$pkgver export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" export GOPATH="${srcdir}" export GOFLAGS="-buildmode=pie -mod=readonly -modcacherw" # custom go build calls, since build_linux.sh is not flexible enough for plugin in plugins/meta/* plugins/main/* plugins/ipam/*; do if [[ -d "$plugin" && "$plugin" != *windows ]]; then printf "Building plugin: %s\n" "$(basename $plugin)" go build -o bin/ -ldflags "-compressdwarf=false -linkmode external" "./$plugin" fi done } # tests are broken # check() { # cd $_name-$pkgver # go test ./... # } package() { cd $_name-$pkgver install -vDm755 bin/* -t "$pkgdir/usr/lib/cni/" # strip files manually because makepkg doesn't do it: https://gitlab.archlinux.org/pacman/pacman/-/merge_requests/38 strip "$pkgdir/usr/lib/cni/"* # some applications would build their own versions of CNI plugins in # /opt/cni/bin if they are not found (as non-symlink files), so we have to # install them twice... ;_; install -vDm755 bin/* -t "$pkgdir/opt/cni/bin/" install -vdm755 "$pkgdir/etc/cni/net.d/" install -vDm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/" install -vDm644 plugins/ipam/dhcp/systemd/* -t "$pkgdir/usr/lib/systemd/system/" }