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

VERSION=1.3.3
PROGNAME="GNU zip $VERSION"
DESC="\
gzip (file compression utility)                                        \n\
                                                                       \n\
Gzip reduces the size of the named files using Lempel-Ziv coding       \n\
(LZ77).  Whenever possible, each file is replaced by one with the      \n\
extension .gz, while keeping the same ownership modes, access and      \n\
modification times."

BUILD=1
MAINTAINER="Mark Post <mark.post@eds.com>"
SOURCE=http://www.gzip.org/gzip-1.3.3.tar.gz
PKGNAME=gzip-$VERSION-s390-$BUILD
TAG=ADD

compile() {
   tar -zxvf $CWD/gzip-$VERSION.tar.gz
   cd gzip-$VERSION/
   chown -R root.root .
   CFLAGS=-O2 ./configure --prefix=/usr
   make
}

install() {
   make install DESTDIR=/package-gzip # prefix=/package-gzip/usr
   mkdir -p /package-gzip/bin
   mv /package-gzip/usr/bin/gzip /package-gzip/bin/
   ( cd /package-gzip/bin/
     rm -rf gunzip ; ln -sf gzip gunzip
     rm -rf zcat   ; ln -sf gzip zcat
   )

   mkdir -p /package-gzip/usr/doc/gzip-$VERSION
   cp -a README AUTHORS COPYING INSTALL NEWS README-alpha THANKS TODO \
       /package-gzip/usr/doc/gzip-$VERSION

   ( cd /package-gzip/usr/bin/
     rm -rf gzip   ; ln -sf ../../bin/gzip gzip
     rm -rf gunzip ; ln -sf ../../bin/gunzip gunzip
     rm -rf zca  t ; ln -sf ../../bin/zcat zcat
     rm -rf zcmp   ; ln -sf zdiff zcmp
     rm -rf zegrep ; ln -sf zgrep zegrep
     rm -rf zfgrep ; ln -sf zgrep zfgrep
   )
     
   ( cd /package-gzip/usr/info
     rm -f *.gz
     gzip -9 *
   )

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

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

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

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

