[Buildroot] [PATCH 4/4] package/coreutils: new virtual package

Sebastian Weyer sebastian.weyer at smile.fr
Tue Mar 14 12:15:06 UTC 2023


This virtual package provides the coreutils functionality which is
provided by the classical gnu implementation of the coreutils
package/gnu-coreutils as well as the more recent rust implementation
package/uutils-coreutils. When the user selects coreutils they will be
presented with a choice between the gnu and the rust implementation. The
gnu implementation will be selected by default.

Signed-off-by: Sebastian Weyer <sebastian.weyer at smile.fr>
---
 DEVELOPERS                                   |  1 +
 package/Config.in                            |  3 +--
 package/coreutils/Config.in                  | 24 ++++++++++++++++++++
 package/coreutils/coreutils.mk               |  7 ++++++
 package/gnu-coreutils/Config.in              |  8 +++++--
 package/gnu-coreutils/gnu-coreutils.mk       |  2 ++
 package/uutils-coreutils/Config.in           | 10 +++++++-
 package/uutils-coreutils/uutils-coreutils.mk |  2 ++
 8 files changed, 52 insertions(+), 5 deletions(-)
 create mode 100644 package/coreutils/Config.in
 create mode 100644 package/coreutils/coreutils.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 14661f7944..f86dcaa420 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2581,6 +2581,7 @@ N:	Sam Voss <sam.voss at gmail.com>
 F:	package/ripgrep/
 
 N:	Sebastian Weyer <sebatian.weyer at smile.fr>
+F:	package/coreutils
 F:	package/uutils-coreutils
 
 N:	Sébastien Szymanski <sebastien.szymanski at armadeus.com>
diff --git a/package/Config.in b/package/Config.in
index 6a0c3fd049..0f8dab3e71 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2634,6 +2634,7 @@ menu "System tools"
 	source "package/cgroupfs-mount/Config.in"
 	source "package/circus/Config.in"
 	source "package/containerd/Config.in"
+	source "package/coreutils/Config.in"
 	source "package/cpulimit/Config.in"
 	source "package/cpuload/Config.in"
 	source "package/crun/Config.in"
@@ -2654,7 +2655,6 @@ menu "System tools"
 	source "package/ftop/Config.in"
 	source "package/getent/Config.in"
 	source "package/gkrellm/Config.in"
-	source "package/gnu-coreutils/Config.in"
 	source "package/htop/Config.in"
 	source "package/ibm-sw-tpm2/Config.in"
 	source "package/initscripts/Config.in"
@@ -2725,7 +2725,6 @@ menu "System tools"
 	source "package/tpm2-totp/Config.in"
 	source "package/unscd/Config.in"
 	source "package/util-linux/Config.in"
-	source "package/uutils-coreutils/Config.in"
 	source "package/watchdog/Config.in"
 	source "package/watchdogd/Config.in"
 	source "package/xdg-dbus-proxy/Config.in"
diff --git a/package/coreutils/Config.in b/package/coreutils/Config.in
new file mode 100644
index 0000000000..a5bfc016ac
--- /dev/null
+++ b/package/coreutils/Config.in
@@ -0,0 +1,24 @@
+config BR2_PACKAGE_HAS_COREUTILS
+	bool
+
+config BR2_PACKAGE_PROVIDES_COREUTILS
+	string
+	depends on BR2_PACKAGE_HAS_COREUTILS
+
+menuconfig BR2_PACKAGE_COREUTILS
+	bool "coreutils"
+	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	help
+	  Enable coreutils on the target. Either standard GNU-coreutils
+	  or its rust implementation: uutils-coreutils.
+
+if BR2_PACKAGE_COREUTILS
+
+choice
+	prompt "Coreutils Type"
+
+source "package/gnu-coreutils/Config.in"
+source "package/uutils-coreutils/Config.in"
+endchoice
+
+endif
diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
new file mode 100644
index 0000000000..e5585afb61
--- /dev/null
+++ b/package/coreutils/coreutils.mk
@@ -0,0 +1,7 @@
+################################################################################
+#
+# coreutils
+#
+################################################################################
+
+$(eval $(virtual-package))
diff --git a/package/gnu-coreutils/Config.in b/package/gnu-coreutils/Config.in
index 9a15c0ee8b..60731b8266 100644
--- a/package/gnu-coreutils/Config.in
+++ b/package/gnu-coreutils/Config.in
@@ -2,7 +2,8 @@ config BR2_PACKAGE_GNU_COREUTILS
 	bool "gnu-coreutils"
 	depends on BR2_USE_WCHAR
 	depends on BR2_USE_MMU # fork()
-	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	depends on BR2_PACKAGE_COREUTILS
+	select BR2_PACKAGE_HAS_COREUTILS
 	help
 	  All of the basic file/text/shell utilities. These are the
 	  core utilities which are expected to exist on every system.
@@ -17,6 +18,9 @@ config BR2_PACKAGE_GNU_COREUTILS
 
 if BR2_PACKAGE_GNU_COREUTILS
 
+config BR2_PACKAGE_PROVIDES_COREUTILS
+	default "gnu-coreutils"
+
 config BR2_PACKAGE_GNU_COREUTILS_INDIVIDUAL_BINARIES
 	bool "Individual binaries"
 	depends on !BR2_STATIC_LIBS
@@ -36,4 +40,4 @@ endif
 comment "coreutils needs a toolchain w/ wchar"
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR
-	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	depends on BR2_PACKAGE_COREUTILS
diff --git a/package/gnu-coreutils/gnu-coreutils.mk b/package/gnu-coreutils/gnu-coreutils.mk
index 3373021cf5..402cd3f023 100644
--- a/package/gnu-coreutils/gnu-coreutils.mk
+++ b/package/gnu-coreutils/gnu-coreutils.mk
@@ -11,6 +11,8 @@ GNU_COREUTILS_LICENSE = GPL-3.0+
 GNU_COREUTILS_LICENSE_FILES = COPYING
 GNU_COREUTILS_CPE_ID_VENDOR = gnu
 
+GNU_COREUTILS_PROVIDES = coreutils
+
 GNU_COREUTILS_CONF_OPTS = --disable-rpath \
 	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)
 
diff --git a/package/uutils-coreutils/Config.in b/package/uutils-coreutils/Config.in
index 76ce5b174d..5a75c36e61 100644
--- a/package/uutils-coreutils/Config.in
+++ b/package/uutils-coreutils/Config.in
@@ -1,9 +1,17 @@
 config BR2_PACKAGE_UUTILS_COREUTILS
 	bool "uutils-coreutils"
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
-	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	depends on BR2_PACKAGE_COREUTILS
+	select BR2_PACKAGE_HAS_COREUTILS
 	help
 	  uutils is an attempt at writing universal (as in
 	  cross-platform) CLI utilities in Rust. While all programs have
 	  been implemented, some options might be missing or different
 	  behavior might be experienced.
+
+if BR2_PACKAGE_UUTILS_COREUTILS
+
+config BR2_PACKAGE_PROVIDES_COREUTILS
+	default "uutils-coreutils"
+
+endif
diff --git a/package/uutils-coreutils/uutils-coreutils.mk b/package/uutils-coreutils/uutils-coreutils.mk
index 37a647a1f0..f7b688e42b 100644
--- a/package/uutils-coreutils/uutils-coreutils.mk
+++ b/package/uutils-coreutils/uutils-coreutils.mk
@@ -12,6 +12,8 @@ UUTILS_COREUTILS_LICENSE_FILES = LICENSE
 UUTILS_COREUTILS_BUILD_OPTS = PROFILE=release MULTICALL=y PREFIX=$(TARGET_DIR)
 UUTILS_COREUTILS_INSTALL_OPTS = $(UUTILS_COREUTILS_BUILD_OPTS) install
 
+UUTILS_COREUTILS_PROVIDES = coreutils
+
 define UUTILS_COREUTILS_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) $(MAKE) $(UUTILS_COREUTILS_BUILD_OPTS) -C $(@D)
 endef
-- 
2.25.1




More information about the buildroot mailing list