# nftables - The Linux packet filter
# Generated from manifest.tsv by gen-ports.py. Edit the manifest, not this file,
# unless the package needs something the template cannot express - in which case
# drop a `recipe.local` beside it and it will be preserved.
name=nftables
version=1.1.5
release=1
desc="The Linux packet filter"
url="https://netfilter.org/projects/nftables/"
license="GPL-2.0-only"
depend="glibc libmnl libnftnl gmp-alt libedit"
makedepend=""
source="https://netfilter.org/projects/nftables/files/nftables-1.1.5.tar.xz"
sha256="SKIP"

build() {
	cd "nftables-1.1.5"
	# Not every configure script accepts the same options - sqlite rejects
	# --disable-nls outright, for instance - so only pass the ones this one
	# actually advertises. Guessing wrong fails the whole build.
	_opts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib"
	_help=$(./configure --help 2>/dev/null)
	case "$_help" in *--disable-static*)  _opts="$_opts --disable-static" ;; esac
	case "$_help" in *--disable-nls*)     _opts="$_opts --disable-nls" ;; esac
	# --with-cli=no, because configure looks for the symbol "readline" inside
	# -ledit and ScrapLinux's libedit does not ship that compatibility name, so it
	# stopped with "No suitable version of libedit found" and no firewall was
	# ever packaged. What this drops is `nft -i`, the interactive shell; the
	# rule language, the service and everything /etc/nftables.conf does are
	# unaffected, which is all an installed system uses.
	_opts="$_opts --with-cli=no"
	# shellcheck disable=SC2086
	./configure $_opts
	make -j"$JOBS"
}

package() {
	cd "nftables-1.1.5"
	make DESTDIR="$pkgdir" install
}
