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

VERSION=2.5.6
PROGNAME="elm $VERSION"
DESC="\
elm (Menu-driven user mail program)                                    \n\
                                                                       \n\
Elm is an interactive screen-oriented mailer program originally        \n\
written by Dave Taylor, and continued by the Elm Development Group."

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

compile() {
   tar -xvzf $CWD/elm$VERSION.tar.gz
   cd elm$VERSION/
   zcat $CWD/elm$VERSION.config.diff.gz | patch -p1

   # The -DI_STDARG is needed because gcc no longer supports using vararg.h, and
   # elm specifies that by default.  If you specify -DI_STDARG, then it uses
   # stdarg.h, which works.
   make CCFLAGS=-DI_STDARG
}

install() {
   if [ -d /var/lib/elm ]; then
      rm -rf /var/lib/elm
   fi

   mkdir -p /var/lib/elm

   make install
   mkdir -p /usr/doc/elm-$VERSION
   cp -r NOTICE Overview README doc/*.guid* doc/Elm.cover \
         /usr/doc/elm-$VERSION

   ( cd doc/
     rm -f chkalias.1
     cp *.1 /usr/man/man1 )

   ( cd /usr/man/man1
     rm -f wnewmail.1 ; ln -s newmail.1 wnewmail.1
   )

   ( cd /var/man/cat1
     rm answer.1 elm.1 fastmail.1 listalias.1 mmencode.1 newmail.1 \
        readmsg.1 checkalias.1 elmalias.1 frm.1 messages.1 \
        newalias.1 printmail.1 wnewmail.1
   ) 

   ### metamail includes better versions of these
   ### (a better version of something that comes with elm?  amazing!)
   ( cd /usr/bin ; rm mmencode )
   ( cd /usr/man/man1 ; rm mmencode.1 )

   ( cd /usr/bin
     rm -rf frm     ; ln -sf nfrm frm
     rm -rf newmail ; ln -sf wnewmail newmail
   )
}

attributes() {
   chmod 444 $PKG/usr/man/man1/*
}

special() {
   cd $CTL
   cat $CWD/slack-desc > slack-desc
}

