package/bpftool: disable feature auto-detection for host build

On my system:

    $ readelf -d host/sbin/bpftool | awk '/NEEDED/ {$1=""; print}'
    (NEEDED) Shared library: [libelf.so.1]     # ACK
    (NEEDED) Shared library: [libz.so.1]       # ACK
    (NEEDED) Shared library: [libcap.so.2]     # NACK
    (NEEDED) Shared library: [libLLVM.so.22.1] # NACK
    (NEEDED) Shared library: [libc.so.6]       # ACK

After:

    $ readelf -d host/sbin/bpftool | awk '/NEEDED/ {$1=""; print}'
    (NEEDED) Shared library: [libelf.so.1]
    (NEEDED) Shared library: [libz.so.1]
    (NEEDED) Shared library: [libc.so.6]

Host bpftool auto-detects optional features by probing the system.
In my case it finds:
 - libcap which resolves to my system shared object because
   BR2_PACKAGE_LIBCAP=n.
 - libLLVM which resolves to the BR2-built one thanks to llvm-config in
   $PATH. But we don't have that marked as an explicit dependency.

Avoid the mechanism by hardcoding FEATURE_TESTS to the empty string.
Goal is to make the host-bpftool more hermetic to the host system. If
we ever need those features (future xdp-tools package doesn't), then
we'll add the dependency explicitly.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Théo Lebrun
2026-08-28 18:46:47 +02:00
committed by Thomas Petazzoni
parent 218a6b7a74
commit bd10a0172f

View File

@@ -13,6 +13,9 @@ BPFTOOL_LICENSE_FILES = LICENSE LICENSE.BSD-2-Clause LICENSE.GPL-2.0
BPFTOOL_DEPENDENCIES = binutils elfutils
HOST_BPFTOOL_DEPENDENCIES = host-elfutils host-pkgconf host-zlib
# Disable the auto detection of features on the host system.
HOST_BPFTOOL_MAKE_OPTS = FEATURE_TESTS=
ifeq ($(BR2_PACKAGE_LIBCAP),y)
BPFTOOL_DEPENDENCIES += libcap
endif
@@ -28,7 +31,7 @@ endef
define HOST_BPFTOOL_BUILD_CMDS
$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) \
-C $(@D)/src
-C $(@D)/src $(HOST_BPFTOOL_MAKE_OPTS)
endef
define BPFTOOL_INSTALL_TARGET_CMDS