# -*- 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           boost 1.0
PortGroup           github 1.0
PortGroup           openssl 1.0

github.setup        simsong tcpflow 1.6.1 tcpflow-
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2

conflicts           ${name}-devel

subport ${name}-devel {
    github.setup    simsong tcpflow 467b380642e8e126d1ef5ddf30638deffb6fb2ad
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         20240919
    revision        0

    conflicts       ${name}
}

categories          net security
platforms           darwin freebsd
maintainers         nomaintainer
license             GPL-2

description         TCP flow recorder
long_description    tcpflow is a program that captures data transmitted as \
                    part of TCP connections (flows), and stores the data in a \
                    way that is convenient for protocol analysis or debugging. \
                    A program like tcpdump(4) shows a summary of packets seen \
                    on the wire, but usually doesn't store the data that's \
                    actually being transmitted. In contrast, tcpflow \
                    reconstructs the actual data streams and stores each flow \
                    in a separate file for later analysis. tcpflow understands \
                    TCP sequence numbers and will correctly reconstruct data \
                    streams regardless of retransmissions or out-of-order \
                    delivery.

depends_build-append \
                    port:autoconf \
                    port:automake

depends_lib-append  port:bzip2 \
                    path:lib/pkgconfig/cairo.pc:cairo \
                    port:expat \
                    port:fontconfig \
                    port:freetype \
                    port:libpcap \
                    path:lib/pkgconfig/pixman-1.pc:libpixman \
                    port:zlib

boost.depends_type  build

# Fetch from git instead of distfile because it needs submodules.
fetch.type          git

post-fetch {
    system -W ${worksrcpath} "git submodule update --init"
}

patchfiles          

if {${subport} eq "${name}"} {
    patchfiles-append \
                    patch-configure.ac.diff \
                    patch-fix-includes.diff
} else {
    patchfiles-append \
                    patch-configure.ac-devel.diff \
                    patch-fix-macOS-build.diff
}

compiler.cxx_standard 2017

pre-configure {
    system -W ${worksrcpath} "sh ./bootstrap.sh"
}

configure.args      ac_cv_func_tre_regcomp=no \
                    ac_cv_func_tre_version=no \
                    ac_cv_header_tre_tre_h=no \
                    ac_cv_lib_tre_tre_regcomp=no
