# Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=2 inherit cmake-utils perl-module linux-info DESCRIPTION="A set of high-level modules for several languages (Python and Perl, for the moment), for libnetfilter_queue" HOMEPAGE="https://www.wzdftpd.net/redmine/projects/nfqueue-bindings/wiki/" SRC_URI="https://www.wzdftpd.net/redmine/attachments/download/62/${P}.tar.gz" KEYWORDS="~x86 ~amd64" SLOT="0" LICENSE="GPL-3" IUSE="perl python examples" RESTRICT="mirror" DEPEND="python? ( dev-lang/python examples? ( 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 use python || use 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 # Fix Perl library name sed -i "/INSTALL/s#nfqueue.so#libnfqueue.so#g" ${P}/perl/CMakeLists.txt # Disable Perl/Python from USE flags use perl || sed -i '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*perl[[:space:]]*)/s/^/#/g' ${P}/CMakeLists.txt use 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 use examples && dodoc examples/* }