PortSystem          1.0

name                tcpdstat
version             1.0
categories          net security
platforms           darwin
maintainers         nomaintainer

description         network traffic pattern analysis tool

long_description    ${name} produces a per-protocol breakdown of traffic \
                    by bytes and packets, with average and maximum transfer \
                    rates, for a given libpcap file (e.g., from tcpdump, \
                    ethereal, snort, etc.). Useful for getting a high-level \
                    view of traffic patterns.

homepage            http://staff.washington.edu/dittrich/talks/core02/tools/tools.html
master_sites        http://staff.washington.edu/dittrich/talks/core02/tools/

dist_subdir         ${name}/${version}
distname            ${name}-uw
# use_tar is new in MacPorts 2.5.0.
if {[info command use_tar] eq "use_tar"} {
use_tar             yes
} else {
extract.suffix      .tar
extract.cmd         tar
extract.pre_args    -xf
extract.post_args
}

checksums           md5     64b246fb0a4ee47ae37e83d721b205df \
                    sha1    3f0d95499bd33118bbcf86752a2d524eb2802fa7 \
                    rmd160  6b03265d2b075e3f85b4c0e93c42bc05d010fc5e

depends_lib         port:libpcap

patchfiles          patch-Makefile.diff \
                    patch-net_read.c.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/Makefile
}

use_configure       no

build.args          CC="${configure.cc}"

variant universal {}
if {[variant_isset universal]} {
    set archflags ${configure.universal_cflags}
} else {
    set archflags ${configure.cc_archflags}
}
build.args-append   CFLAGS="${archflags}"

destroot.destdir    PREFIX=${destroot}${prefix}