# -*- 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           github 1.0
PortGroup           legacysupport 1.1

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

github.setup        tomaszmrugalski dibbler a7c6cf58a88a510cb00841351e75030ce78d36bf
version             1.0.2RC1-20200723
revision            0
checksums           rmd160  3adcf88a09ff95b755ed8250c11fdf90edc43671 \
                    sha256  86953fb8917dc2457905fca2ab8bccaea228a85a9e6b821dca44d86962d8798f \
                    size    4498225

categories          net
license             GPL-2
maintainers         nomaintainer

installs_libs       no

description         A portable DHCPv6
long_description    Dibbler is a portable DHCPv6 implementation. It \
                    supports stateful (i.e. IPv6 address granting and \
                    IPv6 prefix delegation) as well as stateless (i.e. \
                    option granting) autoconfiguration for IPv6.

homepage            http://klub.com.pl/dhcpv6/
github.tarball_from archive

patchfiles          0-enable-prefix.patch \
                    1-correct-man-pages.patch

post-patch {
    reinplace "s|__PREFIX__|${prefix}|g" \
        Misc/Portable.h \
        doc/examples/client.conf \
        doc/examples/server.conf \
        doc/man/dibbler-client.8 \
        doc/man/dibbler-relay.8 \
        doc/man/dibbler-server.8 \
        scripts/notify-scripts/server-notify.sh
}

post-destroot {
    xinstall -d -m 0755 ${destroot}${prefix}/share/examples
    move ${destroot}${prefix}/share/doc/dibbler/examples \
        ${destroot}${prefix}/share/examples/${name}

    xinstall -d -m 0755 ${destroot}${prefix}/etc/dibbler
    foreach conf {client.conf relay.conf server.conf} {
        ln -s ../../../share/examples/${name}/${conf} \
            ${destroot}${prefix}/etc/dibbler/${conf}.sample
    }
}
destroot.keepdirs       ${destroot}${prefix}/var/lib/dibbler \
                        ${destroot}${prefix}/var/log/dibbler

startupitem.create      yes
startupitem.executable  ${prefix}/sbin/dibbler-server run

notes "
Before using Dibbler, make copies of the appropriate sample\
configuration files and edit as necessary.

    sudo ditto ${prefix}/etc/${name}/client.conf{.sample,}
    sudo ditto ${prefix}/etc/${name}/server.conf{.sample,}
    sudo ditto ${prefix}/etc/${name}/relay.conf{.sample,}
"
