# Contributor: Mira Ressel <aranea@aixah.de>
# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
pkgname=wireguard-tools
pkgver=1.0.20210424
pkgrel=0
pkgdesc="Userland tools for the WireGuard VPN"
url="https://www.wireguard.com/"
arch="all"
options="!check" # no test suite
license="GPL-2.0-only"
depends="bash iproute2"
makedepends="libmnl-dev"
subpackages="$pkgname-bash-completion:bashcomp:noarch $pkgname-doc"
source="https://git.zx2c4.com/$pkgname/snapshot/$pkgname-$pkgver.tar.xz"

build() {
	make RUNSTATEDIR=/run -C src
}

package() {
	make WITH_BASHCOMPLETION=yes WITH_WGQUICK=yes DESTDIR="$pkgdir" -C src install
}

bashcomp() {
	depends="$pkgname"
	pkgdesc="$pkgdesc (Bash completion)"

	mkdir -p "$subpkgdir/usr/share"
	mv "$pkgdir/usr/share/bash-completion" "$subpkgdir/usr/share/"
}

sha512sums="b919c7ce1e8ee8660ccc1490d3dad7817f3d6f0ab79f26866e8ed10d40545a9ddca67959ff6cc84ac36a91683c1f58d274d91d47f40c0b9a7bfee4009dcbbf59  wireguard-tools-1.0.20210424.tar.xz"