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

PortSystem			1.0
name				stunnel
version				4.23
categories			security net
maintainers			kallisys.net:pguyot
description			SSL tunneling program
long_description	Stunnel is a program that allows you to encrypt arbitrary \
					TCP connections inside SSL (Secure Sockets Layer) available \
					on both Unix and Windows. Stunnel can allow you to secure \
					non-SSL aware daemons and protocols (like POP, IMAP, LDAP, \
					etc) by having Stunnel provide the encryption, requiring no \
					changes to the daemon's code.
platforms			darwin
homepage			http://www.stunnel.org/
master_sites		${homepage}download/stunnel/src/ \
                    ftp://stunnel.mirt.net/stunnel/
checksums			md5		5f3d267c108cc0998b8fcaa16dcc5767 \
					sha1	d0fef8b518a44b9623692381a53680e0b4b01686 \
					rmd160	e6d3c9328f37f33b6be5caf8052988db2343fe5e
depends_lib			bin:openssl:openssl
patchfiles			patch-configure \
					patch-tools-stunnel.cnf
configure.args		--mandir=${prefix}/share/man \
					--disable-libwrap
default_variants	+libwrap

post-destroot {
	# Create the ${prefix}/var/lib/stunnel directory.
	xinstall -d -m 770 "${destroot}${prefix}/var/lib/stunnel/"
	system "touch ${destroot}${prefix}/var/lib/stunnel/.turd"

	# Tell the user about the stupid fake certificate that we provide.
	ui_msg "A fake certificate has been installed as ${prefix}/etc/stunnel/stunnel.pem"
}

# This (default) variant will include libwrap feature.
# libwrap has been reported to introduce some problems with stunnel 4.18.
# See: http://svn.macosforge.org/projects/macports/ticket/11028
variant libwrap {
	configure.args-delete	"--disable-libwrap"
}
