# $Id: Portfile,v 1.8 2005/04/21 15:57:56 jberry Exp $

PortSystem 1.0

name	   netwib
version	   5.30.0
set	   NetWVers 530
categories	    net
platforms	    darwin
maintainers	    jmpp@opendarwin.org

description	    A network library oriented towards developers.
long_description      Netwib is a network library providing network features \
		      such as address conversion, udp/tcp clients/servers, packet \
		      encoding/decoding/displaying, spoofing, sniffing, etc., and \
		      general features such as data conversion, linked list and \
		      hash, portable threads, etc. Using all these functions, a \
		      network program can be quickly created.

homepage	http://www.laurentconstantin.com/
master_sites	${homepage}common/netw/${name}/download/v5/ \
		http://www.mirrors.wiretapped.net/security/packet-construction/${name}
extract.suffix	.tgz
distfiles	${distname}-src${extract.suffix} \
		${distname}-doc_html${extract.suffix}
checksums	${distname}-src${extract.suffix} md5 dcd41f26fc8a0ea381c48940c072ef61 \
		${distname}-doc_html${extract.suffix} md5 cb56b8844c3a2322e365e265e30d37fd

depends_lib	port:libpcap \
		port:libnet11

worksrcdir	${distname}-src/src

pre-configure	{
		cd ${worksrcpath}
		reinplace "s|/usr/local|${prefix}|g" config.dat
		reinplace "s|\\(NETWIBDEF_PROGCC_INC=\\)\"\"|\\1-I${prefix}/include|g" config.dat
		reinplace "s|\\(NETWIBDEF_PROGCC_LIB=\\)\"\"|\\1-L${prefix}/lib|g" config.dat
		reinplace "s|/man|/share/man|g" config.dat
		reinplace "s|/share/man3|/man3|g" config.dat
		reinplace "s|/usr/include/pcap/|${prefix}/include/pcap|g" genemake
}

configure.pre_args	{}
configure.cmd		./genemake

post-destroot	{
		xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
		file copy ${workpath}/${distname}-doc_html ${destroot}${prefix}/share/doc/${name}/html
		xinstall -m 644 -v -W ${worksrcpath}/../doc/ changelog.txt credits.txt \
		guidestyle.txt todo.txt ${destroot}${prefix}/share/doc/${name}/
}

post-activate	{
		ui_msg "\nFull html documentation is installed as part of the port at:\n
		${prefix}/share/doc/${name}/html/\n"
}
