# Contributor: Petr Vorel <petr.vorel@gmail.com>
# Maintainer: Petr Vorel <petr.vorel@gmail.com>
pkgname=ima-evm-utils
pkgver=1.6.2
pkgrel=0
pkgdesc="Linux Integrity Measurement Architecture (IMA) Extended Verification Module (EVM) tools"
url="https://github.com/mimizohar/ima-evm-utils"
arch="all !loongarch64"
license="LGPL-2.1-or-later"
makedepends="
	asciidoc
	attr-dev
	autoconf
	automake
	bash
	diffutils
	docbook-xsl
	keyutils-dev
	libtool
	libxslt
	linux-headers
	openssl-dev>3
	tpm2-tss-dev
	xxd
	"
checkdepends="
	bash
	diffutils
	e2fsprogs
	e2fsprogs-extra
	gawk
	util-linux-misc
	"
subpackages="$pkgname-libs $pkgname-dev $pkgname-doc"
source="https://github.com/mimizohar/ima-evm-utils/releases/download/v$pkgver/ima-evm-utils-$pkgver.tar.gz"

case "$CARCH" in
armv7)
	# sign_verify signatures fail
	options="$options !check"
	;;
esac

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-static
	make
}

check() {
	make check || {
		cat tests/test-suite.log
		return 1
	}
}

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

sha512sums="
dfd82ba7c48c14fd31d687214a2b0cfcf269bdea42d4a0ebc872a72205f880c509ed5c5cd55dec7e94444e6f3bdc3c071ec6c2e3eba1e6579edb8ef11aa158a1  ima-evm-utils-1.6.2.tar.gz
"
