# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=perdition
pkgver=1.18
pkgrel=10
pkgdesc="A Mail retrieval proxy"
url="http://horms.net/projects/perdition/"
arch="all"
license="LGPL"
depends=
depends_dev="gdbm-dev libressl-dev popt-dev vanessa_adt-dev vanessa_logger-dev
	vanessa_socket-dev"
makedepends="$depends_dev"
install=$pkgname.pre-install
subpackages="$pkgname-doc"
source="http://horms.net/projects/perdition/download/$pkgver/$pkgname-$pkgver.tar.bz2
	gdbm-version.patch"


_builddir="$srcdir"/$pkgname-$pkgver

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

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-gdbm \
		--disable-libtool-lock \
		--disable-mysql \
		--disable-odbc \
		--disable-pg \
		--disable-cdb \
		--disable-nis \
		--disable-posix-regex \
		--disable-ldap \
		--disable-daemon-map \
		|| return 1

	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1

	install -m755 -D ../../$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D ../../$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

md5sums="df84d5fc4ab78b94a9baf17c5790ba38  perdition-1.18.tar.bz2
cfdd151cb92d2283151b8e48caf04337  gdbm-version.patch"
sha256sums="0a8793898fc20f1391092550cbbeb808cea73c110fe0aeee172ed73fe0775263  perdition-1.18.tar.bz2
551c993e4a77cca29a293c293dcf2f47a4c0eeb1e0e0f992b6b9d4b5934e6a19  gdbm-version.patch"
sha512sums="02ed3db23746c0b371bc546151d15bfc956df36251cb386731a0381fceb564f72271379e5afca7469d80edb88bc2f6fb43c640f8ad76a46d6f11e9ab72d213d3  perdition-1.18.tar.bz2
6adfac02fdbbdfff779693204819ea7d931400161517782dac7765a34d075ba0492b2be8f0160acc68fa83aabdbb728288eb462bb2e95b594a7fffdbce39b069  gdbm-version.patch"
