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

VERSION=1.35
PROGNAME="GNU bison $VERSION"
DESC="\
bison (parser generator similar to yacc)                               \n\
                                                                       \n\
GNU "Bison" is a general-purpose parser generator that converts a      \n\
grammar description for an LALR(1) context-free grammar into a C       \n\
program to parse that grammar.                                         \n\
                                                                       \n\
Bison is upward compatible with Yacc:  all properly-written Yacc       \n\
grammars ought to work with Bison with no change.  Anyone familiar     \n\
with Yacc should be able to use Bison with little trouble."

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

compile() {
   tar -yxvf $CWD/bison-$VERSION.tar.bz2
   cd bison-$VERSION/
   CFLAGS=-O2 LDFLAGS=-s \
   ./configure --prefix=/usr
   make CFLAGS=-O2 LDFLAGS=-s
}

install() {
   cd $TMP/bison-$VERSION/
   make install prefix=/package-bison/usr

   mkdir -p /package-bison/usr/doc/bison-$VERSION
   cp ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS OChangeLog README REFERENCES THANKS \
      doc/FAQ /package-bison/usr/doc/bison-$VERSION

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

}

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

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

   cd $CTL
   cat << EOF >> doinst.sh
# Since bison can function in yacc mode, we'll add a shell script to
# do this if you didn't install Berkeley yacc:
if [ ! -r usr/bin/yacc ]; then
  echo '#!/bin/sh' > usr/bin/yacc
  echo '# emulate yacc' >> usr/bin/yacc
  echo 'bison -y \$*' >> usr/bin/yacc
  chown root.bin usr/bin/yacc
  chmod 755 usr/bin/yacc
fi
EOF
   sed -e 's/package-bison\///g' doinst.sh > doinst.sh.new
   cat doinst.sh.new > doinst.sh
   rm doinst.sh.new

   cat $CWD/slack-desc > slack-desc
}
