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

pkgname=evince
pkgver=2.26.2
pkgrel=2gv
arch=x86_64
source=("http://ftp.gnome.org/pub/GNOME/sources/evince/2.26/evince-2.26.2.tar.bz2" "evince-2.26.0-nohelp.patch")
url=http://projects.gnome.org/evince/
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "maintainers")
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------------------------------------------------------|
"evince - simply a document viewer"
"Evince is a document viewer for multiple document formats. It"
"currently supports pdf, postscript, djvu, tiff and dvi. The goal of"
"evince is to replace the multiple document viewers that exist on the"
"GNOME Desktop with a single simple application."
)


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

	patch -p1 < $startdir/src/evince-2.26.0-nohelp.patch || exit 1
	
	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/var --sysconfdir=/etc --disable-static --disable-scrollkeeper --disable-schemas-install --with-gconf-source="xml::/etc/gconf/gconf.xml.defaults" --enable-djvu --enable-pixbuf --enable-impress
	make || return 1
	make install DESTDIR=$startdir/pkg

	sed -i "/NoDisplay/d" $startdir/pkg/usr/share/applications/evince.desktop

	rm -rf $startdir/pkg/usr/share/{omf,gnome,gtk-doc}

	# Install gconf Schemas
       	export GCONF_CONFIG_SOURCE="xml::$PKG/etc/gconf/gconf.xml.defaults"
	if [ -d $PKG/etc/gconf/schemas ]; then
		install -v -d -m755 $PKG/etc/gconf/gconf.xml.defaults
		SCHEMAS=$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
}