summaryrefslogtreecommitdiff
blob: 4eab84a596a86deca0185c6cdd71c6d87f9ab57b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ns/ns-2.26.ebuild,v 1.1 2004/01/11 12:51:39 robbat2 Exp $

DESCRIPTION="Network Simulator"
HOMEPAGE="http://www.isi.edu/nsnam/ns/"
SRC_URI="http://www.isi.edu/nsnam/dist/${PN}-src-${PV}.tar.gz"
LICENSE="BSD as-is"
SLOT="0"
KEYWORDS="~x86"
IUSE="doc debug"
DEPEND_COMMON=">=dev-lang/tcl-8.3.2
		>=dev-lang/tk-8.3.2
		>=dev-tcltk/otcl-1.0.8a
		>=dev-tcltk/tclcl-1.0.13b
		net-libs/libpcap
		debug? ( =dev-lang/perl-5* >=media-gfx/xgraph-12.1 >=dev-libs/dmalloc-4.8.2 >=dev-tcltk/tcl-debug-2.0 )"
DEPEND="doc? ( app-text/tetex app-text/ghostscript dev-tex/latex2html ) ${DEPEND_COMMON}"
# for later
#RDEPEND=">=net-analyzer/nam-1.9 ${DEPEND_COMMON}"

S=${WORKDIR}/${P}

src_unpack() {
	unpack ${A}
	cd ${S}
	grep -ri 'tcl\.result[[:space:]]*()' * -l | \
	xargs -r -n1 sed -e 's|tcl\.result[[:space:]]*()|(char*)tcl.result()|' -i
}

src_compile() {
	local myconf
	use debug && myconf="${myconf} --with-tcldebug=/usr/lib/tcldbg2.0" || myconf="${myconf} --with-tcldebug=no"
	myconf="${myconf} `use_with debug dmalloc`"
	local mytclver=""
	for i in 8.4 8.3; do
		einfo "Testing TCL ${i}"
		has_version "=dev-lang/tcl-${i}*" && mytclver=${i}
		[ "${#mytclver}" -gt 2 ] && break
	done
	einfo "Using TCL ${mytclver}"
	myconf="${myconf} --with-tcl-ver=${mytclver} --with-tk-ver=${mytclver}"

	econf \
	${myconf} \
	--mandir=/usr/share/man \
	--enable-stl \
	--enable-release || die "./configure failed"
	emake CCOPT="${CFLAGS}" || die
}

src_install() {
	dodir /usr/bin
	dodir /usr/share/man/man1
	make DESTDIR=${D} MANDEST=/usr/share/man install || die
	dobin nse

	dodoc BASE-VERSION COPYRIGHTS FILES HOWTO-CONTRIBUTE README VERSION
	dohtml CHANGES.html TODO.html

	if use doc; then
		einfo "Generating extra docs"
		cd doc
		docinto doc
		emake all
		dodoc everything.dvi everything.ps.gz everything.html everything.pdf
	fi
}