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

name                    sancp
version                 1.6.1
revision                1
checksums               rmd160  361e7879594c0c2609213b6a43d1309a3218f229 \
                        sha256  9836262aaf02bde116a9e79d342ea3af8b4991c7ba27b816fb54ed6c0863ff48 \
                        size    71748

categories              security
license                 QPL-1
maintainers             nomaintainer

description             Security Analyst Network Connection Profiler

long_description        This is a network security tool designed to collect \
                        statistical information regarding network traffic, \
                        as well as, collect the traffic itself in pcap \
                        format, all for the purpose of: auditing, historical \
                        analysis, and network activity discovery.
platforms               darwin

homepage                http://sancp.sourceforge.net
distname                ${distname}-stable
master_sites            sourceforge:project/${name}/${name}/${distname}/

depends_lib             port:libpcap

patchfiles              Makefile.patch \
                        pcapFileHandle.h.patch \
                        sancp.cc.patch

build.target            bsd

destroot {
    xinstall -m 0755 ${worksrcpath}/sancp ${destroot}${prefix}/bin
    xinstall -m 0755 ${worksrcpath}/etc/sancp/sancp.conf \
        ${destroot}${prefix}/etc/sancp.conf.sample

    xinstall -m 0755 -d ${destroot}${prefix}/share/doc/sancp
    xinstall -m 0644 \
        ${worksrcpath}/LICENSE \
        {*}[glob ${worksrcpath}/docs/*] \
        ${destroot}${prefix}/share/doc/sancp
    xinstall -m 0755 -d ${destroot}${prefix}/var/log/sancp
        destroot.keepdirs ${destroot}${prefix}/var/log/sancp

    xinstall -m 0755 -d ${destroot}${prefix}/share/sancp
    xinstall -m 0755 ${filespath}/sancp.init \
        ${destroot}${prefix}/share/sancp
    reinplace "s|__PREFIX__|${prefix}|g" \
        ${destroot}${prefix}/share/sancp/sancp.init
}

startupitem.create      yes
startupitem.executable  ${prefix}/share/sancp/sancp.init

platform linux {
    build.target        linux
}

notes "
Rename and configure the sample sancp.conf file in ${prefix}/etc/sancp. If\
you want to sniff an interface other than en0, edit the startup script\
${prefix}/share/sancp/sancp.init (but your changes will be lost if the port\
is upgraded or deactivated).
"