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

pkgname=abiword
pkgver=3.0.5
pkgrel=1gv
source=("http://www.abisource.com/downloads/abiword/$pkgver/source/abiword-$pkgver.tar.gz"
		"enchant-2.1.patch")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "*.txt")
url=http://www.abisource.com

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

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"abiword (word processing for everyone)"
"AbiWord is a lean and fast full-featured word processor. It can import"
"many formats including Word97/2000 and RTF, Palm, Psion, DocBook and"
"XHTML documents, and can export to RTF, Palm, Psion, XHTML, Text,"
"and LaTeX formats. Linux Journal calls it \"an elegant, open source"
"word processor that delivers the Word functionality most people use.\""
)


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

	patch -p1 < $startdir/src/enchant-2.1.patch || exit 1
	
	# Install missing m4 file
	install -m644 ../aiksaurus-plugin.m4 plugins/aiksaurus/plugin.m4
	install -m644 ../command-plugin.m4 plugins/command/plugin.m4

	# Generate m4 file for configure
	find plugins -name plugin.m4 | xargs cat > plugin-configure.m4

	# enchant-2 naming change
	sed -i 's/enchant >=/enchant-2 >=/' configure.ac

	libtoolize --force
	autoreconf -fi

	./configure --prefix=/usr \
		--libdir=/usr/lib${LIBDIRSUFFIX} \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--disable-static \
		--enable-plugins \
		--enable-spell \
		--build=$arch-slackware-linux
	make -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg
	mkdir -p $startdir/pkg/usr/share/icons/hicolor/48x48/apps
	mv $startdir/pkg/usr/share/icons/abiword_48.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps/abiword.png
	sed -i "s/Icon=.*/Icon=abiword/" $startdir/pkg/usr/share/applications/abiword.desktop
}