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

name                mtr
version             0.92
revision            1
categories          net
platforms           darwin
license             GPL-2
maintainers         nomaintainer

description         traceroute and ping in a single tool
long_description    mtr combines the functionality of the 'traceroute' \
                    and 'ping' programs in a single network diagnostic \
                    tool. As mtr starts, it investigates the network \
                    connection between the host mtr runs on and \
                    a user-specified destination host. After it \
                    determines the address of each network hop between \
                    the machines, it sends a sequence ICMP ECHO \
                    requests to each one to determine the quality of \
                    the link to each machine. As it does this, it \
                    prints running statistics about each machine.
homepage            http://www.bitwizard.nl/mtr/

depends_build       port:pkgconfig
depends_lib         port:ncurses

master_sites        ftp://ftp.bitwizard.nl/mtr/
checksums           rmd160  7a697e13abfb12e50af43c6d493098dc0a7fe803 \
                    sha256  f2979db9e2f41aa8e6574e7771767c9afe111d9213814eb47f5e1e71876e4382 \
                    size    296430

configure.args      --without-gtk
pre-configure {
    # For some reason, config.h.in is older than aclocal.m4 and configure.ac,
    # which causes the mtr build system to attempt to re-generate it.
    # Re-generating requires an autoconf dependency, so let's avoid it,
    # especially since the file does not change.
    file mtime ${worksrcpath}/config.h.in [file mtime ${worksrcpath}/aclocal.m4]

    # Fix version string
    reinplace "s|0.91.1-4c982|${version}|" ${worksrcpath}/configure
}

post-destroot {
    file attributes ${destroot}${prefix}/sbin/mtr-packet -permissions +s
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     "[quotemeta ${name}]-(\\d(\\.\\d+)*)[quotemeta ${extract.suffix}]"