blob: c5a2968d1810f161afc1035a4e93cbefc42653f0 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001SUMMARY = "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
Andrew Geissler9aee5002022-03-30 16:27:02 +00009SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.bz2 \
Andrew Geissler615f2f12022-07-15 14:00:58 -050010 file://0001-nftables-python-Split-root-from-prefix.patch \
Patrick Williams03907ee2022-05-01 06:28:52 -050011 file://run-ptest \
Andrew Geissler9aee5002022-03-30 16:27:02 +000012 "
13
Patrick Williams8dd68482022-10-04 07:57:18 -050014SRC_URI[sha256sum] = "8d1b4b18393af43698d10baa25d2b9b6397969beecac7816c35dd0714e4de50a"
Andrew Geissler9aee5002022-03-30 16:27:02 +000015
Patrick Williams03907ee2022-05-01 06:28:52 -050016inherit autotools manpages pkgconfig ptest
Andrew Geissler9aee5002022-03-30 16:27:02 +000017
Andrew Geissler615f2f12022-07-15 14:00:58 -050018PACKAGECONFIG ?= "python readline json"
19PACKAGECONFIG[editline] = "--with-cli=editline, , libedit, , , linenoise readline"
Andrew Geissler9aee5002022-03-30 16:27:02 +000020PACKAGECONFIG[json] = "--with-json, --without-json, jansson"
Andrew Geissler615f2f12022-07-15 14:00:58 -050021PACKAGECONFIG[linenoise] = "--with-cli=linenoise, , linenoise, , , editline readline"
Andrew Geissler9aee5002022-03-30 16:27:02 +000022PACKAGECONFIG[manpages] = "--enable-man-doc, --disable-man-doc, asciidoc-native"
23PACKAGECONFIG[mini-gmp] = "--with-mini-gmp, --without-mini-gmp"
Andrew Geissler615f2f12022-07-15 14:00:58 -050024PACKAGECONFIG[python] = "--enable-python --with-python-bin=${PYTHON}, --disable-python, python3-setuptools-native"
25PACKAGECONFIG[readline] = "--with-cli=readline, , readline, , , editline linenoise"
Andrew Geissler9aee5002022-03-30 16:27:02 +000026PACKAGECONFIG[xtables] = "--with-xtables, --without-xtables, iptables"
27
Andrew Geissler615f2f12022-07-15 14:00:58 -050028EXTRA_OECONF = "${@bb.utils.contains_any('PACKAGECONFIG', 'editline linenoise readline', '', '--without-cli', d)}"
29
Andrew Geissler9aee5002022-03-30 16:27:02 +000030inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)}
31
32RRECOMMENDS:${PN} += "kernel-module-nf-tables"
33
34PACKAGES =+ "${PN}-python"
35FILES:${PN}-python = "${nonarch_libdir}/${PYTHON_DIR}"
36RDEPENDS:${PN}-python = "python3-core python3-json ${PN}"
Patrick Williams03907ee2022-05-01 06:28:52 -050037
Patrick Williams7784c422022-11-17 07:29:11 -060038RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux"
Patrick Williams03907ee2022-05-01 06:28:52 -050039
40TESTDIR = "tests"
41
42PRIVATE_LIBS:${PN}-ptest:append = "libnftables.so.1"
43
44do_install_ptest() {
45 cp -rf ${S}/build-aux ${D}${PTEST_PATH}
46 cp -rf ${S}/src ${D}${PTEST_PATH}
47 mkdir -p ${D}${PTEST_PATH}/src/.libs
48 cp -rf ${B}/src/.libs/* ${D}${PTEST_PATH}/src/.libs
49 cp -rf ${B}/src/.libs/nft ${D}${PTEST_PATH}/src/
Patrick Williams03907ee2022-05-01 06:28:52 -050050 cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}/${TESTDIR}
51 sed -i 's#/usr/bin/python#/usr/bin/python3#' ${D}${PTEST_PATH}/${TESTDIR}/json_echo/run-test.py
52 sed -i 's#/usr/bin/env python#/usr/bin/env python3#' ${D}${PTEST_PATH}/${TESTDIR}/py/nft-test.py
Patrick Williams7784c422022-11-17 07:29:11 -060053 # handle multilib
54 sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
Patrick Williams03907ee2022-05-01 06:28:52 -050055}