blob: f43a223ac992a07a7590699fda9ffe50284488a4 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "Netfilter Tables userspace utillites"
2SECTION = "net"
3LICENSE = "GPL-2.0-only"
4LIC_FILES_CHKSUM = "file://COPYING;md5=d1a78fdd879a263a5e0b42d1fc565e79"
5
6DEPENDS = "libmnl libnftnl bison-native \
7 ${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}"
8
9SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.xz \
10 file://run-ptest \
11 "
12SRC_URI[sha256sum] = "2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c"
13
14inherit autotools manpages pkgconfig ptest
15
16PACKAGECONFIG ?= "python readline json"
17PACKAGECONFIG[editline] = "--with-cli=editline, , libedit, , , linenoise readline"
18PACKAGECONFIG[json] = "--with-json, --without-json, jansson"
19PACKAGECONFIG[linenoise] = "--with-cli=linenoise, , linenoise, , , editline readline"
20PACKAGECONFIG[manpages] = "--enable-man-doc, --disable-man-doc, asciidoc-native"
21PACKAGECONFIG[mini-gmp] = "--with-mini-gmp, --without-mini-gmp"
22PACKAGECONFIG[python] = "--enable-python --with-python-bin=${PYTHON}, --disable-python, python3-setuptools-native"
23PACKAGECONFIG[readline] = "--with-cli=readline, , readline, , , editline linenoise"
24PACKAGECONFIG[xtables] = "--with-xtables, --without-xtables, iptables"
25
26EXTRA_OECONF = "${@bb.utils.contains_any('PACKAGECONFIG', 'editline linenoise readline', '', '--without-cli', d)}"
27
28inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)}
29
30RRECOMMENDS:${PN} += "kernel-module-nf-tables"
31
32PACKAGES =+ "${PN}-python"
33FILES:${PN}-python = "${nonarch_libdir}/${PYTHON_DIR}"
34RDEPENDS:${PN}-python = "python3-core python3-json ${PN}"
35
36RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux"
37
38TESTDIR = "tests"
39
Andrew Geisslerc5535c92023-01-27 16:10:19 -060040PRIVATE_LIBS:${PN}-ptest:append = " libnftables.so.1"
Andrew Geissler517393d2023-01-13 08:55:19 -060041
42do_install:append() {
43 # Avoid "contains reference to TMPDIR" warning
44 find ${D} -name *.pyc -delete
45}
46
47do_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}