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

VERSION=3.7.3
PROGNAME="GNU Plot $VERSION"
DESC="\
gnuplot (plotting utility)                                             \n\
                                                                       \n\
Gnuplot is a command-line driven interactive function plotting utility \n\
for UNIX, MSDOS, and VMS platforms.  The software is copyrighted but   \n\
freely distributed (i.e., you don't have to pay for it).  It was       \n\
originally intended as graphical program which would allow scientists  \n\
and students to visualize mathematical functions and data.  Gnuplot    \n\
supports many different types of terminals, plotters, and printers     \n\
(including many color devices, and pseudo-devices like LaTeX) and is   \n\
easily extensible to include new devices."

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

compile() {
   #
   # build gd
   #
   cd $TMP
   tar -zxvf $CWD/gd1.3.tar.gz
   cd gd1.3/
   make

   mkdir lib
   cp libgd.a lib/
   mkdir include
   cp *.h include/

   #
   # build gnuplot
   #
   cd $TMP
   tar -zxvf $CWD/gnuplot-$VERSION.tar.gz
   cd gnuplot-$VERSION/
   chown -R root.root .
   CFLAGS=-O2 TERMLIBS="$TMP/gd1.3/libgd.a -lpng -lz $TMP/gd1.3/libgd.a"  \
   ./configure --prefix=/usr \
               --with-png \
               --with-gd=$TMP/gd1.3 \
               --datadir=/usr/share/gnuplot \
               --with-readline
   make
   ( cd docs/ ; make gnuplot.html )
}

install() {
cd $TMP/gnuplot-$VERSION/
   make install DESTDIR=/package-gnuplot

   mkdir -p /package-gnuplot/usr/doc/gnuplot-$VERSION
   cp -a 0* ChangeLog CodeStyle Copyright INSTALL.gnu NEWS PGPKEYS TODO \
         demo /package-gnuplot/usr/doc/gnuplot-$VERSION
   cp -a docs/gnuplot.html /package-gnuplot/usr/doc/gnuplot-$VERSION

   rm -rf /package-gnuplot/usr/info

   gzip -9f /package-gnuplot/usr/man/man1/*
}

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

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

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

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

