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

pkgname=zim
pkgver=0.65
pkgrel=1gv_salix14.1
source=(http://www.zim-wiki.org/downloads/zim-$pkgver.tar.gz)
docs=("readme.txt" "install" "copying" "changelog.txt" "authors" "news" "todo" "hacking" "packaging" "translators" "license.txt")
url=http://zim-wiki.org

doinst() {
	# update the mime desktop database
	if [ -x /usr/bin/update-desktop-database ]; then
	        /usr/bin/update-desktop-database -q
	fi
	# update the mime database
	if [ -x /usr/bin/update-mime-database ]; then
	        /usr/bin/update-mime-database usr/share/mime > /dev/null 2>&1
	fi
}

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"Zim (A desktop wiki and outliner)"
"Zim is a WYSIWYG text editor written in Gtk2-Perl which aims to bring"
"the concept of a wiki to your desktop. Every page is saved as a text"
"file with wiki markup. Pages can contain links to other pages, and are"
"saved automatically. Creating a new page is as easy as linking to a"
"non-existing page. Pages are ordered in a hierarchical structure that"
"gives it the look and feel of an outliner. This tool is intended to"
"keep track of TODO lists or to serve as a personal scratch book."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	python setup.py install --prefix=/usr --root=$startdir/pkg

	# Don't install mime files in the package, they are updated in
	# doinst
	rm $startdir/pkg/usr/share/mime/*

	mkdir -p $startdir/pkg/usr/share/icons/hicolor/64x64/apps
	cp $startdir/pkg/usr/share/pixmaps/zim.png $startdir/pkg/usr/share/icons/hicolor/64x64/apps/

	# Workaround for python upgrade bug:
	# https://bugs.launchpad.net/zim/+bug/1618410
	sed -i "s/^Exec=zim/Exec=zim --standalone/g" $startdir/pkg/usr/share/applications/*.desktop

	# Remove perllocal.pod and .packlist if present in the package
	( 
	for i in perllocal.pod .packlist; do
		find $startdir/pkg -name "$i" -exec rm -rf {} \;
		done
	) || exit 1
}