# Template file for 'fastd'
pkgname=fastd
version=18
revision=4
build_style=cmake
hostmakedepends="pkg-config bison"
makedepends="libuecc-devel libsodium-devel json-c-devel libcap-devel"
short_desc="Fast and Secure Tunneling Daemon"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="BSD"
homepage="https://projects.universe-factory.net/projects/fastd"
distfiles="https://git.universe-factory.net/fastd/snapshot/fastd-${version}.tar"
checksum=dce99ee057f43e3d732a120fb0cb60acb3b86e8231d3dd64ab72fc1254c2491a
configure_args="ENABLE_LTO=ON -DWITH_CIPHER_AES128_CTR_NACL=OFF"
conf_files="
 /etc/fastd/secret.conf
 /etc/fastd/fastd.conf"
make_dirs="/etc/fastd/peers	755	root 	root"
CFLAGS="-I$XBPS_CROSS_BASE/usr/include/sodium"

pre_configure() {
	# remove ssse3 requirement to support older AMD CPUs.
	printf "" > src/crypto/mac/ghash/pclmulqdq/CMakeLists.txt
}

post_install() {
	vmkdir etc/fastd
	vinstall ${FILESDIR}/fastd.conf 644 etc/fastd
	vinstall ${FILESDIR}/secret.conf 600 etc/fastd
	vsv fastd
	vman doc/fastd.1
	vlicense COPYRIGHT
}
