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

VERSION=1.4.3
PROGNAME="X File Manager $VERSION"
DESC="\
xfm (a classic file manager for X)                                     \n\
                                                                       \n\
This is a powerful file and applications manager for X that contains   \n\
all of the traditional file manager features -- move around your       \n\
directory tree in multiple windows, and move, copy or delete files.    \n\
The integrated application manager allows you to drag files directly   \n\
into your favorite applications.  Small and fast, Xfm won as "Favorite \n\
File Manager" in the Linux Journal 1997 Readers' Choice Awards.        \n\
                                                                       \n\
xfm was originally written by Simon Marlow, and was improved by        \n\
Albert Graef and Till Straumann."

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

compile() {
   tar -zxvf $CWD/xfm-$VERSION.tar.gz
   cd xfm-$VERSION/
   
   xmkmf
   make Makefiles
   cat $CWD/makefile.diff | patch -p1 --verbose
   make
}

install() {
   make install DESTDIR=/package-xfm
   make install.man DESTDIR=/package-xfm

   mkdir -p /package-xfm/usr/doc/xfm-$VERSION
   cp -a COPYING ChangeLog INSTALL README README-1.2 README-1.4 TODO \
       /package-xfm/usr/doc/xfm-$VERSION

   mkdir -p /package-xfm/usr/X11R6/include/X11/bitmaps \
            /package-xfm/usr/X11R6/include/X11/pixmaps
   cp -a contrib/fileicons/pixmaps/* /package-xfm/usr/X11R6/include/X11/pixmaps
   cp -a contrib/fileicons/bitmaps/* /package-xfm/usr/X11R6/include/X11/bitmaps
   cp -a contrib/misc/pixmaps/* /package-xfm/usr/X11R6/include/X11/pixmaps
   mv /package-xfm/usr/X11R6/lib/X11/xfm/icons/*.xpm /package-xfm/usr/X11R6/include/X11/pixmaps
   mv /package-xfm/usr/X11R6/lib/X11/xfm/pixmaps/*.xpm /package-xfm/usr/X11R6/include/X11/pixmaps
   mv /package-xfm/usr/X11R6/lib/X11/xfm/pixmaps/*.xbm /package-xfm/usr/X11R6/include/X11/bitmaps
   mv /package-xfm/usr/X11R6/lib/X11/xfm/bitmaps/*.xbm /package-xfm/usr/X11R6/include/X11/bitmaps

   rmdir /package-xfm/usr/X11R6/lib/X11/xfm/icons \
         /package-xfm/usr/X11R6/lib/X11/xfm/pixmaps \
         /package-xfm/usr/X11R6/lib/X11/xfm/bitmaps

   ( cd /package-xfm/usr/X11R6/lib/X11/xfm
     rm -rf bitmaps ; ln -sf /usr/X11R6/include/X11/bitmaps bitmaps
     rm -rf icons   ; ln -sf /usr/X11R6/include/X11/pixmaps icons
     rm -rf pixmaps ; ln -sf /usr/X11R6/include/X11/pixmaps pixmaps
   )

   ( cd /package-xfm/usr/X11R6/man/man1/
     rm -f *.gz
     mv xfm.1x xfm.1
     mv xfmtype.1x xfmtype.1
     gzip -9 *.1
   )

   rm -rf /package-xfm/usr/X11R6/lib/X11/doc/
   rm /package-xfm/usr/X11R6/lib/X11/app-defaults
}

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

   chmod 644 $PKG/package-xfm/usr/X11R6/man/man1/* \
             $PKG/package-xfm/usr/X11R6/include/X11/bitmaps/* \
             $PKG/package-xfm/usr/X11R6/include/X11/pixmaps/* \
             $PKG/package-xfm/etc/X11/app-defaults/Xfm
}

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

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

