# -*- 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                tcptrace
version             6.6.7
revision            1
categories          net
platforms           darwin
license             GPL

maintainers         nomaintainer

description         A TCP dump file analysis tool

long_description \
    tcptrace a TCP dump file analysis tool written by Shawn Ostermann at \
    Ohio University. It is NOT a packet capture program. It reads output \
    dump files in the formats of several popular packet capturing \
    programs: tcpdump, snoop, etherpeek, and netm.  It can also output \
    (i.e. convert thus converting to) tcpdump format files.

homepage            http://tcptrace.org
master_sites        http://tcptrace.org/download/

checksums           tcptrace-${version}.tar.gz \
                        rmd160  1dd0f373f766322343ffad59d0655eba4c6682e0 \
                        sha256  63380a4051933ca08979476a9dfc6f959308bc9f60d45255202e388eb56910bd \
                    tcptrace_6.6.7-3.diff.gz \
                        rmd160  bde0be924b6789189a4a14c6c5adb5b5a7041054 \
                        sha256  9a5212155f5cd4bc9bfefaa73da8d3b4084a96865bcc1e96232a1e1b265bb54a

depends_lib         lib:libpcap:libpcap

patch_sites         https://cloudfront.debian.net/debian-archive/debian/pool/main/t/tcptrace/
patchfiles          tcptrace_6.6.7-3.diff.gz
patch.pre_args      -p1

post-configure {
    set path "${worksrcpath}"
    reinplace "s|PCAP_INCS    = -I/usr/local/include -I. -I../pcap -I/usr/include/pcap|PCAP_INCS    = -I${prefix}/include|" "${path}/Makefile"
    reinplace "s|PCAP_LDFLAGS = -L/usr/local/lib -Llib -Lpcap -L../pcap -L./cygwin-libs|PCAP_LDFLAGS = -L${prefix}/lib|" "${path}/Makefile"
}

destroot {
    file mkdir ${destroot}${prefix}/bin
    foreach f {tcptrace xpl2gpl} {
        xinstall -m 755 ${worksrcpath}/$f ${destroot}${prefix}/bin/
    }
    file mkdir ${destroot}${prefix}/share/man/man1
    xinstall -m 444 ${worksrcpath}/tcptrace.man ${destroot}${prefix}/share/man/man1/tcptrace.1
    file mkdir ${destroot}${prefix}/share/doc/tcptrace
    foreach f {ARGS COPYING COPYRIGHT README README.mailing_list
        README.modules README.pcap README.tline_graphs
        README.tput_graphs README.version README.xpl2gpl
        THANKS WWW} {
        xinstall -m 444 ${worksrcpath}/$f ${destroot}${prefix}/share/doc/tcptrace/
    }
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     {tcptrace-(\d+(?:\.\d+)*)\.[tz]}