# Contributor: Jonas <3426-spameier@users.gitlab.alpinelinux.org>
# Maintainer: Jonas <3426-spameier@users.gitlab.alpinelinux.org>
pkgname=libtpms
pkgver=0.10.0
pkgrel=0
pkgdesc="library providing software emulation of a Trusted Platform Module (TPM 1.2 and TPM 2.0)"
url="https://github.com/stefanberger/libtpms"
arch="all"
license="BSD-3-Clause"
makedepends="autoconf automake bash gawk libtool make openssl-dev>3"
subpackages="$pkgname-dev $pkgname-doc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/stefanberger/libtpms/archive/v$pkgver.tar.gz
	10-fix-nvram_offsets-32bit-test.patch
"

prepare() {
	default_prepare
	NOCONFIGURE=1 ./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libdir=/usr/lib \
		--with-tpm2 \
		--with-openssl
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
a728188c26447656f43298d1475ebccf0f074d9474780a71fc64baf1ac8b6f6569c90e5ad07098dddc711ba1080eef409c1ac5334d054e7f144e48fa21b66df9  libtpms-0.10.0.tar.gz
35e5c486c5da9d90c429ba7743dcf95ef56f4a6baa13ef69ec297c4bba899161683b83e97b6e653e0774fe7f813cad8f9d9a680e04277066ec5dd6d1d1ea0fa0  10-fix-nvram_offsets-32bit-test.patch
"
