[Buildroot] [v7, 1/2] package/uutils-coreutils: new package
Alexander Shirokov
shirokovalexs at gmail.com
Sun Oct 26 13:09:50 UTC 2025
This package is an implementation of coreutils written entirely in Rust.
uutils-coreutils aims to:
- work on as many platforms as possible, to be able to use the same
utils on Linux, macOS, Windows and other platforms
- be a drop-in replacement for the GNU utils
Currently defined functions:
[, b2sum, b3sum, base32, base64, basename, basenc, cat, cksum, comm,
cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo,
env, expand, expr, factor, false, fmt, fold, hashsum, head, join,
link, ln, ls, md5sum, mkdir, mktemp, more, mv, nl, numfmt, od,
paste, pr, printenv, printf, ptx, pwd, readlink, realpath, rm,
rmdir, seq, sha1sum, sha224sum, sha256sum, sha3-224sum, sha3-256sum,
sha3-384sum, sha3-512sum, sha384sum, sha3sum, sha512sum,
shake128sum, shake256sum, shred, shuf, sleep, sort, split, sum, tac,
tail, tee, test, touch, tr, true, truncate, tsort, unexpand, uniq,
unlink, vdir, wc, yes
Please note, some options might be (yet) missing or different behavior
might be experienced.
https://github.com/uutils/coreutils
Signed-off-by: Alexander Shirokov <shirokovalexs at gmail.com>
---
DEVELOPERS | 1 +
package/Config.in | 1 +
package/busybox/busybox.mk | 1 +
package/coreutils/Config.in | 1 +
package/uutils-coreutils/Config.in | 48 +++++++
.../uutils-coreutils/uutils-coreutils.hash | 3 +
package/uutils-coreutils/uutils-coreutils.mk | 123 ++++++++++++++++++
7 files changed, 178 insertions(+)
create mode 100644 package/uutils-coreutils/Config.in
create mode 100644 package/uutils-coreutils/uutils-coreutils.hash
create mode 100644 package/uutils-coreutils/uutils-coreutils.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index 63afce3fac..9185746ee9 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -88,6 +88,7 @@ F: package/cpp-httplib/
N: Alexander Shirokov <shirokovalexs at gmail.com>
F: package/nnn/
+F: package/uutils-coreutils/
N: Alessandro Partesotti <a.partesotti at gmail.com>
F: package/oatpp/
diff --git a/package/Config.in b/package/Config.in
index 161d61728b..69c23183d9 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2940,6 +2940,7 @@ 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/busybox/busybox.mk b/package/busybox/busybox.mk
index d7eda71db6..72efc377c7 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -68,6 +68,7 @@ BUSYBOX_DEPENDENCIES = \
$(if $(BR2_PACKAGE_UNZIP),unzip) \
$(if $(BR2_PACKAGE_USBUTILS),usbutils) \
$(if $(BR2_PACKAGE_UTIL_LINUX),util-linux) \
+ $(if $(BR2_PACKAGE_UUTILS_COREUTILS),uutils-coreutils) \
$(if $(BR2_PACKAGE_TINYINIT),tinyinit) \
$(if $(BR2_PACKAGE_VIM),vim) \
$(if $(BR2_PACKAGE_WATCHDOG),watchdog) \
diff --git a/package/coreutils/Config.in b/package/coreutils/Config.in
index 705013bae0..9c1af1dc25 100644
--- a/package/coreutils/Config.in
+++ b/package/coreutils/Config.in
@@ -3,6 +3,7 @@ config BR2_PACKAGE_COREUTILS
depends on BR2_USE_WCHAR
depends on BR2_USE_MMU # fork()
depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+ depends on !BR2_PACKAGE_UUTILS_COREUTILS
help
All of the basic file/text/shell utilities. These are the
core utilities which are expected to exist on every system.
diff --git a/package/uutils-coreutils/Config.in b/package/uutils-coreutils/Config.in
new file mode 100644
index 0000000000..cd2bfdd0f0
--- /dev/null
+++ b/package/uutils-coreutils/Config.in
@@ -0,0 +1,48 @@
+config BR2_PACKAGE_UUTILS_COREUTILS
+ bool "uutils-coreutils"
+ depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+ depends on BR2_PACKAGE_HOST_RUSTC
+ depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+ help
+ uutils coreutils is a cross-platform reimplementation of the
+ GNU coreutils in Rust.
+
+ While all programs have been implemented, some options might
+ be missing or different behavior might be experienced.
+
+ https://github.com/uutils/coreutils
+
+if BR2_PACKAGE_UUTILS_COREUTILS
+
+config BR2_PACKAGE_UUTILS_COREUTILS_MULTICALL
+ bool "multicall"
+ default y
+ help
+ Build coreutils as a single multi-call binary, or as a set
+ of separate utilities.
+
+ Select 'y' to build coreutils as a single ‘coreutils’ binary.
+ This approach allows to reduce overhead and achieve a minimal
+ image size.
+
+ Select 'n' to build coreutils as a collection of independent
+ binaries, such as 'cp, mv, df, ...'. This approach produces
+ larger final image, but it manages each application
+ individually.
+
+ It often comes in handy for testing, as it allows you to
+ replace several specific binaries and see what happens.
+
+config BR2_PACKAGE_UUTILS_COREUTILS_UTILITIES
+ string "utilities"
+ default "default"
+ help
+ This option specifies precisely which utilities will be
+ built.
+
+ Use 'default' to build all available utilities.
+
+ Use a space-separated list of utilities, such as 'cp mv df’,
+ to explicitly specify the utilities to build.
+
+endif
diff --git a/package/uutils-coreutils/uutils-coreutils.hash b/package/uutils-coreutils/uutils-coreutils.hash
new file mode 100644
index 0000000000..7d4f172620
--- /dev/null
+++ b/package/uutils-coreutils/uutils-coreutils.hash
@@ -0,0 +1,3 @@
+# Locally generated
+sha256 4785cb4b6fe6f1aa236e30e2ed7113ff15520e3897b7fb1e1d92f6511cc1b27b uutils-coreutils-0.3.0-cargo4.tar.gz
+sha256 29953405eaa3dcc41c37d1621d55b6a47eee93e05613e439e73295029740b10c LICENSE
diff --git a/package/uutils-coreutils/uutils-coreutils.mk b/package/uutils-coreutils/uutils-coreutils.mk
new file mode 100644
index 0000000000..aa072b6068
--- /dev/null
+++ b/package/uutils-coreutils/uutils-coreutils.mk
@@ -0,0 +1,123 @@
+################################################################################
+#
+# uutils-coreutils
+#
+################################################################################
+
+UUTILS_COREUTILS_VERSION = 0.3.0
+UUTILS_COREUTILS_SITE = $(call github,uutils,coreutils,$(UUTILS_COREUTILS_VERSION))
+UUTILS_COREUTILS_LICENSE = MIT
+UUTILS_COREUTILS_LICENSE_FILES = LICENSE
+
+# The list of default utilities is used when no specific instructions are provided
+# from the configuration.
+UUTILS_COREUTILS_DEFAULT_UTILITIES = \
+ base32 \
+ base64 \
+ basenc \
+ basename \
+ cat \
+ cksum \
+ comm \
+ cp \
+ csplit \
+ cut \
+ date \
+ dd \
+ df \
+ dir \
+ dircolors \
+ dirname \
+ echo \
+ env \
+ expand \
+ expr \
+ factor \
+ false \
+ fmt \
+ fold \
+ hashsum \
+ head \
+ join \
+ link \
+ ln \
+ ls \
+ mkdir \
+ mktemp \
+ more \
+ mv \
+ nl \
+ numfmt \
+ nproc \
+ od \
+ paste \
+ pr \
+ printenv \
+ printf \
+ ptx \
+ pwd \
+ readlink \
+ realpath \
+ rm \
+ rmdir \
+ seq \
+ shred \
+ shuf \
+ sleep \
+ sort \
+ split \
+ sum \
+ sync \
+ tac \
+ tail \
+ tee \
+ test \
+ tr \
+ true \
+ truncate \
+ tsort \
+ unexpand \
+ uniq \
+ vdir \
+ wc \
+ whoami \
+ yes
+
+# Track 'debug' and 'release' builds. This is needed as Cargo will
+# save them into different directories according to the build type.
+ifeq ($(BR2_ENABLE_DEBUG),y)
+UUTILS_COREUTILS_PROFILE=debug
+else
+UUTILS_COREUTILS_PROFILE=release
+endif
+
+# Select utilities to build. 'default' builds all available utilities.
+# Otherwise, use the list of utilities provided by the configuration.
+UUTILS_COREUTILS_CUSTOM_UTILITIES := $(call qstrip,$(BR2_PACKAGE_UUTILS_COREUTILS_UTILITIES))
+UUTILS_COREUTILS_UTILITIES := $(if $(filter default,$(UUTILS_COREUTILS_CUSTOM_UTILITIES)), \
+ $(UUTILS_COREUTILS_DEFAULT_UTILITIES), \
+ $(UUTILS_COREUTILS_CUSTOM_UTILITIES))
+
+# Handle multicall and non-multicall cases.
+# - Multicall. In this case, Cargo will build a single binary. The list of
+# supported utilities can be provided via the '--features' flag.
+# - Non-multicall. In this case, Cargo will build a separate binary for each utility.
+# The list of supported utilities can be provided via the '-p' flag and the 'uu_'
+# prefix in the package name.
+ifeq ($(BR2_PACKAGE_UUTILS_COREUTILS_MULTICALL),y)
+UUTILS_COREUTILS_FEATURES += $(foreach util,$(UUTILS_COREUTILS_UTILITIES),$(util))
+UUTILS_COREUTILS_CARGO_BUILD_OPTS += --features "$(UUTILS_COREUTILS_FEATURES)" --no-default-features
+define UUTILS_COREUTILS_INSTALL_TARGET_CMDS
+ $(INSTALL) -D -m 0755 $(@D)/target/$(RUSTC_TARGET_NAME)/$(UUTILS_COREUTILS_PROFILE)/coreutils $(TARGET_DIR)/bin/
+endef
+else
+UUTILS_COREUTILS_PACKAGES += $(foreach util,$(UUTILS_COREUTILS_UTILITIES),-p uu_$(util))
+UUTILS_COREUTILS_CARGO_BUILD_OPTS += $(UUTILS_COREUTILS_PACKAGES)
+define UUTILS_COREUTILS_INSTALL_TARGET_CMDS
+ $(foreach util,$(UUTILS_COREUTILS_UTILITIES), \
+ $(INSTALL) -D -m 0755 $(@D)/target/$(RUSTC_TARGET_NAME)/$(UUTILS_COREUTILS_PROFILE)/$(util) $(TARGET_DIR)/bin/
+ )
+endef
+endif
+
+$(eval $(cargo-package))
--
2.51.1
More information about the buildroot
mailing list