PortSystem        1.0

name              arpwatch
version           2.1a15
revision          2
categories        net
license           BSD
platforms         darwin
maintainers       {wohner.eu:normen @Gminfly} openmaintainer

description       Monitor ARP & RARP requests
long_description  Arpwatch monitors ethernet activity and maintains a \
                  database of ethernet/ip address pairings. It also \
                  reports certain changes via email.

homepage          http://online.securityfocus.com/tools/142
master_sites      ftp://ftp.ee.lbl.gov

checksums         sha1 9dffaec0f132e5bb7aedfc840c5c67068bfbce69 \
		  rmd160 a27ee53275dcec3cafb85eb3df2451d42ec32b0c

livecheck.url	  "http://www.freebsd.org/cgi/ports.cgi?query=${name}&stype=all"
livecheck.regex	  ">${name}-(.*?)<"
livecheck.version 2.1.a15_4

depends_lib       port:libpcap

set sharedir ${prefix}/share/${name}-${version}
pre-configure {
    reinplace "s|INCLS = -I.|INCLS = -I. -I${prefix}/include|" ${worksrcpath}/Makefile.in
    reinplace "s|LIBS = @LIBS@|LIBS = -L${prefix}/lib @LIBS@|" ${worksrcpath}/Makefile.in
    reinplace "s|ARPDIR = .*|ARPDIR = ${prefix}/var/arpwatch|" ${worksrcpath}/Makefile.in

    set ethercodes ${sharedir}/ethercodes.dat
    reinplace "s|-DARPDIR|-DETHERCODES=\\\\\"${ethercodes}\\\\\" -DARPDIR|" \
        ${worksrcpath}/Makefile.in
}

configure.cflags-append     "-DBIND_8_COMPAT=1"
configure.args    --mandir=${prefix}/share/man

post-configure {
    reinplace "s|-o bin -g bin||g" ${worksrcpath}/Makefile
    reinplace "/#define ETHERCODES .*/D" ${worksrcpath}/arpwatch.h
}

destroot.target   install install-man
post-destroot {
    set destsharedir ${destroot}${sharedir}
    file mkdir ${destsharedir}

    xinstall -W ${build.dir} CHANGES FILES INSTALL README arp2ethers arpfetch \
    	bihourly.sh ethercodes.dat d.awk duplicates.awk e.awk euppertolower.awk \
	massagevendor p.awk ${destsharedir}
}