summaryrefslogtreecommitdiff
blob: 2d77375bf19e5b3cf50971ed4930ea104bdd7b00 (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
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=2
inherit cmake-utils perl-module linux-info


DESCRIPTION="nfqueue-bindings is a set of high-level modules for several
languages (Python and Perl, for the moment), for libnetfilter_queue"
HOMEPAGE="http://software.inl.fr/trac/wiki/nfqueue-bindings"
SRC_URI="https://www.wzdftpd.net/redmine/attachments/download/59/${P}.tar.gz"

KEYWORDS="~x86 ~amd64"
SLOT="0"
LICENSE="GPL-3"
IUSE="perl python examples"

DEPEND="python? (
		dev-lang/python
		dev-python/dpkt
	)
	perl? ( dev-lang/perl )
	net-libs/libnetfilter_queue
	dev-lang/swig"

pkg_setup() {
	# At least one of Python or Perl must be selected
	useq python || useq perl || die "At least one supported language must be selected."
	# Check kernel configuration for NFQUEUE
	if linux_config_exists; then
		ebegin "Checking NETFILTER_NETLINK_QUEUE support"
		linux_chkconfig_present NETFILTER_NETLINK_QUEUE
		eend $? || \
			eerror 'Netfilter NFQUEUE over NFNETLINK interface support not found!'
		ebegin "Checking NETFILTER_XT_TARGET_NFQUEUE support"
		linux_chkconfig_present NETFILTER_XT_TARGET_NFQUEUE
		eend $? || \
			eerror '"NFQUEUE" target Support not found!'
	fi
}

src_unpack() {
	unpack ${A}
	perl_set_version
	# Fix include Perl search directory
	sed -i "/SET[[:space:]]*([[:space:]]*PERL_POSSIBLE_INCLUDE_PATHS/a\  ${ARCH_LIB}/CORE" ${P}/FindPerlLibs2.cmake
	# Fix Perl destination directory
	sed -i "/DESTINATION/s#\(perl\${PERL_VERSION}\)#\1/site_perl/${PERL_VERSION}/${ARCH_LIB##*/}#g" ${P}/perl/CMakeLists.txt
	# Disable Perl/Python from USE flags
	useq perl || sed -i '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*perl[[:space:]]*)/s/^/#/g' ${P}/CMakeLists.txt
	useq python || sed -i '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*python[[:space:]]*)/s/^/#/g' ${P}/CMakeLists.txt
}

src_install() {
	emake DESTDIR="${D}" install PREFIX=/usr || die
	docinto examples
	useq examples && dodoc examples/*
}