# 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="http://software.inl.fr/releases/nfqueue-bindings/${P}.tar.gz" KEYWORDS="~x86 ~amd64" SLOT="0" LICENSE="GPL-3" IUSE="perl python examples" DEPEND="python? ( virtual/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/* }