#!/bin/sh
PKGNAM=gftp
VERSION=2.0.18
BUILD=2

. /etc/pkghelpers
pkghelpers_env

rm -rf $PKG
mkdir -p $PKG

cd $TMP
rm -rf gftp-$VERSION
tar xjvf $CWD/gftp-$VERSION.tar.bz2
cd gftp-$VERSION
chown -R root.root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --localstatedir=/var/lib \
  $ARCH-$DISTRO-linux
make -j12 || exit 1
make install DESTDIR=$PKG
rm -rf $PKG/usr/share/gnome
mkdir -p $PKG/usr/share/applications
zcat $CWD/gftp.desktop.gz > $PKG/usr/share/applications/gftp.desktop
mkdir -p $PKG/usr/doc/gftp-$VERSION
cp -a \
  ABOUT-NLS AUTHORS COPYING NEWS README README.html THANKS TODO \
  $PKG/usr/doc/gftp-$VERSION
gzip -9 $PKG/usr/man/man?/*.?
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
pkghelpers_fixup
pkghelpers_makepkg