IGNOREPATH=/etc:/home:/var:/dev:/boot:/root:/tmp:/usr/local:/bin:/sbin:/mnt:/usr/src
STRIPLIB=y
STRIPBIN=y

VERSION=2.0.0
# plugins
PVER=2.0.0
# libfribidi
FVER=0.10.4
PROGNAME="AbiWord Personal $VERSION"
DESC="\
abiword (AbiWord Personal)                                             \n\
                                                                       \n\
AbiWord Personal is a lean and fast full-featured word processor.      \n\
It can import many formats including Word97/2000 and RTF, Palm, Psion, \n\
DocBook and XHTML documents, and can export to RTF, Palm, Psion,       \n\
XHTML, Text, and LaTeX formats.                                        \n\
                                                                       \n\
Linux Journal calls it \"an elegant, open source word processor that   \n\
delivers the Word functionality most people use.\""

BUILD=1
MAINTAINER="Mark Post <mark.post@eds.com>"
PKGNAME=abiword-$VERSION-s390-$BUILD
TAG=OPT

compile() {
   tar -yxvf $CWD/fribidi-$FVER.tar.bz2
   cd fribidi-$FVER/
   chown -R root.root .
   CFLAGS=-O2 \
   ./configure --prefix=/usr \
               --enable-shared=no
   make
   make install

   cd $TMP/
   tar -yxvf $CWD/abiword-$VERSION.tar.bz2
   cd abiword-$VERSION/
   tar -yxvf $CWD/abiword-plugins-$PVER.tar.bz2
   chown -R root.root .
   find . -perm 777 -exec chmod 755 {} \;
   find . -perm 775 -exec chmod 755 {} \;
   find . -perm 664 -exec chmod 644 {} \;
   find . -type d -exec chmod 755 {} \;
   cd abi/
   CFLAGS=-O2 CXXFLAGS=-O2 \
   ./configure --prefix=/usr \
               s390-slackware-linux
   make

   cd ../abiword-plugins
   ./configure --prefix=/usr
   make
}

install() {
   cd $TMP/fribidi-$FVER/
   make install DESTDIR=/package-abiword
   mkdir -p /package-abiword/usr/doc/fribidi-$FVER
   cp -a ANNOUNCE AUTHORS COPYING NEWS README THANKS TODO \
       /package-abiword/usr/doc/fribidi-$FVER

   cd $TMP/abiword-$VERSION/abi
   # Pat does a "make install_redhat" but that ignores the prefix= specified.
   # We will do just a plain make install and adjust things from there.
   make install DESTDIR=/package-abiword

   mkdir -p /package-abiword/usr/doc/abiword-$VERSION/docs
   cp -a BUILD.TXT BiDiReadme.txt COPYING COPYRIGHT.TXT CREDITS.TXT README.TXT \
       /package-abiword/usr/doc/abiword-$VERSION
   cp -a docs/*.abw /package-abiword/usr/doc/abiword-$VERSION/docs

   mkdir -p /package-abiword/usr/share/gnome/apps/Applications
   cat src/pkg/linux/rpm/data/abiword.desktop > /package-abiword/usr/share/gnome/apps/Applications/abiword.desktop

   cd ../abiword-docs/
   mkdir -p /package-abiword/usr/man/man8
   cat man/abiword.8 | gzip -9c > /package-abiword/usr/man/man8/abiword.8.gz

   cp -a Manual/en/Abiword_Manual.abw /package-abiword/usr/doc/abiword-$VERSION/docs

   cd ../abiword-plugins
   make install DESTDIR=/package-abiword
}

attributes() {
   chown -R root.bin $PKG/package-abiword/usr/bin
}

special() {
   cd $PKG
   mv package-abiword/* ./
   rmdir package-abiword/

   cd $CTL
   cat $CWD/slack-desc > slack-desc
   sed -e 's%package-abiword/%%g' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new
}

