# -*- 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 119080 2014-04-16 19:05:15Z macsforever2000@macports.org $

PortSystem          1.0

name                openvpn2
version             2.3.3
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  583119bd19749a5e4a1afef531d67f895ef535f7 \
                    sha256  f025d14631105a66e501ca897830cd4d26a1438530cd9174dc6169536ae4b113

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} eq "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
