summaryrefslogtreecommitdiff
blob: 9fdf7367e927c0927fa08e813bcb321c320d6967 (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/traffic-vis/traffic-vis-0.35-r2.ebuild,v 1.5 2011/12/07 07:37:28 phajdan.jr Exp $

EAPI="2"

inherit eutils toolchain-funcs

DESCRIPTION="Generate traffic stats in html, ps, text and gif format"
HOMEPAGE="http://www.mindrot.org/traffic-vis.html"
SRC_URI="http://www.mindrot.org/files/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ~ppc x86"

IUSE="gif"
DEPEND="net-libs/libpcap
	gif? ( media-libs/netpbm
		app-text/ghostscript-gpl
		dev-lang/perl )
	=dev-libs/glib-1.2*"

RDEPEND="${DEPEND}"

src_prepare() {
	epatch "${FILESDIR}"/${P}-gentoo.patch
	epatch "${FILESDIR}"/${P}-libpcap-header-fix.patch

	# bug 143930 - traffic-vis expects /usr/sbin/traffic-tops
	sed -i frontends/traffic-togif \
		-e "s:/usr/sbin/traffic-tops:/usr/bin/traffic-tops:g" \
		|| die "sed frontends/traffic-togif"
	# drop DEBUG flags
	sed -i -e "/^DEBUGFLAGS/d" Makefile || die
	tc-export CC
}

src_install() {
	dosbin collector/traffic-collector || die
	doman collector/traffic-collector.8 || die

	for mybin in $(use gif && echo frontends/traffic-togif) \
			frontends/traffic-tohtml \
			frontends/traffic-tops \
			frontends/traffic-totext \
			sort/traffic-sort \
			utils/traffic-exclude \
			utils/traffic-resolve ; do

		dobin ${mybin} || die
		doman ${mybin}.8 || die
	done

	newinitd "${FILESDIR}"/traffic-vis.init.d traffic-vis || die
	newconfd "${FILESDIR}"/traffic-vis.conf.d traffic-vis || die

	dodoc TODO README BUGS CHANGELOG || die
}