# $Id: Portfile 75061 2011-01-13 21:07:47Z ryandesign@macports.org $

PortSystem	1.0
name		lsh
version		1.5.4
revision	0
description	A GNU implementation of the Secure Shell protocols
long_description	\
	lsh is a free implementation (in the GNU sense) of the ssh \
version 2 protocol, currently being standardised by the IETF SECSH \
working group

categories	net
maintainers	nomaintainer
platforms	darwin
homepage	http://www.lysator.liu.se/~nisse/lsh/

master_sites	http://www.lysator.liu.se/~nisse/archive/ \
		ftp://ftp.lysator.liu.se/pub/security/lsh/
checksums	md5 5cb5bccf17e7819a6db3e447854a310c
patchfiles	\
	patch-src-argp-Makefile.in.diff  patch-src-argp-argp-pvh.c.diff \
	patch-src-argp-argp-ba.c.diff    patch-src-nettle-configure.diff \
	patch-src-argp-argp-pv.c.diff    patch-src-spki-configure.diff \
	patch-src-lsh_pam_checkpw.c.diff

depends_lib	lib:liboop:liboop		lib:libgmp:gmp \
		lib:libreadline:readline

set defaultcflags		"-I${prefix}/include"
set defaultconfigureargs	"--disable-datafellows-workarounds --with-include-path=${prefix}/include --with-lib-path=${prefix}/lib --with-tcpwrappers --with-pam --disable-kerberos"


platform darwin {
        post-extract    {
                system "mkdir -p ${workpath}/paminclude"
                system "ln -sf /usr/include/pam ${workpath}/paminclude/security"
        }

	patchfiles-append	patch-src-unix_user.c.diff

	post-patch	{
		# fix time stamps
		system "touch \"${worksrcpath}/src/unix_user.c.x\""
	}

        set platformcflags	"-I${workpath}/paminclude"
	configure.args ${defaultconfigureargs} CPPFLAGS="${defaultcflags} ${platformcflags}" LDFLAGS="-L${prefix}/lib"

        post-install {
                ui_msg "Additionally, for PAM, you need to copy /etc/pam.d/sshd to"
                ui_msg " /etc/pam.d/lshd, or use another config with pam_securityserver.so."
        }

}

configure.args ${defaultconfigureargs} CPPFLAGS="${defaultcflags}" LDFLAGS="-L${prefix}/lib"

