# -*-shell-script-*-

[Meta]
RootName: @abisource.org/abiword:@VERSION@
DisplayName: AbiWord Word Processor
ShortName: abiword
Maintainer: Abi the Ant - http://www.abisource.com/
Packager: Robert Staudinger <robsta@stereolyzer.net>
Summary: AbiWord is a lightweight word processing application.
SoftwareVersion: @VERSION@
AutopackageTarget: 1.0
PackageVersion: 2

# Only uncomment InterfaceVersion if your package exposes interfaces to other software,
# for instance if it includes DSOs or python/perl modules. See the developer guide for more info,
# or ask on autopackage-dev if you don't understand interface versioning in autopackage.
#
# InterfaceVersion: 0.0

[Description]
AbiWord is a multi-platform word processor with a GTK+ interface on the UNIX platform. For extended functionality and integration this version is compiled with GNOME support. Abiword with the GNOME front-end is part of the GNOME Office Suite. AbiWord is made available under the GNU GPL license.

[BuildPrepare]
orig_build_root="$build_root"
### abiword
# create configure wrapper when building out of the source tree
if [ ! -e "configure" ] ; then
	echo '#!/bin/bash' > configure
	echo '../abi/configure $@' >> configure
	chmod +x configure
fi
export APBUILD_STATIC=fribidi
prepareBuild --enable-binreloc --enable-gnome --enable-gucharmap --disable-debug --disable-symbols
export APBUILD_STATIC=
### plugins
build_root="$orig_build_root"
cd ../abiword-plugins
make clean
prepareBuild --disable-debug --disable-static --disable-all --enable-abigrammar --enable-wordperfect --enable-abimathview
### the charts and ODT plugins have higher dependencies
if [ $ABI_PLUGIN_ABIGOCHART_ENV ] ; then
	export PATH=$ABI_PLUGIN_ABIGOCHART_ENV/bin:$PATH
	export PKG_CONFIG_PATH=$ABI_PLUGIN_ABIGOCHART_ENV/lib/pkgconfig:/usr/lib/pkgconfig
	# only ship ODT /importer/
	export CFLAGS="$CFLAGS -DODT_DISABLE_EXPORTER"
	export CXXFLAGS="$CXXFLAGS -DODT_DISABLE_EXPORTER"
	build_root="$orig_build_root"
	cd $build_root/../abiword-plugins
	make clean
	prepareBuild --disable-debug --disable-static --disable-all --enable-abigochart --enable-OpenDocument
fi


[BuildUnprepare]
unprepareBuild
# TODO maybe "make clean" the plugins

[Imports]
echo '*' | import

[Prepare]
require @gnu.org/libstdc++ 3
require @rpm.org/popt 0.0
require @libpng.org/libpng 3
require @gtk.org/gtk 2.2
require @xmlsoft.org/libxml2 2.0
require @glade.gnome.org/libglade 2.0
require @gnome.org/gconf2 4
require @gnome.org/libbonobo2 0.0
require @gnome.org/libgnomeui 2.0
### self written skeletons, maybe they have to be copied to the system
### skeleton location to work
require @jig.org/libjpeg 62
require @gnome.org/gucharmap 4
require @gnome.org/libgnomeprint-2-2 0.0
require @gnome.org/libgnomeprintui-2-2 0.0
# actually 10.4 but the so seems not to be versioned properly
require @freedesktop.org/fribidi 0.0	
require @freedesktop.org/enchant 1.1
### plugin dependencies
require @abisource.com/link-grammar 4.1
require @libwpd.sourceforge.net/libwpd 8.0
require @gnome.org/gtkmathview 0.7
require @gnome.org/goffice 0.0

[Install]
# abiword
installExe ./bin/AbiWord-@PACKAGE_VERSION@
ln -s "$PREFIX/bin/AbiWord-@PACKAGE_VERSION@" "$PREFIX/bin/abiword"
installData ./share/AbiSuite-@PACKAGE_VERSION@
installDesktop "Word Processing" share/applications/abiword.desktop
# plugins
PLUGINPREFIX="lib/AbiWord-@PACKAGE_VERSION@/plugins"
if [ ! -e "$PREFIX/$PLUGINPREFIX" ] ; then
  mkdir -p "$PREFIX/$PLUGINPREFIX"
fi
copyFiles ./$PLUGINPREFIX/*.so "$PREFIX/$PLUGINPREFIX"

[Uninstall]
rm "$PREFIX/bin/abiword"
uninstallFromLog
