summaryrefslogtreecommitdiff
blob: 5b84c599481d6b1b91fc660678b8f301771dc078 (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
69
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/driftnet/driftnet-0.1.6-r1.ebuild,v 1.2 2006/02/15 22:02:06 jokey Exp $

inherit eutils flag-o-matic

DESCRIPTION="A program which listens to network traffic and picks out images from TCP streams it observes"
HOMEPAGE="http://www.ex-parrot.com/~chris/driftnet/"
SRC_URI="http://www.ex-parrot.com/~chris/${PN}/${P}.tar.gz"

LICENSE="GPL-2"
KEYWORDS="~amd64 ~ppc ~sparc ~x86"
SLOT="0"
IUSE="gtk"

DEPEND="media-libs/jpeg
	media-libs/giflib
	net-libs/libpcap
	gtk? ( <x11-libs/gtk+-1.3.0 )
	|| (
	( >=x11-misc/makedepend-1.0.0 )
	virtual/x11
	)"

# Note: x11 is necessary because of makedepend

RDEPEND="${DEPEND}
	virtual/mpg123"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# use giflib - bug 85720
	sed -i 's/-lungif/-lgif/' Makefile || die "sed giflib failed"
	# don't use gtk+ by default
	sed -i 's:^\(.*gtk-config.*\)$:#\1:g' Makefile || die "sed disable gtk failed"

	epatch "${FILESDIR}"/${P}-tmpnam-is-bad.diff
}

src_compile() {
	append-ldflags $(bindnow-flags)

	if use gtk; then
		sed -i 's:^#\(.*gtk-config.*\)$:\1:g' Makefile || die "sed enable gtk failed"
		emake || die "gtk+ build failed"
		mv driftnet driftnet-gtk
		make clean || die
	else
		append-flags -DNO_DISPLAY_WINDOW
	fi

	emake || die "emake failed"
}

src_install () {
	dobin driftnet || die "dobin failed"
	doman driftnet.1 || die "doman failed"

	use gtk && { dobin driftnet-gtk || die "dobin failed (gtk)" ; }

	dodoc CHANGES CREDITS README TODO || die "dodoc failed"

	einfo "marking the no-display driftnet as setuid root."
	chown root:wheel "${D}/usr/bin/driftnet"
	chmod 750 "${D}/usr/bin/driftnet"
	chmod u+s "${D}/usr/bin/driftnet"
}