# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Maintainer: ScrumpyJack <scrumpyjack@st.ilet.to>
pkgname=lensfun
pkgver=0.3.4
pkgrel=1
pkgdesc="Image manipulation library to rectify lens defects"
url="https://lensfun.github.io/"
arch="all"
license="LGPL-3.0-or-later"
makedepends="
	cmake
	doxygen
	glib-dev
	libpng-dev
	py3-docutils
	py3-setuptools
	py3-wheel
	samurai
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools py3-$pkgname-pyc py3-$pkgname:py3:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/lensfun/lensfun/archive/refs/tags/v$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DBUILD_DOC=ON \
		-DBUILD_LENSTOOL=ON \
		-DBUILD_TESTS=ON \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib

	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	cd build/apps
	python3 setup.py install --root="$pkgdir" --skip-build
}

tools() {
	pkgdesc="$pkgdesc (extra tools)"
	amove usr/bin
}

py3() {
	depends="python3"
	pkgdesc="$pkgdesc (python bindings)"
	amove usr/lib/python3*
}

sha512sums="
4db9a08d51ba50c7c2ff528d380bb28e34698b2bb5c40e5f3deeaa5544c888ac7e0f638bbc3f33a4f75dbb67e0425ca36ce6d8cd1d8c043a4173a2df47de08c6  lensfun-0.3.4.tar.gz
"
