summaryrefslogtreecommitdiff
blob: 4d8aa8a91b7d61703613611d7094a26a82256e19 (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-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-libs/libpcap-ringbuffer/libpcap-ringbuffer-1.0.20050129-r2.ebuild,v 1.2 2005/06/11 13:41:09 dholm Exp $

inherit toolchain-funcs linux-info multilib eutils

MY_P=${PN:0:7}-${PV}

DESCRIPTION="A libpcap version which supports MMAP mode (ringbuffer)  on the linux kernel 2.[46].x"
HOMEPAGE="http://public.lanl.gov/cpw/"
SRC_URI="${HOMEPAGE}${MY_P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~ppc ~x86"
IUSE="ipv6"

DEPEND="virtual/libc
	!virtual/libpcap"

PROVIDE="virtual/libpcap"

S=${WORKDIR}/${MY_P}

# Used in linux-info to check minium Kernel support
CONFIG_CHECK="PACKET_MMAP"
PACKET_MMAP_ERROR="Make sure you have PACKET_MMAP compiled in your kernel to make use of libpcap's ringbuffer feature."

src_unpack() {
	unpack ${A}
	cd ${S}
	sed -i 's:@CFLAGS@:@CFLAGS@ -fPIC:' Makefile.in || die "fPIC patch failed."
	epatch ${FILESDIR}/${P}-mmap-exec.patch
	epatch ${FILESDIR}/${P}-makefile.patch
}

src_compile() {
	cd ${S}
	econf `use_enable ipv6` --with-pcap=ring || die "bad configure"
	emake || die "compile problem"

	# no provision for this in the Makefile, so...
	$(tc-getCC) -Wl,-soname,libpcap.so.0 -shared -fPIC -o libpcap.so.${PV:0:3} *.o \
		|| die "couldn't make a shared lib"
}

src_install() {
	dodir /usr/include
	dodir /usr/$(get_libdir)
	emake DESTDIR=${D} install || die "install problem"
	dodoc CREDITS CHANGES FILES README* VERSION
	mv libpcap.so.${PV:0:3} libpcap.so.${PV:0:3}.0
	dolib libpcap.so.${PV:0:3}.0
}

pkg_postinst() {
	einfo "For usage with tcpdump and further details see:"
	einfo "/usr/share/doc/${PF}/README.ring.gz"
}