# $Id: Portfile,v 1.1 2005/07/29 01:38:06 ben Exp $

PortSystem		1.0
name			ns-2
version			20050728
categories		net
maintainers		ben@opendarwin.org
description		The Network Simulator
long_description	Ns is a discrete event simulator targeted \
			at networking research
homepage		http://www.isi.edu/nsnam/ns/
master_sites		http://www.opendarwin.org/~ben/

checksums		md5 b9db3ebbd912bd23c397ed9cca179078

depends_build		port:autoconf \
			port:automake

depends_lib		port:tclcl

patchfiles              conf_configure.in.fns.patch \
			emulate_net-pcap.cc.patch

pre-configure		{
			cd ${worksrcpath}
			system "aclocal && autoconf"
}

configure.args          --with-tcl=${prefix} --with-tcl-ver=8.4 \
                        --with-tk=${prefix} --with-tk-ver=8.4 \
                        --with-otcl=${prefix} \
                        --with-tclcl=${prefix} \
                        --with-perl=${prefix}/bin \
                        --prefix=${prefix} \
			CPPFLAGS='-I/usr/X11R6/include' \
			LDFLAGS='-L/usr/X11R6/lib' \
			CC=gcc-3.3 \
			CXX=g++-3.3

post-configure		{
			reinplace "s|-lXext|-L/usr/X11R6/lib -lXext -L/usr/lib -lSystemStubs|g" \
				${worksrcpath}/Makefile
}

destroot		{
			cd ${worksrcpath}
			xinstall -m 755 ns ${destroot}${prefix}/bin
			xinstall -d -m 755 ${destroot}${prefix}/man/man1
			xinstall -m 644 ns.1 ${destroot}${prefix}/man/man1
			cd ${worksrcpath}/indep-utils/cmu-scen-gen/setdest
			xinstall -m 755 setdest ${destroot}${prefix}/bin
			xinstall -m 755 calcdest ${destroot}${prefix}/bin
			cd ${worksrcpath}/indep-utils/webtrace-conv/dec
			xinstall -m 755 dec-tr-stat ${destroot}${prefix}/bin
			cd ${worksrcpath}/indep-utils/webtrace-conv/epa
			xinstall -m 755 epa-tr-stat ${destroot}${prefix}/bin
			cd ${worksrcpath}/indep-utils/webtrace-conv/nlanr
			xinstall -m 755 nlanr-tr-stat ${destroot}${prefix}/bin
			cd ${worksrcpath}/indep-utils/webtrace-conv/ucb
			xinstall -m 755 ucb-tr-stat ${destroot}${prefix}/bin
}
