# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=kealib
pkgver=1.5.3
pkgrel=1
pkgdesc="KEA is an image file format that provides a full implementation of the GDAL data model"
url="http://www.kealib.org/"
arch="all"
license="MIT"
makedepends="
	cmake
	hdf5-dev
	samurai
	"
subpackages="
	$pkgname-dev
	"
source="
	https://github.com/ubarsc/kealib/releases/download/kealib-$pkgver/kealib-$pkgver.tar.gz
	10-config-shell.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
dded1f10fd69a0837d185e7988f81b175d7a204b8df6d44cc0a0ded25999c2016ffee74e3b138d9a23927260f077e99a583c4243cff41511862165f39b2320c1  kealib-1.5.3.tar.gz
fe77138269e4b0f375d1d670fd41661784d59bf8eaaea5339bd95e669bee07ff81ca7a50798981ced7ffbd6f480e2e36801e2e580d298b864acc85b7864735c3  10-config-shell.patch
"
