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

VERSION=4.0.7
PROGNAME="z shell $VERSION"
DESC="\
zsh (the Z shell)                                                      \n\
                                                                       \n\
Zsh is a UNIX command interpreter (shell) which of the standard shells \n\
most resembles the Korn shell (ksh), although it is not completely     \n\
compatible.  It includes enhancements of many types, notably in the    \n\
command-line editor, options for customizing its behavior, filename    \n\
globbing, features to make C-shell (csh) users feel more at home and   \n\
extra features drawn from tcsh (another 'custom' shell).  Zsh was      \n\
written by Paul Falstad."

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

compile() {
   tar -yxvf $CWD/zsh-$VERSION.tar.bz2
   tar -yxvf $CWD/zsh-$VERSION-doc.tar.bz2

   cd zsh-$VERSION/
   chown -R root.root .

   ./configure --prefix=/usr s390-slackware-linux
   make
}

install() {
   make install DESTDIR=/package-zsh
   ( cd /package-zsh/
     mv usr/bin bin
     cd bin
     rm zsh-$VERSION ; ln -sf zsh zsh-$VERSION
   )

   mkdir -p /package-zsh/usr/doc/zsh-$VERSION/html-docs
   cp -a INSTALL LICENCE META-FAQ README /package-zsh/usr/doc/zsh-$VERSION
   cp -r Doc/*.html /package-zsh/usr/doc/zsh-$VERSION/html-docs

   mkdir -p /package-zsh/usr/info
   cp -a Doc/*info* /package-zsh/usr/info/

   mkdir -p /package-zsh/etc
   ( cd /package-zsh/etc
     rm -f zprofile ; ln -sf  profile zprofile
   )

   ( cd /package-zsh/usr/info
     rm -f *.gz
     gzip -9 *
   )

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

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

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

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

   cat <<EOF >> doinst.sh
if ! grep zsh etc/shells 1> /dev/null 2> /dev/null; then
  echo "/bin/zsh" >> etc/shells
fi
EOF

   sed -e 's%package-zsh/%%' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new
}

