# $Id: Portfile,v 1.12 2006/01/07 16:03:24 mww Exp $

PortSystem 1.0

name			clamsmtp
version			1.6
categories		mail security
platforms		darwin
maintainers		mww@opendarwin.org
description		SMTP filter checking for viruses using the ClamAV anti-virus
long_description	ClamSMTP is an SMTP filter that allows you to check for \
					viruses using the ClamAV anti-virus software. It accepts \
					SMTP connections and forwards the SMTP commands and \
					responses to another SMTP server. The 'DATA' email body is \
					intercepted and scanned before forwarding.

homepage		http://memberwebs.com/nielsen/software/${name}/
master_sites	${homepage}
checksums		md5 19fed666c77bb26039c5412c2559249d

depends_run		bin:clamd:clamav

configure.args	--mandir=${prefix}/share/man

build.args		CFLAGS=-I${prefix}/include \
				LDFLAGS=-L${prefix}/lib

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}/ \
		${destroot}${prefix}/var/run/
	xinstall -m 644 ${worksrcpath}/doc/clamsmtpd.conf \
		${destroot}${prefix}/etc/clamsmtpd.conf.sample
	xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README \
		${destroot}${prefix}/share/doc/${name}
}
destroot.keepdirs	${destroot}${prefix}/var/run

set pidfile			${prefix}/var/run/clamsmtpd.pid
startupitem.create	yes
startupitem.name	ClamSMTP
startupitem.start	\
	"if \[ -r ${prefix}/etc/clamsmtpd.conf \]; then
		${prefix}/sbin/clamsmtpd -p ${pidfile}
	fi"
startupitem.stop	\
	"if \[ -r ${pidfile} \]; then
		kill \$(cat ${pidfile})
	fi"

