# -*- 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

PortSystem          1.0
PortGroup           conflicts_build 1.0
PortGroup           github 1.0

github.setup        scslab tcpcrypt 0.5 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2
checksums           rmd160  3a4f7825302de5d0fe4ab482d2a38454504c9588 \
                    sha256  e8508cfd5d175786cb91e0cfed0a2442a480387f8099440fc369509f8c3c7402 \
                    size    824377

name                tcpcrypt-devel
set real_name       tcpcrypt
categories          security www
platforms           darwin freebsd
maintainers         nomaintainer
license             BSD

description         encrypt (almost) all of your network traffic

long_description    Tcpcrypt is a protocol that attempts to encrypt (almost) \
                    all of your network traffic. Unlike other security \
                    mechanisms, Tcpcrypt works out of the box: it requires no \
                    configuration, no changes to applications, and your \
                    network connections will continue to work even if the \
                    remote end does not support Tcpcrypt, in which case \
                    connections will gracefully fall back to standard \
                    clear-text TCP. Install Tcpcrypt and you'll feel no \
                    difference in your every day user experience, but yet \
                    your traffic will be more secure and you'll have made life \
                    much harder for hackers.

use_autoreconf      yes
autoreconf.cmd      ./bootstrap.sh

depends_build       port:autoconf \
                    port:automake \
                    port:libtool

depends_lib         path:lib/libssl.dylib:openssl

conflicts_build     libpcap

configure.args      --disable-silent-rules

post-destroot {
    set docdir  ${destroot}${prefix}/share/doc/${real_name}
    set datadir ${destroot}${prefix}/share/${real_name}
    xinstall -d ${docdir} ${datadir}

    xinstall -W ${build.dir} launch_tcpcryptd.sh ${datadir}
    reinplace -E "s|^TCPCRYPTD=.+$|TCPCRYPTD=${prefix}/bin/tcpcryptd|" ${datadir}/launch_tcpcryptd.sh

    xinstall -m 0644 {*}[glob ${worksrcpath}/README*] ${docdir}
}

startupitem.create  yes
startupitem.name    ${real_name}
startupitem.start   "${prefix}/share/${real_name}/launch_tcpcryptd.sh"