Skip to contentSkip to conversation

crun: Add PACKAGECONFIG options

PATCH New Michal Sieron 1 participant 1 message Sep 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crun: Add PACKAGECONFIG options

Neither systemd nor seccomp is hard required by crun. They can actually be disabled during configuration with --disable-systemd or --disable-seccomp.

Introduce PACKAGECONFIG options for them and default them to presence of corresponding entries in DISTRO_FEATURES.

Now REQUIRED_DISTRO_FEATURES and features_check can also be removed.

Similarly dependency on libcap can be made optional. crun actually contains pregenerated manpages in the repository so dependency on go-md2man-native can be made optional as well.

As there is a configuration option for embedding yajl I added an option for that as well. However, as PACKAGECONFIG can only specify dependencies when config is enabled I had to invert the options so the config is for external-yajl.

I set default PACKAGECONFIG value to match previous state (except detecting if systemd and seccomp are in DISTRO_FEATURES).

---
 recipes-containers/crun/crun_git.bb | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
recipes-containers/crun/crun_git.bb +16 -10
index 2b74264a..4d03017c 100644
@@ -20,16 +20,22 @@ SRC_URI = "git://github.com/containers/crun.git;branch=main;name=crun;protocol=h
 PV = "v1.15+git${SRCREV_crun}"
 S = "${WORKDIR}/git"
 
-REQUIRED_DISTRO_FEATURES ?= "systemd seccomp"
-
-inherit autotools-brokensep pkgconfig features_check
-
-PACKAGECONFIG ??= ""
-
-DEPENDS = "yajl libcap go-md2man-native m4-native"
-# TODO: is there a packageconfig to turn this off ?
-DEPENDS += "libseccomp"
-DEPENDS += "systemd"
+inherit autotools-brokensep pkgconfig
+
+PACKAGECONFIG ??= " \
+    caps external-yajl man \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'seccomp', '', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
+"
+
+PACKAGECONFIG[caps] = "--enable-caps,--disable-caps,libcap"
+PACKAGECONFIG[external-yajl] = "--disable-embedded-yajl,--enable-embedded-yajl,yajl"
+# whether to regenerate manpages that are already present in the repo
+PACKAGECONFIG[man] = ",,go-md2man-native"
+PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
+PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
+
+DEPENDS = "m4-native"
 DEPENDS:append:libc-musl = " argp-standalone"
 
 do_configure:prepend () {
Signature · 1 line
2.46.1