PortSystem          1.0

name                tcpcrypt-devel
set real_name       tcpcrypt
version             0.0.1
revision            1
categories          security www
platforms           darwin freebsd
maintainers         nomaintainer
homepage            http://tcpcrypt.org/
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.

fetch.type          git
git.url             git://github.com/sorbo/${real_name}.git
git.branch          07d75864a38d853316d4
use_configure       no
build.dir           ${worksrcpath}/user
depends_lib         path:lib/libssl.dylib:openssl

destroot {
  set docdir  ${destroot}${prefix}/share/doc/${real_name}
  set datadir ${destroot}${prefix}/share/${real_name}
  set libdir  ${destroot}${prefix}/lib
  set sbindir ${destroot}${prefix}/sbin
  xinstall -d ${docdir} ${datadir}

  xinstall {*}[glob ${build.dir}/lib/*.dylib]       ${libdir}
  xinstall -W ${build.dir} ${real_name}/tcpcryptd     ${sbindir}
  xinstall -W ${build.dir} launch_tcpcryptd.sh        ${datadir}
  xinstall -m 640 {*}[glob ${worksrcpath}/README*]  ${docdir}
  
  # fix launch script
  reinplace -E "s|^TCPCRYPTD=.+$|TCPCRYPTD=${prefix}/sbin/tcpcryptd|" ${datadir}/launch_tcpcryptd.sh
}

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