# $Id: Portfile,v 1.5 2005/08/29 07:04:43 yeled Exp $

PortSystem	1.0

name			cyrus-sasl2
version			2.1.21
categories		security net
maintainers		jmpp@opendarwin.org landonf@opendarwin.org
description		SASL is an authentication library.
long_description	SASL is the Simple Authentication and Security Layer, \
			a method for adding authentication support to \
			connection-based protocols. To use SASL, a protocol \
			includes a command for identifying and authenticating \
			a user to a server and for optionally negotiating \
			protection of subsequent protocol interactions. If \
			its use is negotiated, a security layer is inserted \
			between the protocol and the connection.
platforms		darwin
homepage		http://asg.web.cmu.edu/sasl/
master_sites		http://ftp.andrew.cmu.edu/pub/cyrus-mail/
distname		cyrus-sasl-${version}
checksums		md5 dde02db234dea892bee298390890502e \
				sha1 6449f730c963d29d43600a95373a6e2db52d6d66
#				rmd160 93e0e1868453c5781602b5cce23e746b8823a26b

depends_lib		port:openssl \
				lib:libz:zlib

patchfiles		patch-Makefile.in \
			patch-include_Makefile.in \
			patch-lib_client.c \
			patch-lib_Makefile.in \
			patch-plugins-ntlm.c \
			patch-plugins-srp.c

default_variants	+kerberos

configure.args	--sysconfdir=${prefix}/etc \
		--mandir=${prefix}/share/man \
		--libexecdir=${prefix}/lib \
		--includedir=${prefix}/include \
		--with-openssl=${prefix} \
		--with-dbpath=${prefix}/etc/sasldb2 \
		--with-plugindir=${prefix}/lib/sasl2 \
		--with-saslauthd=${prefix}/var/state/saslauthd \
		--with-pwcheck=${prefix}/var/pwcheck \
		--enable-checkapop \
		--enable-cram \
		--enable-digest \
		--enable-otp \
		--enable-srp \
		--enable-srp-setpass \
		--enable-plain \
		--enable-anon \
		--enable-login \
		--enable-auth-sasldb \
		--enable-ntlm \
		--with-rc4=openssl

post-configure {
	# On darwin, -L/usr/lib pulls in Apple's own non-suitable sasl libraries
	reinplace s|-L/usr/lib||g ${worksrcpath}/utils/Makefile
}

post-destroot {
	      xinstall -d -m 755 ${destroot}${prefix}/share/doc
	      file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${name}
	      xinstall -d -m 755 ${destroot}${prefix}/var/state/saslauthd
	      xinstall -d -m 755 ${destroot}${prefix}/var/pwcheck
	      destroot.keepdirs ${destroot}${prefix}/var/state/saslauthd \
	      ${destroot}${prefix}/var/pwcheck
}

variant kerberos darwin {
	configure.args-append --enable-gssapi --with-gss_impl=mit
}

variant kerberos freebsd {
	configure.args-append --enable-gssapi --with-gss_impl=heimdal
}

variant sql	{ configure.args-append --enable-sql }

variant static	{ configure.args-append --enable-static }
