### this file is sourced not run
PKGVER=2.30.4
PKGBUILD=1
PKGARCH=x86_64

# source: james/arch
TARBALL=iscan_2.30.4-2.tar.gz
MD5SUM=b79c73341fcd7dd930381d50952b88c8
SRC_URL=http://support.epson.net/linux/src/scanner/iscan/$TARBALL
BUNDLE=

SLACKREQ='sane-backend iscan-data libxml2 libusb libpng gtk2' # 
SLACKDESC="iscan: iscan $PKGVER (Epson Scanner GUI)  
iscan:  
iscan: iscan is the GUI scanning program for Epson scanners. To work 
iscan: correctly, you will also need to install iscan-data.  
iscan: 
iscan: 
iscan: 
iscan: 
iscan: 
iscan: 
iscan: 
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/iscan* &&
	
	# patch for building iscan against libpng15 by giovanni
	patch -Np0 -i ../pkg/libpng15.patch &&

	# patch for ambiguous div in jpegstream.cc
	patch -Np0 -i ../pkg/jpegstream.cc.patch &&

	# add fix for CXX ABI different than 1002
	ln -s libesmod-x86_64.c2.so non-free/libesmod-x86_64.so
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/iscan*
	
	#patch hardcoded compiler name
	#sed -i -e 's|if test x"$CXX" = xg++; then| if true; then|' configure &&
	
	export LIBS="-lpng16 -ldl"
	CONFFLAGS="$CONFFLAGS --disable-static \
		--enable-dependency-reduction \
		--enable-frontend \
		--enable-jpeg \
		--enable-tiff \
		--enable-png" &&
		#--enable-gimp

	pkg_build_autoconf &&
	
	mkdir -p /etc/sane.d/dll.d &&
	install -m644 backend/epkowa.conf /etc/sane.d &&
	echo epkowa > /etc/sane.d/dll.d/epkowa &&
	
	pkg_build_slackdesc
}
