# Contributor: Michael Pirogov <vbnet.ru@gmail.com>
# Maintainer: Michael Pirogov <vbnet.ru@gmail.com>
pkgname=isa-l
pkgver=2.31.0
pkgrel=0
pkgdesc="Intelligent Storage Acceleration Library"
url="https://github.com/intel/isa-l"
arch="all"
license="BSD-3-Clause"
source="$pkgname-$pkgver.tar.gz::https://github.com/intel/isa-l/archive/refs/tags/v$pkgver.tar.gz
	$pkgname-i386.patch
	"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
makedepends="autoconf automake help2man libtool linux-headers nasm"

case $CARCH in
	ppc64le|riscv64|s390x|loongarch64) ;;
	*)
		makedepends="$makedepends
			doxygen
			texlive
			texmf-dist-fontsrecommended
			texmf-dist-lang
			texmf-dist-latexextra
			texmf-dist-plaingeneric
			"
		;;
esac

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure --build=$CBUILD --host=$CHOST
	make
	case "$CARCH" in
	ppc64le|riscv64|s390x|loongarch64) ;;
	*)
		make doc
		;;
	esac
}

check() {
	make test
}

doc() {
	default_doc

	case "$CARCH" in
	ppc64le|riscv64|s390x|loongarch64) ;;
	*)
		mkdir -p "$subpkgdir"/usr/share/doc/$pkgname
		mv "$builddir"/${pkgname}_api_$pkgver.pdf "$subpkgdir"/usr/share/doc/$pkgname/
		;;
	esac
}

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

sha512sums="
bbda3cf84e12352728c16d043ae71160569bff9540928eebb986e22d570176162a7f74fba9423d2349d014df061c09fc084343fbc51077415cfae9f692906dd8  isa-l-2.31.0.tar.gz
63badba20a4f9cf947fa87154a362f5edea1a1764afda6eec5da303962cc8fd5d06290c07226fefeeba7c0717bc406d26563fe4225eabe8dcd9a501a23dfd1fc  isa-l-i386.patch
"
