# Template file for 'gmic'
pkgname=gmic
version=2.8.0
revision=1
build_wrksrc="src"
build_style=gnu-makefile
build_helper=qmake
hostmakedepends="pkg-config gimp qt5-host-tools qt5-qmake"
makedepends="fftw-devel ilmbase-devel libopenexr-devel MesaLib-devel libopencv-devel
 libgomp-devel lcms2-devel libpng-devel libjpeg-turbo-devel tiff-devel libcurl-devel
 gtk+-devel gimp-devel qt5-devel"
short_desc="GREYC's Magic for Image Computing (image processing framework)"
maintainer="Jakub Skrzypnik <jot.skrzyp@gmail.com>"
license="CECILL-2.1"
homepage="http://gmic.eu/"
distfiles="http://gmic.eu/files/source/gmic_${version}.tar.gz"
checksum=d1ca5c726f7570af3a6f0bca27eeb66ef1e6a1b6a17bdaeaf0d59be40b9cd075
disable_parallel_build="yes"

post_patch() {
	vsed -i -e "s,-I[\$](USR),-I$XBPS_CROSS_BASE/usr,g" Makefile
	# Fix library names for openexr-2.4.0
	vsed -i Makefile -e "s;-lIlmImf -lHalf;-lIlmImf-2_4 -lHalf-2_4;"
	# Not supported on ppc but we already compile for baselines
	case "$XBPS_TARGET_MACHINE" in
		ppc*) vsed -i Makefile -e 's;-mtune=generic;;' ;;
	esac
}

post_install() {
	vlicense ../COPYING
}

gmic-gimp_package() {
	short_desc+=" - GIMP plugin"
	depends="gimp ${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/lib/gimp
	}
}
gmic-zart_package() {
	short_desc+=" - ZArt tool"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/bin/zart
	}
}
gmic-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.so
	}
}
