# Template file for 'gmic'
pkgname=gmic
version=3.5.3
revision=2
_zart_hash=d014169343f835381ad232ee11e077326561c9eb
build_wrksrc="src"
build_style=gnu-makefile
build_helper=qmake
make_build_args="NOSTRIP=yes lib libc cli gmic_qt gimp_shared zart"
make_use_env=yes
hostmakedepends="pkg-config gimp qt5-host-tools qt5-qmake"
makedepends="fftw-devel imath-devel libopenexr-devel MesaLib-devel libopencv-devel
 libgomp-devel lcms2-devel libpng-devel libjpeg-turbo-devel tiff-devel libcurl-devel
 gimp-devel qt5-devel libwebp-devel"
short_desc="GREYC's Magic for Image Computing (image processing framework)"
maintainer="Orphaned <orphan@voidlinux.org>"
license="CECILL-2.1, CECILL-C"
homepage="https://gmic.eu/"
distfiles="https://gmic.eu/files/source/gmic_${version}.tar.gz
 https://github.com/c-koi/zart/archive/${_zart_hash}.tar.gz>zart-${_zart_hash}.tar.gz"
checksum="e91a7cac4d0dc7c0ca2620f03bb14af82aa738c85a11b4f82fcc738654606442
 baebe339566993194f98a71895bff09520b08f38e66eae215758aaa260557bcf"
disable_parallel_build=yes
skip_extraction="zart-${_zart_hash}.tar.gz"

post_extract() {
	vsrcextract -C zart zart-${_zart_hash}.tar.gz
}

post_install() {
	vlicense ../COPYING
	if [ "$CROSS_BUILD" -a "$XBPS_TARGET_WORDSIZE" -eq 32 ]; then
		mv "$DESTDIR/usr/lib64"/* "$DESTDIR/usr/lib"
	fi
}

libgmic_package() {
	short_desc+=" - libraries"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

gmic-gimp_package() {
	short_desc+=" - GIMP plugin"
	depends="gimp"
	pkg_install() {
		vmove "usr/lib/gimp"
	}
}

gmic-zart_package() {
	short_desc+=" - ZArt tool"
	pkg_install() {
		vmove usr/bin/zart
		vmove usr/share/applications/zart.desktop
		vmove usr/share/icons/hicolor/48x48/apps/zart.png
		vmove usr/share/icons/hicolor/scalable/apps/zart.svg
	}
}

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