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

pkgname=agave
pkgver=0.4.4
pkgrel=2gv
arch=i486
source=("http://download.gna.org/colorscheme/releases/agave-$pkgver.tar.bz2" "agave-0.4.4-nohelp.patch")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo")
url=http://home.gna.org/colorscheme/
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------------------------------------------------------|
"agave - a colourscheme designer"
"Agave is a very simple application for the GNOME desktop that allows"
"you to generate a variety of colorschemes from a single starting"
"color. It is free software licensed under the open-source GPL License."
)


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

	patch -p1 < $startdir/src/agave-0.4.4-nohelp.patch

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

	sed -i 's/^Icon=.*/Icon=agave/' $startdir/pkg/usr/share/applications/agave.desktop

	# 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

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