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

VERSION=9.1.0
DIALOG=0.9b-20030308
PROGNAME="pkgtools $VERSION"
DESC="\
pkgtools (The Slackware package maintenance system)                    \n\
                                                                       \n\
This package contains utilities for handling Slackware packages.       \n\
Included are the command line utilities 'installpkg', 'removepkg',     \n\
'makepkg', 'explodepkg', and 'upgradepkg' that install, remove,        \n\
build, examine, and upgrade software packages.  Also included are      \n\
'pkgtool', a menu based program for installing packages, removing      \n\
packages, or viewing the packages that are installed on the system,    \n\
documentation (man pages), and a few other system admin scripts."

BUILD=1
MAINTAINER="Mark Post <mark.post@eds.com>"
SOURCE=ftp://ftp.slackware.com/pub/slackware/
PKGNAME=pkgtools-$VERSION-s390-$BUILD
TAG=ADD

compile() {
   tar -zxvf $CWD/dialog-$DIALOG.tar.gz
   cd dialog-$DIALOG/
   chown -R root.root .
   # Disable broken arrows in textbox widget:
   zcat $CWD/dialog.textbox.noarrows.diff.gz | patch -p1

   CFLAGS=-O ./configure --prefix=/usr --enable-nls
   make
}

install() {
   mkdir -p /package-pkgtools
   ( cd /package-pkgtools
     tar -zxvf $CWD/_pkgtools.tar.gz
     rm -rf bin $TMP/install
     mv install $TMP/
   )

   make install prefix=/package-pkgtools/usr

   ( cd /package-pkgtools
     mkdir bin/
     mv usr/bin/* bin
   )

   cat samples/slackware.rc > /package-pkgtools/etc/dialogrc

   mkdir -p /package-pkgtools/usr/doc/dialog-$DIALOG
   cp -a CHANGES COPYING README VERSION dialog.lsm \
      /package-pkgtools/usr/doc/dialog-$DIALOG

   for page in explodepkg installpkg makepkg upgradepkg pkgtool removepkg; do
     cp -p $CWD/$page".8" /package-pkgtools/usr/man/man8/
   done

   mkdir -p /package-pkgtools/usr/X11R6/man/man1
   cat $CWD/xwmconfig.1 | gzip -9 > /package-pkgtools/usr/X11R6/man/man1/xwmconfig.1.gz

   ( cd /package-pkgtools/usr/man/man1
     rm -f *.gz
     gzip -9 *.1
   )

   ( cd /package-pkgtools/usr/man/man8
     rm -f *.gz
     gzip -9 *.8
   )
}

attributes() {
   chown -R root.bin $PKG/package-pkgtools/bin \
                     $PKG/package-pkgtools/sbin \
                     $PKG/package-pkgtools/usr/X11R6/bin
   chmod 700 $PKG/package-pkgtools/var/log/setup/tmp/
}

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

   cd $CTL
   cat $CWD/slack-desc > slack-desc

#  cat $CWD/s390.doinst.sh > doinst.sh
   sed -e 's%package-pkgtools/%%' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new

   cat $TMP/install/doinst.sh >> doinst.sh
}

