Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 1 | SUMMARY = "Netfilter Tables userspace utillites" |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame^] | 2 | DESCRIPTION = "nftables replaces the popular {ip,ip6,arp,eb}tables. \ |
| 3 | This software provides an in-kernel packet classification framework \ |
| 4 | that is based on a network-specific Virtual Machine (VM), \ |
| 5 | nft, a userspace command line tool and libnftables, a high-level userspace library." |
| 6 | HOMEPAGE = "https://netfilter.org/projects/nftables" |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 7 | SECTION = "net" |
| 8 | LICENSE = "GPL-2.0-only" |
| 9 | LIC_FILES_CHKSUM = "file://COPYING;md5=81ec33bb3e47b460fc993ac768c74b62" |
| 10 | |
| 11 | DEPENDS = "libmnl libnftnl bison-native \ |
| 12 | ${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}" |
| 13 | |
| 14 | SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.xz \ |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame^] | 15 | file://0001-tests-shell-Fix-sets-reset_command_0-for-current-ker.patch \ |
| 16 | file://0001-tests-shell-skip-secmark-tests-if-kernel-does-not-su.patch \ |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 17 | file://run-ptest \ |
| 18 | " |
| 19 | SRC_URI[sha256sum] = "a3c304cd9ba061239ee0474f9afb938a9bb99d89b960246f66f0c3a0a85e14cd" |
| 20 | |
| 21 | inherit autotools manpages pkgconfig ptest |
| 22 | |
| 23 | PACKAGECONFIG ?= "python readline json" |
| 24 | PACKAGECONFIG[editline] = "--with-cli=editline, , libedit, , , linenoise readline" |
| 25 | PACKAGECONFIG[json] = "--with-json, --without-json, jansson" |
| 26 | PACKAGECONFIG[linenoise] = "--with-cli=linenoise, , linenoise, , , editline readline" |
| 27 | PACKAGECONFIG[manpages] = "--enable-man-doc, --disable-man-doc, asciidoc-native" |
| 28 | PACKAGECONFIG[mini-gmp] = "--with-mini-gmp, --without-mini-gmp" |
| 29 | PACKAGECONFIG[python] = ",, python3-setuptools-native" |
| 30 | PACKAGECONFIG[readline] = "--with-cli=readline, , readline, , , editline linenoise" |
| 31 | PACKAGECONFIG[xtables] = "--with-xtables, --without-xtables, iptables" |
| 32 | |
| 33 | EXTRA_OECONF = " \ |
| 34 | ${@bb.utils.contains_any('PACKAGECONFIG', 'editline linenoise readline', '', '--without-cli', d)}" |
| 35 | |
| 36 | SETUPTOOLS_SETUP_PATH = "${S}/py" |
| 37 | |
| 38 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'setuptools3', '', d)} |
| 39 | |
| 40 | RRECOMMENDS:${PN} += "kernel-module-nf-tables" |
| 41 | |
| 42 | PACKAGES =+ "${PN}-python" |
| 43 | FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}" |
| 44 | RDEPENDS:${PN}-python = "python3-core python3-json ${PN}" |
| 45 | |
| 46 | # Explicitly define do_configure, do_compile and do_install because both autotools and setuptools3 |
| 47 | # have EXPORT_FUNCTIONS do_configure do_compile do_install |
| 48 | do_configure() { |
| 49 | autotools_do_configure |
| 50 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then |
| 51 | setuptools3_do_configure |
| 52 | fi |
| 53 | } |
| 54 | |
| 55 | do_compile() { |
| 56 | autotools_do_compile |
| 57 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then |
| 58 | setuptools3_do_compile |
| 59 | fi |
| 60 | } |
| 61 | |
| 62 | do_install() { |
| 63 | autotools_do_install |
| 64 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then |
| 65 | setuptools3_do_install |
| 66 | fi |
| 67 | } |
| 68 | |
| 69 | RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux" |
| 70 | |
| 71 | TESTDIR = "tests" |
| 72 | |
| 73 | PRIVATE_LIBS:${PN}-ptest:append = " libnftables.so.1" |
| 74 | |
| 75 | do_install_ptest() { |
| 76 | cp -rf ${S}/build-aux ${D}${PTEST_PATH} |
| 77 | cp -rf ${S}/src ${D}${PTEST_PATH} |
| 78 | mkdir -p ${D}${PTEST_PATH}/src/.libs |
| 79 | cp -rf ${B}/src/.libs/* ${D}${PTEST_PATH}/src/.libs |
| 80 | cp -rf ${B}/src/.libs/nft ${D}${PTEST_PATH}/src/ |
| 81 | cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}/${TESTDIR} |
| 82 | sed -i 's#/usr/bin/python#/usr/bin/python3#' ${D}${PTEST_PATH}/${TESTDIR}/json_echo/run-test.py |
| 83 | sed -i 's#/usr/bin/env python#/usr/bin/env python3#' ${D}${PTEST_PATH}/${TESTDIR}/py/nft-test.py |
| 84 | # handle multilib |
| 85 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest |
| 86 | } |