# Template file for 'nftables'
pkgname=nftables
version=1.1.1
revision=2
build_style=gnu-configure
configure_args="--sbindir=/usr/bin --with-json
 --with-python-bin=/bin/python3 --with-cli=readline"
hostmakedepends="asciidoc automake docbook2x flex libtool pkg-config
 python3 python3-build python3-installer python3-wheel"
makedepends="gmp-devel jansson-devel libmnl-devel libnftnl-devel readline-devel"
short_desc="Netfilter nftables userspace tools"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="GPL-2.0-only"
homepage="http://netfilter.org/projects/nftables/"
distfiles="http://www.netfilter.org/projects/${pkgname}/files/${pkgname}-${version}.tar.xz"
checksum=6358830f3a64f31e39b0ad421d7dadcd240b72343ded48d8ef13b8faf204865a

post_extract() {
	autoreconf -fi
}

post_build() {
        (
		cd py
                python -m build --no-isolation --wheel
	)
}

post_install() {
        (
		cd py
		python -m installer --destdir ${DESTDIR} --no-compile-bytecode dist/*.whl
	)
	vsv nftables
}

libnftables_package() {
	short_desc+=" - runtime libraries"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

libnftables-devel_package() {
	depends="libnftables-${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		vmove usr/share/man/man3
	}
}
