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" |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=81ec33bb3e47b460fc993ac768c74b62" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 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 | " |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 12 | SRC_URI[sha256sum] = "c12ac941fff9adaedf17367d5ce213789b98a0d314277bc22b3d71e10891f412" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 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" |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 22 | PACKAGECONFIG[python] = ",, python3-setuptools-native" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 23 | PACKAGECONFIG[readline] = "--with-cli=readline, , readline, , , editline linenoise" |
| 24 | PACKAGECONFIG[xtables] = "--with-xtables, --without-xtables, iptables" |
| 25 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 26 | # Disable the python via autoconf so we can build it separately via setuptools3 |
| 27 | EXTRA_OECONF = "--disable-python \ |
| 28 | ${@bb.utils.contains_any('PACKAGECONFIG', 'editline linenoise readline', '', '--without-cli', d)}" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 29 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 30 | SETUPTOOLS_SETUP_PATH = "${S}/py" |
| 31 | |
| 32 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'setuptools3', '', d)} |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 33 | |
| 34 | RRECOMMENDS:${PN} += "kernel-module-nf-tables" |
| 35 | |
| 36 | PACKAGES =+ "${PN}-python" |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 37 | FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 38 | RDEPENDS:${PN}-python = "python3-core python3-json ${PN}" |
| 39 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 40 | # Explicitly define do_configure, do_compile and do_install because both autotools and setuptools3 |
| 41 | # have EXPORT_FUNCTIONS do_configure do_compile do_install |
| 42 | do_configure() { |
| 43 | autotools_do_configure |
| 44 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then |
| 45 | setuptools3_do_configure |
| 46 | fi |
| 47 | } |
| 48 | |
| 49 | do_compile() { |
| 50 | autotools_do_compile |
| 51 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then |
| 52 | setuptools3_do_compile |
| 53 | fi |
| 54 | } |
| 55 | |
| 56 | do_install() { |
| 57 | autotools_do_install |
| 58 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then |
| 59 | setuptools3_do_install |
| 60 | fi |
| 61 | } |
| 62 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 63 | RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux" |
| 64 | |
| 65 | TESTDIR = "tests" |
| 66 | |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame] | 67 | PRIVATE_LIBS:${PN}-ptest:append = " libnftables.so.1" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 68 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 69 | do_install_ptest() { |
| 70 | cp -rf ${S}/build-aux ${D}${PTEST_PATH} |
| 71 | cp -rf ${S}/src ${D}${PTEST_PATH} |
| 72 | mkdir -p ${D}${PTEST_PATH}/src/.libs |
| 73 | cp -rf ${B}/src/.libs/* ${D}${PTEST_PATH}/src/.libs |
| 74 | cp -rf ${B}/src/.libs/nft ${D}${PTEST_PATH}/src/ |
| 75 | cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}/${TESTDIR} |
| 76 | sed -i 's#/usr/bin/python#/usr/bin/python3#' ${D}${PTEST_PATH}/${TESTDIR}/json_echo/run-test.py |
| 77 | sed -i 's#/usr/bin/env python#/usr/bin/env python3#' ${D}${PTEST_PATH}/${TESTDIR}/py/nft-test.py |
| 78 | # handle multilib |
| 79 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest |
| 80 | } |