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

VERSION=3.2.20
PROGNAME="IBM Host Access Tool $VERSION"
DESC="\
x3270 (IBM host access tool for X)                                     \n\
                                                                       \n\
x3270 opens a telnet connection to an IBM host in an X window.  Since  \n\
the window created by x3270 can use its own font for displaying        \n\
characters, is a fairly accurate representation of an IBM 3278."

BUILD=1
MAINTAINER="Mark Post <mark.post@eds.com>"
SOURCE=
PKGNAME=x3270-$VERSION-s390-$BUILD
TAG=OPT

compile() {
   tar -zxvf $CWD/x3270-$VERSION.tar.gz
   cd `echo x3270-$VERSION | cut -f 1-2 -d .`
   chown -R root.root .
   find . -perm 555 -exec chmod 755 {} \;
   find . -perm 444 -exec chmod 644 {} \;
#  cp -vp /usr/share/libtool/config.* ./
   ./configure --prefix=/usr/X11R6
   make
}

install() {
   make install DESTDIR=/package-x3270
#  rm -rf /usr/X11R6/lib/X11/x3270

   mkdir -p /package-x3270/usr/X11R6/man/man1/
   for file in x3270-script.man x3270.man x3270if.man
   do
      cat $file | gzip -9c >  /package-x3270/usr/X11R6/man/man1/`basename $file .man`.1.gz
   done

   mkdir -p /package-x3270/usr/X11R6/man/man5/
   cat ibm_hosts.man | gzip -9c > /package-x3270/usr/X11R6/man/man5/ibm_hosts.5.gz

   mkdir -p /package-x3270/etc/X11/app-defaults/
   cp -a X3270.xad /package-x3270/etc/X11/app-defaults/X3270

   mkdir -p /package-x3270/usr/doc/x3270-$VERSION
   cp -a README* Examples html /package-x3270/usr/doc/x3270-$VERSION

   rm -f /package-x3270/usr/X11R6/lib/X11/fonts/misc/fonts.dir
}

attributes() {
   chown -R root.bin $PKG/package-x3270/usr/X11R6/bin

   chmod 644 $PKG/package-x3270/usr/X11R6/lib/X11/fonts/misc/*

   ( cd $PKG/package-x3270/usr/doc/x3270-$VERSION/Examples
     chmod 755 *.bash *.expect *.sh *.ksh
   )

   chmod 755 $PKG/package-x3270/usr/doc/x3270-$VERSION/html/Keymap.html
return
   find $PKG/package-x3270/usr/doc/x3270-$VERSION/ -type f | xargs chmod 444
   ( cd $PKG/package-x3270/usr/doc/x3270-$VERSION/Examples
     chmod 555 *.bash *.expect *.sh *.ksh
   )

   ( cd $PKG/package-x3270/usr/doc/x3270-$VERSION/html/
     chmod 544 Keymap.html
     chmod 644 ibm_hosts.html x3270-man.html x3270-script.html x3270if.html
   )
return
   chmod 644 $PKG/etc/X11/app-defaults/X3270

   cd $PKG/usr/doc/x3270-$VERSION/Examples
   chmod 755 *.bash *.expect *.sh *.ksh
}

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

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

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