# Template file for 'iscan'
pkgname=iscan
version=2.30.4
revision=1
_srcrev=2
archs="i686 x86_64"
build_style=gnu-configure
configure_args="--enable-frontend --enable-jpeg --enable-tiff --enable-png --enable-gimp"
hostmakedepends="pkg-config"
makedepends="gtk+-devel gimp-devel libxml2-devel libjpeg-turbo-devel tiff-devel libltdl-devel libpng-devel sane-devel libusb-devel"
depends="sane-epkowa"
short_desc="EPSON Image Scan! front-end"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, custom:EPSON"
homepage="http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX"
distfiles="http://support.epson.net/linux/src/scanner/iscan/${pkgname}_${version}-${_srcrev}.tar.gz"
checksum=597b9913de42d7a27f95bc82e533cbe778121ba13e3a03bc037f8d09a43447d5
repository=nonfree
LDFLAGS="-ldl -lpng16"

post_configure() {
	# fix wrongly created link
	vsed -i -e 's/\(libesmod-$${arch}\)$(PACKAGE_CXX_ABI)/\1.c2/' non-free/Makefile
}

post_install() {
	vlicense non-free/COPYING.EPSON.en.txt
	vmkdir usr/lib/gimp/2.0/plug-ins
	ln -s /usr/bin/iscan ${DESTDIR}/usr/lib/gimp/2.0/plug-ins
	vinstall iscan.desktop 644 usr/share/applications
	vdoc "${FILESDIR}/README.voidlinux"
}

sane-epkowa_package() {
	short_desc="SANE backend for EPSON scanners"
	license="GPL-2.0-or-later"
	unset repository
	depends="sane iscan-data"
	conf_files="/etc/sane.d/epkowa.conf"
	pkg_install() {
		vmkdir etc/sane.d/dll.d
		echo epkowa > ${PKGDESTDIR}/etc/sane.d/dll.d/epkowa.conf
		vmove usr/lib/sane
		vmove usr/share/man/man5/sane-epkowa.5
		vmove usr/bin/iscan-registry
		vmove usr/share/man/man8/iscan-registry.8
		vinstall backend/epkowa.conf 644 etc/sane.d/
	}
}
