# Template file for 'tpm2-tss'
pkgname=tpm2-tss
version=3.2.0
revision=6
build_style=gnu-configure
configure_args="--disable-weakcrypto --with-crypto=mbed --disable-fapi"
hostmakedepends="autoconf-archive automake libtool pkg-config doxygen libltdl-devel"
makedepends="libltdl-devel mbedtls2-devel"
short_desc="OSS implementation of the TCG TPM2 Software Stack"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-2-Clause"
homepage="https://github.com/tpm2-software/tpm2-tss"
distfiles="https://github.com/tpm2-software/tpm2-tss/archive/${version}.tar.gz"
checksum=521a8ee45285c1225573031e90b0f8b835166225646a1f66fad1c44858766943

system_accounts="_tss"

pre_configure() {
	vsed -i \
		"s/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${version}/" \
		"configure.ac" # fix version
	./bootstrap
}

pre_build() {
	vsed -e 's|tss|_tss|g' -i dist/tpm-udev.rules
}

post_install() {
	vlicense LICENSE
}

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