# -*- 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                hping3
version             20051105
revision            2
categories          net security
platforms           darwin
maintainers         {wohner.eu:normen @Gminfly} openmaintainer
license             GPL-2 MIT

description         hping is a command-line oriented TCP/IP packet assembler/analyzer
long_description \
    hping is a command-line oriented TCP/IP packet assembler/analyzer. \
    The interface is inspired to the ping(8) unix command, but hping \
    is not only able to send ICMP echo requests. It supports TCP, UDP, \
    ICMP and RAW-IP protocols, has a traceroute mode, the ability to send \
    files between a covered channel, and many other features.

homepage            http://www.hping.org
master_sites        ${homepage}

depends_lib         port:libpcap

checksums           rmd160  e4ec209228b5cb99e2d561c5a7b1c82ff8abe540 \
                    sha256  f5a671a62a11dc8114fa98eade19542ed1c3aa3c832b0e572ca0eb1a5a4faee8

patchfiles          patch-Makefile.in.diff patch-libpcap_stuff.c.diff \
                    patch-script.c.diff patch-sendip.c.diff patch-ars.c.diff \
                    patch-bytesex.h.diff patch-gethostname.c.diff

configure.args      --no-tcl

post-configure {
    reinplace "s#/usr/local#${prefix}#g" ${worksrcpath}/Makefile
    reinplace "s#MANPATH=#MANPATH=${prefix}/share/man#g" \
              ${worksrcpath}/Makefile
    reinplace "s#INSTALL_PATH=#INSTALL_PATH=${destroot}${prefix}#g" \
              ${worksrcpath}/Makefile
    reinplace "s#INSTALL_MANPATH=#INSTALL_MANPATH=${destroot}#g" \
              ${worksrcpath}/Makefile
}

variant universal {}

build.args          CC=${configure.cc} \
                    CCOPT="${configure.cflags} [get_canonical_archflags cc]"

post-build {
    system -W ${worksrcpath} "make strip"
}

post-destroot {
    file delete ${destroot}${prefix}/sbin/hping
    file delete ${destroot}${prefix}/sbin/hping2
}

default_variants +tcl

variant tcl description "Add the Tcl scripting support" {
    depends_lib-append      port:tcl
    configure.args-delete   --no-tcl
}

livecheck.type      none