#Packager: George Vlahavas <vlahavas~at~gmail~dot~com>

pkgname=simple-scan
pkgver=2.32.0.1
pkgrel=1gv
source=("http://launchpad.net/simple-scan/trunk/$pkgver/+download/simple-scan-$pkgver.tar.gz" "simple-scan-1.0.3-nohelp.patch")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo")
url=https://launchpad.net/simple-scan
options=('noautodotnew')

doinst() {
	# Update the scrollkeeper database (Remove stale pieces)
	if [ -x usr/bin/scrollkeeper-update ]; then
	        usr/bin/scrollkeeper-update > /dev/null 2>&1
	fi
}

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"simple-scan (Simple Scanning Utility)"
"Simple Scan is an easy-to-use application, designed to let users"
"connect their scanner and quickly have the image/document in an"
"appropriate format."
"Simple Scan is basically a frontend for SANE - which is the same"
"backend as XSANE uses. This means that all existing scanners will work"
"and the interface is well tested."
)


build() {
	cd $startdir/src/$pkgname-$pkgver

	patch -p1 < $startdir/src/simple-scan-1.0.3-nohelp.patch || exit 1

	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/var --sysconfdir=/etc --build=$arch-slackware-linux --disable-schemas-install --with-gconf-source="xml::/etc/gconf/gconf.xml.defaults" --disable-scrollkeeper
	make || return 1
	make install DESTDIR=$startdir/pkg

	# gconf stuff
	export GCONF_CONFIG_SOURCE="xml::$startdir/pkg/etc/gconf/gconf.xml.defaults"
	if [ -d $startdir/pkg/etc/gconf/schemas ]; then
	    install -v -d -m755 $startdir/pkg/etc/gconf/gconf.xml.defaults
	    SCHEMAS=$startdir/pkg/etc/gconf/schemas
	    for schema in $SCHEMAS/*.schemas; do
	        gconftool-2 --makefile-install-rule $schema
	    done
	    # Reset / Verify correct permissions
	    ( cd $startdir/pkg/etc/gconf ; find . -type d -exec chmod 755 {} \; )
	    ( cd $startdir/pkg/etc/gconf ; find . -type f -exec chmod 644 {} \; )
	fi
}