# Template file for 'gnutls'
pkgname=gnutls
version=3.8.5
revision=1
build_style=gnu-configure
configure_args="--disable-static --disable-valgrind-tests
 --disable-rpath
 --with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt
 --with-trousers-lib=${XBPS_CROSS_BASE}/usr/lib"
hostmakedepends="gettext libtool pkg-config which"
# dependencies listed in pkg-config files
_develdepends="unbound-devel trousers-devel libunistring-devel nettle-devel
 libtasn1-devel libidn2-devel p11-kit-devel brotli-devel libzstd-devel
 zlib-devel"
makedepends="lzo-devel readline-devel libgpg-error-devel
 libgcrypt-devel ${_develdepends}"
checkdepends="iproute2"
short_desc="GNU Transport Layer Security library"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-only, LGPL-2.1-or-later"
homepage="https://gnutls.org"
changelog="https://gitlab.com/gnutls/gnutls/-/raw/master/NEWS"
distfiles="https://www.gnupg.org/ftp/gcrypt/gnutls/v${version%.*}/gnutls-${version}.tar.xz"
checksum=66269a2cfe0e1c2dabec87bdbbd8ab656f396edd9a40dd006978e003cfa52bfc
# same as $PASS in tests/cert-tests/certtool.sh
make_check_pre="env GNUTLS_PIN=1234"

if [ "$XBPS_CHECK_PKGS" ]; then
	configure_args+=" --enable-tests"
else
	configure_args+=" --disable-tests"
fi

post_install() {
	rm -rf ${DESTDIR}/usr/share/doc
}

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

gnutls-tools_package() {
	short_desc+=" - bundled tools"
	pkg_install() {
		vmove usr/bin
		vmove usr/share/man/man1
	}
}
