Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1 | SUMMARY = "Netfilter Tables userspace utillites" |
| 2 | SECTION = "net" |
| 3 | LICENSE = "GPL-2.0-only" |
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=d1a78fdd879a263a5e0b42d1fc565e79" |
| 5 | |
| 6 | DEPENDS = "libmnl libnftnl bison-native \ |
| 7 | ${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}" |
| 8 | |
| 9 | SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.xz \ |
| 10 | file://run-ptest \ |
| 11 | " |
| 12 | SRC_URI[sha256sum] = "2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c" |
| 13 | |
| 14 | inherit autotools manpages pkgconfig ptest |
| 15 | |
| 16 | PACKAGECONFIG ?= "python readline json" |
| 17 | PACKAGECONFIG[editline] = "--with-cli=editline, , libedit, , , linenoise readline" |
| 18 | PACKAGECONFIG[json] = "--with-json, --without-json, jansson" |
| 19 | PACKAGECONFIG[linenoise] = "--with-cli=linenoise, , linenoise, , , editline readline" |
| 20 | PACKAGECONFIG[manpages] = "--enable-man-doc, --disable-man-doc, asciidoc-native" |
| 21 | PACKAGECONFIG[mini-gmp] = "--with-mini-gmp, --without-mini-gmp" |
| 22 | PACKAGECONFIG[python] = "--enable-python --with-python-bin=${PYTHON}, --disable-python, python3-setuptools-native" |
| 23 | PACKAGECONFIG[readline] = "--with-cli=readline, , readline, , , editline linenoise" |
| 24 | PACKAGECONFIG[xtables] = "--with-xtables, --without-xtables, iptables" |
| 25 | |
| 26 | EXTRA_OECONF = "${@bb.utils.contains_any('PACKAGECONFIG', 'editline linenoise readline', '', '--without-cli', d)}" |
| 27 | |
| 28 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)} |
| 29 | |
| 30 | RRECOMMENDS:${PN} += "kernel-module-nf-tables" |
| 31 | |
| 32 | PACKAGES =+ "${PN}-python" |
| 33 | FILES:${PN}-python = "${nonarch_libdir}/${PYTHON_DIR}" |
| 34 | RDEPENDS:${PN}-python = "python3-core python3-json ${PN}" |
| 35 | |
| 36 | RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux" |
| 37 | |
| 38 | TESTDIR = "tests" |
| 39 | |
| 40 | PRIVATE_LIBS:${PN}-ptest:append = "libnftables.so.1" |
| 41 | |
| 42 | do_install:append() { |
| 43 | # Avoid "contains reference to TMPDIR" warning |
| 44 | find ${D} -name *.pyc -delete |
| 45 | } |
| 46 | |
| 47 | do_install_ptest() { |
| 48 | cp -rf ${S}/build-aux ${D}${PTEST_PATH} |
| 49 | cp -rf ${S}/src ${D}${PTEST_PATH} |
| 50 | mkdir -p ${D}${PTEST_PATH}/src/.libs |
| 51 | cp -rf ${B}/src/.libs/* ${D}${PTEST_PATH}/src/.libs |
| 52 | cp -rf ${B}/src/.libs/nft ${D}${PTEST_PATH}/src/ |
| 53 | cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}/${TESTDIR} |
| 54 | sed -i 's#/usr/bin/python#/usr/bin/python3#' ${D}${PTEST_PATH}/${TESTDIR}/json_echo/run-test.py |
| 55 | sed -i 's#/usr/bin/env python#/usr/bin/env python3#' ${D}${PTEST_PATH}/${TESTDIR}/py/nft-test.py |
| 56 | # handle multilib |
| 57 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest |
| 58 | } |