# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem  1.0

name                lsh
version             1.5.4
revision            0
categories          net
license             GPL-2+
maintainers         nomaintainer
platforms           darwin

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

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"

livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}