# You must have libwpd and fribidi installed before compiling AbiWord. Static
# versions of these two libs are recommended to avoid extra dependencies.

NAME=abiword
VERSION=2.4.1
SOURCE=http://www.abisource.com/downloads/abiword/$VERSION/source/abiword-$VERSION.tar.bz2
BUILD=${BUILD:-1tukaani}
ROOT_REQUIRED=1

build() {
	_explode_all
	_cflags -Os -pipe

	cd abiword-$VERSION/abi
	./configure \
		--prefix=$GNOMEPREFIX \
		--disable-debug \
		--enable-gnome \
		$CONFIGURE_TRIPLET
	make
	make install DESTDIR=$PKG
	make install DESTDIR=$TMP/tmp-pkg
	_chfix
	_chgrp_bin
	_tmp_pkg $TMP/tmp-pkg
	_doc 0 abiword-$VERSION/docs  BUILD.TXT BiDiReadme.txt COPYING \
			COPYRIGHT.TXT CREDITS.TXT README.TXT docs/*.abw
	
	# More docs
	cd ../abiword-docs/man
	mkdir -p $PKG$GNOMEPREFIX/man/man1
	cat abiword.1 > $PKG$GNOMEPREFIX/man/man1/abiword.1
	cd ..
#	mkdir -p $PKG$DATADIR/AbiSuite-2.2/AbiWord/help
#	sh make-html.sh
#	cp -a help/en-US $PKG$DATADIR/AbiSuite-2.2/AbiWord/help/
	_doc 0 abiword-$VERSION/docs Manual/en/Abiword_Manual.abw

	# Plugins
	cd ../abiword-plugins
	./configure \
		--prefix=$GNOMEPREFIX \
		--disable-debug \
		--enable-gnome \
		$CONFIGURE_TRIPLET
	make
	make install DESTDIR=$PKG

	# Give credit for those whose libraries are compiled statically in:
	_doc 0 abiword-$VERSION/static-libs $DOCDIR/libwpd-* $DOCDIR/fribidi-*

	_rm_empty_dirs $PKG$GNOMEPREFIX/lib

	_chfix
	_chgrp_bin
}
