# -*- 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 75021 2011-01-12 06:18:02Z jmr@macports.org $

PortSystem          1.0

name                aiccu
version             20070115
revision            2
categories          net ipv6
platforms           darwin
maintainers         23bit.net:cr

description         Automatic IPv6 Connectivity Configuration Utility
long_description    AICCU makes it very easy for SixXS users to get IPv6 connectivity \
                    everywhere they want. It uses the TIC (Tunnel Information & Control) \
                    protocol to request the information needed to setup a tunnel through \
                    which the connectivity is created. \
                    It supports 6in4 static (RFC 2893), 6in4 heartbeat (RFC 2893 + \
                    draft-massar-v6ops-heartbeat) and AYIYA (draft-massar-v6ops-ayiya) \
                    tunnel protocols.
homepage            http://www.sixxs.net/tools/aiccu/

master_sites        http://www.sixxs.net/archive/sixxs/aiccu/unix/
distname            aiccu_${version}

checksums           md5 c9bcc83644ed788e22a7c3f3d4021350 \
                    sha1 7b3c51bfe291c777e74b2688e9339b4fb72e6a39 \
                    rmd160 9415899c98c1f7e84b9711017b82a3a0ea2ae9de

depends_lib         port:tuntaposx

set kext_dir        ${prefix}/Library/Extensions
set pid_file        ${prefix}/var/run/${name}.pidfile
set conf_file       ${prefix}/etc/aiccu.conf

worksrcdir          aiccu
patchfiles          Makefile.patch aiccu_conf.patch

pre-configure {
        reinplace "s|#pidfile /var/run/aiccu.pid|pidfile ${pid_file}|" \
          ${worksrcpath}/doc/aiccu.conf
}
use_configure       no

build.args-append   MPPREFIX=${prefix}

destroot.args       DESTDIR=${destroot}${prefix}
destroot.destdir    ${destroot}${prefix}

startupitem.create      yes
startupitem.pidfile     clean ${pid_file}
startupitem.start       "kextstat -kl | grep -q 'foo\.tun' || kextload  ${kext_dir}/tun.kext ; \
                         ${prefix}/sbin/aiccu start ${conf_file}"
startupitem.stop        "${prefix}/sbin/aiccu stop ${conf_file}"
startupitem.netchange   yes

variant gnutls description {TIC server transport encryption} {
    depends_lib-append  port:gnutls
    patchfiles-append   gnutls.patch
}

