# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=slirp4netns
pkgver=1.2.3
pkgrel=0
pkgdesc="User-mode networking for unprivileged network namespaces"
url="https://github.com/rootless-containers/slirp4netns"
license="GPL-2.0-or-later"
arch="all"
options="!check" # flaky tests
makedepends="glib-dev libcap-dev libseccomp-dev libslirp-dev autoconf automake"
checkdepends="bash gzip jq iproute2 nmap-ncat"
install="$pkgname.post-install"
subpackages="$pkgname-doc"
source="https://github.com/rootless-containers/slirp4netns/archive/v$pkgver/slirp4netns-$pkgver.tar.gz
	modules-load.conf
	"

check() {
	# needs tun module loaded
	make check-TESTS
}

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure --prefix=/usr
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 "$srcdir"/modules-load.conf "$pkgdir"/usr/lib/modules-load.d/slirp4netns.conf
}

sha512sums="
2f3882c85c83089980880b761c806c571c22157d9c32f104f1c3d3fe8a53ef9ef485293ecd7951d1118f3d336b2fadbcc4dbc419c2f78a0b7744cdc7d9f73921  slirp4netns-1.2.3.tar.gz
871b650ff982be061532b4c5fe4812f41e6e2c58fc69b24f8a745f9a43389da44e742a69b0467b3c3d9e2b031af0728e20f10fa4584695c4f5ac87768a1fd34e  modules-load.conf
"
