# Contributor: Douglas Haber <me@douglashaber.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pure-ftpd
pkgver=1.0.46
pkgrel=0
pkgdesc="Pure FTPD FTP daemon"
url="http://pureftpd.org"
arch="all"
license="GPL"
depends=
depends_dev=libressl-dev
makedepends="$depends_dev"
install=""
subpackages="$pkgname-doc"
source="http://download.pureftpd.org/pub/pure-ftpd/releases/$pkgname-$pkgver.tar.gz
	pure-ftpd.initd
	pure-ftpd.confd"

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure --prefix=/usr \
		--without-humor \
		--without-unicode \
		--with-minimal \
		--with-throttling  \
		--with-puredb \
		--with-tls \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
        install -m755 -D ../$pkgname.initd \
                "$pkgdir"/etc/init.d/$pkgname || return 1

        install -m644 -D ../$pkgname.confd \
                "$pkgdir"/etc/conf.d/$pkgname || return 1
}

sha512sums="90579cad52028fa9e7f8d3f3f8d7f8194b21942f86ae17b026317ef410c48fc712d68b8990d14fe309fa9e88ec57b53e622d0f13bf8a395a2a3964ce5a32d80a  pure-ftpd-1.0.46.tar.gz
fde2e979410779cc0044e1190b88fe2f0956166b68e2d7fb94520bc0803a3ec85814f66e09a7fdae4ebead872c9a48d973cf7ef3d2818f2298b22ac629cfcf25  pure-ftpd.initd
a5cc8e59178a5d0f7b5909d09009ef6ace1f8e6874bd733e21bc30f4899447e70b020a0369077132751ceb28afa971588efedcce3dea83e9b043b1545caf3393  pure-ftpd.confd"