# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $

PortSystem 1.0

name	           	milter-greylist
version         	4.0
categories      	mail
maintainers     	geeklair.net:dluke
platforms		darwin
description     	milter-greylist standalone greylist milter
long_description	milter-greylist is a stand-alone milter written in C \
			that implements the greylist filtering method

homepage        http://hcpnet.free.fr/milter-greylist/
master_sites    ftp://ftp.espci.fr/pub/milter-greylist/

extract.suffix	.tgz

checksums       md5 2834933b27298d30630eea621cbfdcf5 \
		sha1 e94c8c8a7ed5cf27550eb69f660c7d75c60f6ac1 \
		rmd160 e84329491ea06044549aafbf65bf8adf4c01956b

depends_lib	port:libmilter

configure.args	--mandir=${prefix}/share \
		--with-user=milter-greylist \
		--with-libmilter=${prefix}

post-configure	{
			reinplace "s|/etc/mail|${prefix}/etc/mail|g" \
				${worksrcpath}/Makefile ${worksrcpath}/conf.h
			reinplace "s|/var/milter-greylist|${prefix}/var/milter-greylist|g" \
				${worksrcpath}/greylist.conf
		}

pre-configure 	{
			adduser milter-greylist
			addgroup milter-greylist users=milter-greylist
		}

post-destroot	{
			file rename ${destroot}${prefix}/etc/mail/greylist.conf \
				${destroot}${prefix}/etc/mail/greylist.conf.sample
			xinstall -o milter-greylist -g milter-greylist \
				-d ${destroot}${prefix}/var/milter-greylist
		}

destroot.keepdirs ${destroot}${prefix}/var/milter-greylist

startupitem.create	yes
startupitem.name	milter-greylist
startupitem.executable	${prefix}/bin/milter-greylist -D -u milter-greylist:milter-greylist

variant postfix	description {build with postfix support} {
			depends_lib-append port:postfix
			configure.args-append --enable-postfix
		}
