[openwrt/openwrt] build: remove broken dependency of metadata on toplevel .config variables

LEDE Commits lede-commits at lists.infradead.org
Mon Nov 11 11:41:12 PST 2024


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/44598c233dd9a676bc34666968f33f8b9ff4dd0c

commit 44598c233dd9a676bc34666968f33f8b9ff4dd0c
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Nov 11 19:52:14 2024 +0100

    build: remove broken dependency of metadata on toplevel .config variables
    
    Instead of relying on .config symbols for metadata, alter the DEFAULT
    variable of affected packages. Fixes enabling opkg vs apk among others.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/target.mk              | 40 ++--------------------------------------
 package/system/apk/Makefile    |  1 +
 package/system/opkg/Makefile   |  1 +
 package/system/procd/Makefile  |  3 +++
 package/utils/busybox/Makefile |  2 ++
 5 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/include/target.mk b/include/target.mk
index d13902ad6e..3dc0acff5c 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -77,45 +77,9 @@ else
   endif
 endif
 
-ifneq ($(DUMP),)
-  # Parse generic config that might be set before a .config is generated to modify the
-  # default package configuration
-  # Keep DYNAMIC_DEF_PKG_CONF in sync with toplevel.mk to reflect the same configs
-  DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP
-  $(foreach config, $(DYNAMIC_DEF_PKG_CONF), \
-    $(eval $(config) := $(shell grep "$(config)=y" $(TOPDIR)/.config 2>/dev/null)) \
-  )
-  # The config options that are enabled by default and where other default
-  # packages depends on needs to be set if they are missing in the .config.
-  ifeq ($(shell grep "CONFIG_SECCOMP" $(TOPDIR)/.config 2>/dev/null),)
-    ifeq ($(filter $(BOARD), uml),)
-    ifneq ($(filter $(ARCH), aarch64 arm armeb mips mipsel mips64 mips64el i386 powerpc x86_64),)
-      CONFIG_SECCOMP := y
-    endif
-    endif
-  endif
-endif
-
-ifneq ($(CONFIG_USE_APK),)
-DEFAULT_PACKAGES+=apk-mbedtls
-else
-DEFAULT_PACKAGES+=opkg
-endif
-
-ifneq ($(CONFIG_SELINUX),)
-DEFAULT_PACKAGES+=busybox-selinux procd-selinux
-else
-DEFAULT_PACKAGES+=busybox procd
-endif
-
 # include ujail on systems with enough storage
-ifeq ($(CONFIG_SMALL_FLASH),)
-DEFAULT_PACKAGES+=procd-ujail
-endif
-
-# include seccomp ld-preload hooks if kernel supports it
-ifneq ($(CONFIG_SECCOMP),)
-DEFAULT_PACKAGES+=procd-seccomp
+ifeq ($(filter small_flash,$(FEATURES)),)
+  DEFAULT_PACKAGES+=procd-ujail
 endif
 
 # Add device specific packages (here below to allow device type set from subtarget)
diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile
index cd1b56caf6..2d637fa180 100644
--- a/package/system/apk/Makefile
+++ b/package/system/apk/Makefile
@@ -36,6 +36,7 @@ define Package/apk-mbedtls
   $(Package/apk/default)
   TITLE += (mbedtls)
   DEPENDS +=+libmbedtls
+  DEFAULT:=y if USE_APK
   VARIANT:=mbedtls
   DEFAULT_VARIANT:=1
   CONFLICTS:=apk-openssl
diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
index 9fea969ae9..e7c45e3523 100644
--- a/package/system/opkg/Makefile
+++ b/package/system/opkg/Makefile
@@ -39,6 +39,7 @@ define Package/opkg
   CATEGORY:=Base system
   TITLE:=opkg package manager
   DEPENDS:=+uclient-fetch +libpthread +libubox
+  DEFAULT:=y if !USE_APK
   URL:=$(PKG_SOURCE_URL)
   MENU:=1
 endef
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index 86de4babfd..9ff6fb80f7 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -50,6 +50,7 @@ define Package/procd
   $(call Package/procd/Default)
   VARIANT:=default
   CONFLICTS:=procd-selinux
+  DEFAULT:=y if !SELINUX
 endef
 
 define Package/procd-selinux
@@ -58,6 +59,7 @@ define Package/procd-selinux
   TITLE += with SELinux support
   PROVIDES:=procd
   VARIANT:=selinux
+  DEFAULT:=y if SELINUX
 endef
 
 define Package/procd-ujail
@@ -73,6 +75,7 @@ define Package/procd-seccomp
   CATEGORY:=Base system
   DEPENDS:=@SECCOMP +libubox +libblobmsg-json
   TITLE:=OpenWrt process seccomp helper + utrace
+  DEFAULT:=y if SECCOMP
 endef
 
 define Package/uxc
diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 4ef470df75..7b591db716 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -56,6 +56,7 @@ define Package/busybox
   $(call Package/busybox/Default)
   CONFLICTS:=busybox-selinux
   VARIANT:=default
+  DEFAULT:=y if !SELINUX
 endef
 
 define Package/busybox-selinux
@@ -64,6 +65,7 @@ define Package/busybox-selinux
   DEPENDS += +libselinux
   VARIANT:=selinux
   PROVIDES:=busybox
+  DEFAULT:=y if SELINUX
 endef
 
 define Package/busybox/description




More information about the lede-commits mailing list