blob: 3466e16a62b4b83a5b3ceb7f9f0b69cbd88abadb [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
Andrew Geissler615f2f12022-07-15 14:00:58 -050014SRC_URI[sha256sum] = "927fb1fea1f685a328c10cf791eb655d7e1ed49d310eea5cb3101dfd8d6cba35"
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
Andrew Geissler615f2f12022-07-15 14:00:58 -050038RDEPENDS:${PN}-ptest += " ${PN}-python make bash python3-core python3-ctypes python3-json python3-misc 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
53}