# $Id: Portfile 52999 2009-06-27 22:04:04Z toby@macports.org $

PortSystem 1.0

name		courier-imap
version	 	4.4.1
categories	mail
maintainers	nomaintainer
description	IMAP server
long_description	This package contains the standalone Courier IMAP server, \
			which is used to provide IMAP access to local mailboxes. \
			Courier-IMAP is provided here as a separate package that \
			can be used with other mail servers as well.

homepage	http://www.courier-mta.org/imap/
platforms	darwin
master_sites	sourceforge:courier freebsd
use_bzip2	yes
checksums	sha1 c5d7a2790f6ce0ed7eda90a36268a1e772627bd7
depends_lib    	port:courier-authlib port:openssl port:db44
set authdaemondir	${prefix}/var/run/authdaemon.courier-imap
patchfiles	patch-rfc1035_res.h
 
configure.args	--bindir=${prefix}/bin --mandir=${prefix}/share/man \
		--sysconfdir=${prefix}/etc/${name} \
		--datadir=${prefix}/share/${name} \
		--localstatedir=${prefix}/var/run \
		--with-piddir=${prefix}/var/run \
		--with-authdaemonvar=${authdaemondir} \
		--with-db=db \
		--enable-unicode --disable-root-check
configure.cflags	"-I${prefix}/include/db44 -I${prefix}/include"
configure.cppflags	"-I${prefix}/include/db44 -I${prefix}/include"
configure.ldflags	"-L${prefix}/lib/db44 -L${prefix}/lib"

destroot.target install install-configure

post-destroot {
	xinstall -m 755 -d ${destroot}${authdaemondir}
	destroot.keepdirs ${destroot}${authdaemondir}
}

startupitem.create	yes
startupitem.init	\
". ${prefix}/etc/courier-imap/imapd\n. ${prefix}/etc/courier-imap/imapd-ssl\n"
startupitem.start	"${prefix}/libexec/imapd-ssl.rc start"
startupitem.stop	"${prefix}/libexec/imapd-ssl.rc stop"
