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

pkgname=ghex
pkgver=2.24.0
pkgrel=1gv
arch=x86_64
source=("http://ftp.gnome.org/pub/GNOME/sources/ghex/2.24/ghex-2.24.0.tar.bz2" "ghex-2.24.0-nohelp.patch")
docs=("readme" "install" "copying*" "changelog" "authors" "news" "todo")
url=http://live.gnome.org/Ghex
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------------------------------------------------------|
"ghex - a hex editor for GNOME"
"GHex allows the user to load data from any file, view and edit it in"
"either hex or ascii. Useful for debugging problems with object code or"
"encodings. Also used by kids who cheat at computer games, by adding"
"score or lives to saved games."
)


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

	patch -p1 < $startdir/src/ghex-2.24.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"
	make || return 1
	make install DESTDIR=$startdir/pkg
	rm -rf $startdir/pkg/usr/share/gnome

	# 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
} 
