summaryrefslogtreecommitdiff
blob: 7b0de982500cc35ba8ff8a7d8ee228696d61b1c3 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-firewall/ipp2p/ipp2p-0.8.2-r3.ebuild,v 1.1 2007/05/22 17:30:56 mrness Exp $

inherit linux-mod eutils

DESCRIPTION="Netfilter module for dealing with P2P Applications."
HOMEPAGE="http://www.ipp2p.org/index_en.html"
SRC_URI="http://www.ipp2p.org/downloads/${P}.tar.gz"

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

RDEPEND="virtual/modutils
	 >=net-firewall/iptables-1.2.11"

DEPEND="${RDEPEND}
	virtual/linux-sources"

pkg_setup() {
	CONFIG_CHECK="NETFILTER"
	NETFILTER_ERROR="Your kernel is not configured to support Netfilter."
	MODULE_NAMES="ipt_ipp2p(${PN}:${S}:${S})"

	linux-mod_pkg_setup
}

src_unpack() {
	unpack ${A}

	cd "${S}"
	epatch "${FILESDIR}"/${P}-kernel-2.6.21.patch
	convert_to_m Makefile

	sed -i -e "s/^IPTABLES_VERSION/#IPTABLES_VERSION/" Makefile
	if has_version '>=net-firewall/iptables-1.3.6' ; then
	    sed -i -e "s/ld -shared/\$\(CC\) -shared/" Makefile
	fi
}

src_compile() {
	local IPTABLES_VERSION="$(/sbin/iptables --version | cut -f2 -dv)"
	emake CFLAGS="${CFLAGS}" CC="$(tc-getCC)" \
	    IPTABLES_SRC="/usr" IPTABLES_VERSION="${IPTABLES_VERSION}" libipt_ipp2p.so \
	    || die "Failed to build iptables module"

	local myARCH="${ARCH}"
	ARCH="$(tc-arch-kernel)"
	emake KERNEL_SRC="${KV_DIR}" \
	    IPTABLES_SRC="/usr" IPTABLES_VERSION="${IPTABLES_VERSION}" \
	    || die "Failed to build kernel module."
	ARCH="${myARCH}"
}

src_install() {
	exeinto /$(get_libdir)/iptables
	doexe libipt_ipp2p.so

	dodoc README
	linux-mod_src_install
}

pkg_postinst() {
	linux-mod_pkg_postinst
}