diff --git a/net-firewall/bpfilter/Manifest b/net-firewall/bpfilter/Manifest index 2656a748c957d..bb0a2dc2f8b78 100644 --- a/net-firewall/bpfilter/Manifest +++ b/net-firewall/bpfilter/Manifest @@ -1,3 +1,4 @@ DIST bpfilter-0.4.0.tar.gz 2501443 BLAKE2B d945b08b048b88bfc96367785649b5a688e4b629f8d1533555149f8477ac6d8a2c47e4c157c3a55287fdcb2f4eb3584613cad525e773fa933dfd0a4812ffe6d1 SHA512 04b41baa3cd64a38728f051d849e70ffe430f93daca50dd2c2f6a37fcc0fc7394d36c3ff60c01cfce8ead23b582347b042c0e37a1d1cb7dc8491ee24574d88b4 DIST bpfilter-0.5.0.tar.gz 2548151 BLAKE2B c7a09bfaa494276eab0a83c3c7fdc3b51ee547f53088cd1ed4a0ec9bbad22a086b9cedeb9779263a3ff3ca066929d8dbba671078387f8b15d64b385d124975f2 SHA512 6da49c322b8731277815237f0280ed0ddf96527ffb110d72594374f275a5ac8bc97ead2091d56afed8ac4a8b86e05b30997a6bc92c81b8acac6f533350f9d40d DIST bpfilter-0.5.2.tar.gz 2548282 BLAKE2B 5e91dffd89f6bd4c336a2862b4842563190a4362473e27ed5835c1f81163e9c9af8af991c831f6878ebae6cf47313a872d280506a6000dc0251209644611239b SHA512 4e841f8df6ab77fc9e199c0828018f4dfb89923aab429b7b9854b4abf04fa540b4fabf26fe7b40b53af737d9c72d8e115ad6bb283eabcade7a4a381fce3694f2 +DIST bpfilter-0.6.0.tar.gz 2664103 BLAKE2B c3cab8a6b50a06e5c8a246fdb7198813fbb405ae128b0398e5806561d93f495b5a982d29f0c7df49556bc635751d8456e3062dfbe5f1026f4ff27fba250bbe75 SHA512 d270ea1b328d82052294133597ef3fd253ff6f6488e896515165250e4d7772fa1a83a36cea4d5bacc0cbbb74f842e850b18f3dadbe0bd300b21e7ce2e7be777a diff --git a/net-firewall/bpfilter/bpfilter-0.6.0.ebuild b/net-firewall/bpfilter/bpfilter-0.6.0.ebuild new file mode 100644 index 0000000000000..d42c2f72d9a61 --- /dev/null +++ b/net-firewall/bpfilter/bpfilter-0.6.0.ebuild @@ -0,0 +1,113 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_1{1..3} ) +inherit python-any-r1 cmake + +DESCRIPTION="BPF-based packet filtering framework" +HOMEPAGE=" + https://bpfilter.io/ + https://github.com/facebook/bpfilter +" +SRC_URI="https://github.com/facebook/bpfilter/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0/0" +KEYWORDS="~amd64" +IUSE="doc test" + +RESTRICT="!test? ( test )" + +# tests need root access +RESTRICT+=" test" + +DEPEND=" + dev-libs/libbpf:= + dev-libs/libnl:3= + test? ( + dev-util/cmocka + ) +" +RDEPEND="${DEPEND}" +BDEPEND=" + sys-devel/bison + sys-devel/flex + doc? ( + app-text/doxygen + $(python_gen_any_dep ' + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/linuxdoc[${PYTHON_USEDEP}] + dev-python/breathe[${PYTHON_USEDEP}] + dev-python/furo[${PYTHON_USEDEP}] + ') + ) + test? ( + $(python_gen_any_dep ' + net-analyzer/scapy[${PYTHON_USEDEP}] + ') + ) +" + +PATCHES=( + "${FILESDIR}/bpfilter-0.6.0-no-coverage.patch" +) + +DOCS=( + CONTRIBUTING.md + README.md +) + +pkg_setup() { + (use test || use doc) && python-any-r1_pkg_setup +} + +python_check_deps() { + local -a atoms + if use doc; then + python_has_version \ + "dev-python/sphinx[${PYTHON_USEDEP}]" \ + "dev-python/breathe[${PYTHON_USEDEP}]" \ + "dev-python/linuxdoc[${PYTHON_USEDEP}]" \ + "dev-python/furo[${PYTHON_USEDEP}]" \ + || return + fi + if use test; then + python_has_version \ + "net-analyzer/scapy[${PYTHON_USEDEP}]" \ + || return + fi +} + +src_prepare() { + sed -e '/get_version_from_git/ d' -i CMakeLists.txt || die + cmake_src_prepare +} + +src_configure() { + local CMAKE_BUILD_TYPE=release + local -a mycmakeargs=( + -DNO_CHECKS=ON + -DNO_BENCHMARKS=ON + -DDEFAULT_PROJECT_VERSION="${PV}" + -DNO_DOCS=$(usex doc 'OFF' 'ON') + -DNO_TESTS=$(usex test 'OFF' 'ON') + ) + cmake_src_configure +} + +src_compile() { + cmake_src_compile + use doc && cmake_build doc +} + +src_test() { + cmake_src_test + cmake_build e2e || die "tests failed" +} + +src_install() { + cmake_src_install + use doc && dodoc -r "${BUILD_DIR}/doc/"{ht,x}ml +} diff --git a/net-firewall/bpfilter/files/bpfilter-0.6.0-no-coverage.patch b/net-firewall/bpfilter/files/bpfilter-0.6.0-no-coverage.patch new file mode 100644 index 0000000000000..5cc8a4821bab6 --- /dev/null +++ b/net-firewall/bpfilter/files/bpfilter-0.6.0-no-coverage.patch @@ -0,0 +1,76 @@ +diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt +index b79820c..8e04af5 100644 +--- a/doc/CMakeLists.txt ++++ b/doc/CMakeLists.txt +@@ -36,7 +36,6 @@ + #]] + + find_package(Doxygen REQUIRED) +-find_program(GENHTML_BIN genhtml REQUIRED) + find_program(SPHINX_BIN sphinx-build REQUIRED) + + file(GLOB_RECURSE bf_srcs +@@ -114,10 +113,6 @@ add_custom_command( + # Update the modification time of the documentation's index, so the + # benchmark report will be generated (as external/benchmarks/index.html is + # now out-of-date). +- COMMAND +- ${CMAKE_COMMAND} +- -E touch +- ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/conf.py + ${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml +@@ -126,39 +121,3 @@ add_custom_command( + ${CMAKE_CURRENT_BINARY_DIR}/html/index.html + COMMENT "Generating the documentation" + ) +- +-add_custom_command( +- COMMAND +- ${CMAKE_CURRENT_SOURCE_DIR}/benchreport +- --sources ${CMAKE_SOURCE_DIR} +- --results ${CMAKE_BINARY_DIR}/output/benchmarks +- --template ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks.html.template +- --output ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html +- DEPENDS +- ${CMAKE_CURRENT_SOURCE_DIR}/benchreport +- ${CMAKE_CURRENT_BINARY_DIR}/html/index.html +- ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks.html.template +- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html +- COMMENT "Generate the benchmarks summary" +-) +- +-# covreport should not depend on lcov.out: it should generate a coverage report +-# if it exists, or skip the report generation if it doesn't. +-add_custom_command( +- COMMAND +- ${CMAKE_CURRENT_SOURCE_DIR}/covreport +- --genhtml ${GENHTML_BIN} +- --tracefile ${CMAKE_BINARY_DIR}/output/tests/lcov.out +- --output ${CMAKE_CURRENT_BINARY_DIR}/html/external/coverage +- DEPENDS +- ${CMAKE_CURRENT_SOURCE_DIR}/covreport +- ${CMAKE_CURRENT_BINARY_DIR}/html/index.html +- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/external/coverage/index.html +- COMMENT "Generate the coverage report" +-) +- +-add_custom_target(doc +- DEPENDS +- ${CMAKE_CURRENT_BINARY_DIR}/html/external/benchmarks/index.html +- ${CMAKE_CURRENT_BINARY_DIR}/html/external/coverage/index.html +-) +diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt +index 074a3c3..d09def9 100644 +--- a/tests/unit/CMakeLists.txt ++++ b/tests/unit/CMakeLists.txt +@@ -203,7 +203,7 @@ add_custom_target(unit + COMMENT "Running unit tests" + ) + +-if (NOT ${NO_DOCS}) ++if (FALSE) + include(ProcessorCount) + find_program(LCOV_BIN lcov REQUIRED) +