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

pkgname=epiphany
pkgver=2.30.6
pkgrel=1gv
source=("http://ftp.acc.umu.se/pub/GNOME/sources/epiphany/2.30/epiphany-$pkgver.tar.bz2" "epiphany-2.28.2-nohelp.patch")
docs=("readme" "install" "copying*" "changelog*" "authors" "news" "todo" "maintainers" "hacking")
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------------------------------------------------------|
"epiphany (a web browser using the webkit rendering engine)"
"Epiphany is the web browser for the GNOME desktop. Its goal is to be"
"simple and easy to use. Epiphany ties together many GNOME components"
"order to let you focus on the Web content, instead of the browser"
"application. As part of the GNOME project, Epiphany is Free Software."
)


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

	patch -p1 < $startdir/src/epiphany-2.28.2-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 \
		--disable-tests \
		--disable-gtk-doc \
		--disable-gtk-doc-html \
		--without-ca-file \
		--with-distributor-name=Salix
	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

	# useless stuff
	rm -rf $startdir/pkg/usr/share/gnome
	rm -rf $startdir/pkg/usr/share/gtk-doc
	rm -rf $startdir/pkg/usr/share/omf

	# default config
	gconftool-2 --direct --config-source xml::$startdir/pkg/etc/gconf/gconf.xml.defaults --type string --set /apps/epiphany/general/homepage http://www.salixos.org/start
	gconftool-2 --direct --config-source xml::$startdir/pkg/etc/gconf/gconf.xml.defaults --type bool --set /apps/epiphany/general/show_toolbars true
	gconftool-2 --direct --config-source xml::$startdir/pkg/etc/gconf/gconf.xml.defaults --type bool --set /apps/epiphany/web/javascript_enabled true
	gconftool-2 --direct --config-source xml::$startdir/pkg/etc/gconf/gconf.xml.defaults --type bool --set /apps/epiphany/web/java_enabled true
	gconftool-2 --direct --config-source xml::$startdir/pkg/etc/gconf/gconf.xml.defaults --type string --set /apps/epiphany/web/default_encoding UTF-8
}