# $Id: Portfile,v 1.8 2006/03/03 09:59:53 mww Exp $

PortSystem 1.0
name		courier-imap
version	 	4.1.0
categories	mail
maintainers	bchesneau@mac.com
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 c479dd4e42c2b6c108d879670853e99f7f851699
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.env	CFLAGS="-I${prefix}/include/db44 -I${prefix}/include" \
		CPPFLAGS="-I${prefix}/include/db44 -I${prefix}/include" \
		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"

#platform darwin 6 {
#	depends_lib-append      lib:libdl:dlcompat
#	configure.args-append	--with-waitfunc=wait3
#}

#platform darwin 7 {
#	configure.args-append	--with-waitfunc=wait3
#}

platform darwin 8 {
	configure.env-append CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0
}

