# -*- 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
# $Id: Portfile 120992 2014-06-13 19:32:24Z mf2k@macports.org $

PortSystem 1.0

name		hping3
version		20051105
revision	2
categories	net security
platforms       darwin
maintainers	wohner.eu:normen

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}

checksums	sha1 e13d27e14e7f90c2148a9b00a480781732fd351e \
		    rmd160 e4ec209228b5cb99e2d561c5a7b1c82ff8abe540

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 "cd ${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	regex
livecheck.url	${homepage}/download.php
livecheck.regex	${name}-(\[0-9a-z.\]+)${extract.suffix}
