# Description: Small, easy-to-configure FTP server.
# URL: http://bftpd.sourceforge.net/
# Maintainer: John McQuah, jmcquah at disroot dot org

name=bftpd
version=6.2
release=1
source=(https://downloads.sourceforge.net/project/$name/$name/$name-$version/$name-$version.tar.gz
  ftpd)

build() {
  cd $name

  CFLAGS+=' -fcommon'
  sed -e '/var\/run/d' \
      -e '/^sbindir=/a sysconfdir=@sysconfdir@\nlocalstatedir=@localstatedir@' \
      -e 's/$.prefix.\/etc/$(sysconfdir)/' \
      -e 's/$.prefix.\/var/$(localstatedir)/' \
      -i Makefile.in
  ./configure --prefix=/usr \
    --mandir=/usr/share/man \
    --localstatedir=/var    \
    --sysconfdir=/etc       \
    --enable-libz

  make
  install -d $PKG/usr/sbin $PKG/etc $PKG/etc/rc.d
  make DESTDIR=$PKG install

  install -D -m 0755 $SRC/ftpd $PKG/etc/rc.d/ftpd
  chmod 0600 $PKG/etc/bftpd.conf
  ln -sf bftpd $PKG/usr/sbin/in.ftpd
}
