# Template file for 'vigra'
pkgname=vigra
version=1.11.0
revision=1
build_style=cmake
configure_args="-DWITH_OPENEXR=1"
hostmakedepends="cmake python"
makedepends="libpng-devel tiff-devel libjpeg-turbo-devel zlib-devel fftw-devel
 boost-devel libopenexr-devel"
short_desc="Image processing and analysis library"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="MIT"
homepage="https://ukoethe.github.io/vigra/"
distfiles="https://github.com/ukoethe/vigra/archive/Version-${version//./-}.tar.gz"
checksum=cae4838a2cc92ca52eafa621ab848df2e61399bbd77b2b945db35068fb50c86b
wrksrc=$pkgname-Version-${version//./-}

pre_configure() {
	if [ "$CROSS_BUILD" ]; then
		g++ config/output_cplusplus_version.cxx -o gccbugcheck
		sed "s#%OUTPUT%#$(./gccbugcheck)#" $FILESDIR/TryRunResults.cmake > TryRunResults.cmake
		configure_args+=" -C $PWD/TryRunResults.cmake"
	fi
}

post_install() {
	vmkdir usr/share/$pkgname
	mv $DESTDIR/usr/doc $DESTDIR/usr/share/$pkgname/doc
}

vigra-doc_package() {
	noarch=yes
	depends="vigra>=${version}_${revision}"
	short_desc+=" - documentation"
	pkg_install() {
		vmove usr/share/vigra/doc
	}
}

vigra-devel_package() {
	depends="vigra>=${version}_${revision} $makedepends"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/bin
		vmove usr/include
		vmove usr/lib/vigra
		vmove "usr/lib/*.so"
	}
}
