# -*- 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: Portfile 103962 2013-03-11 02:21:21Z ryandesign@macports.org $

PortSystem          1.0

name                openvpn2
version             2.3.0
distname            openvpn-${version}
categories          net security
platforms           darwin
maintainers         nomaintainer
license             {GPL-2 OpenSSLException}

description         easy-to-use, robust, and highly configurable VPN
long_description    \
    OpenVPN is an easy-to-use, robust, and highly configurable VPN (Virtual \
    Private Network) daemon which can be used to securely link two or more \
    private networks using an encrypted tunnel over the internet.

homepage            http://www.openvpn.net
master_sites        http://swupdate.openvpn.net/community/releases/

checksums           rmd160  f24ac128fcd874bf40e8ffd5161065e84170d69f \
                    sha256  4602a8d0f66dfa6ac10b7abfeba35260d7d4c570948f6eba5f8216ffa3a2c490

depends_build       port:pkgconfig
depends_lib         port:lzo2 \
                    port:openssl

configure.args      --program-suffix=2 \
                    --docdir=${prefix}/share/doc/${name}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${docdir}
    foreach dir "sample/sample-config-files \
                sample/sample-keys \
                sample/sample-plugins \
                sample/sample-scripts \
                contrib"  {
        file copy ${worksrcpath}/${dir} ${docdir}
    }
    xinstall -m 644 -W ${worksrcpath} AUTHORS ${docdir}
}

if {${os.platform} == "darwin" && ${os.major} <= 9} {
    post-patch {
        reinplace "s|security/pam_appl.h|pam/pam_appl.h|g" ${worksrcpath}/src/plugins/auth-pam/auth-pam.c
    }
}

livecheck.url       ${homepage}/download.html
livecheck.regex     openvpn-(\[0-9.\]*).tar.gz
