Skip to contentSkip to conversation

package: coreutils: allow building individual binaries

PATCH Superseded Markus Mayer 2 participants 2 messages Apr 9, 2019 – Apr 10, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package: coreutils: allow building individual binaries

We add configuration option BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES so that coreutils can be built and installed as individual binaries.

The approach is modelled after Busybox's similarly named configuration option.

---
 package/coreutils/Config.in    | 14 ++++++++++++++
 package/coreutils/coreutils.mk |  6 +++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
package/coreutils/Config.in +14 -0
index 11a6019e820f..0142db4bddd1 100644
@@ -19,3 +19,17 @@ comment "coreutils needs a toolchain w/ wchar"
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+
+config BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES
+	bool "Individual binaries"
+	depends on !BR2_STATIC_LIBS
+	help
+	  By default (i.e. with this option disabled), coreutils is
+	  installed as a single binary (Busybox style) called
+	  /usr/bin/coreutils, and all core utilities are symbolic
+	  links to this binary.
+
+	  With this option enabled, each utility is a separate binary.
+
+comment "Coreutils individual binaries need a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
package/coreutils/coreutils.mk +5 -1
index 3e8efbf04706..37351663f705 100644
@@ -14,7 +14,11 @@ COREUTILS_LICENSE_FILES = COPYING
 COREUTILS_AUTORECONF = YES
 COREUTILS_GETTEXTIZE = YES
 
-COREUTILS_CONF_OPTS = --disable-rpath --enable-single-binary=symlinks \
+ifneq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
+	CUSTOM_COREUTILS_CONF_OPTS=--enable-single-binary=symlinks
+endif
+
+COREUTILS_CONF_OPTS = --disable-rpath $(CUSTOM_COREUTILS_CONF_OPTS) \
 	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)
 COREUTILS_CONF_ENV = ac_cv_c_restrict=no \
 	ac_cv_func_chown_works=yes \
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 package: coreutils: allow building individual binaries

Hello Markus,

Quoted 7 lines · On Tue, 9 Apr 2019 15:04:54 -0700 Markus Mayer <[email protected]> wrote:

We add configuration option BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES so that coreutils can be built and installed as individual binaries.

The approach is modelled after Busybox's similarly named configuration option.

Thanks for your patch. Could you adjust the commit log to explain the use case for wanting individual binaries ? The change looks perfectly OK, but it's good to have an explanation of the "why".

Also, the commit title prefix should be "package/coreutils" and not "package: coreutils".

More comments below.

Quoted 12 lines
package/coreutils/Config.in +4 -0
index 11a6019e820f..0142db4bddd1 100644
@@ -19,3 +19,17 @@ comment "coreutils needs a toolchain w/ wchar"
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+
+config BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES
+	bool "Individual binaries"
+	depends on !BR2_STATIC_LIBS

package/coreutils/Config.in comment "coreutils needs a toolchain w/ wchar" · line 35

Quoted 10 lines
package/coreutils/Config.in +10 -0
+	help
+	  By default (i.e. with this option disabled), coreutils is
+	  installed as a single binary (Busybox style) called
+	  /usr/bin/coreutils, and all core utilities are symbolic
+	  links to this binary.
+
+	  With this option enabled, each utility is a separate binary.
+
+comment "Coreutils individual binaries need a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS

All this code should be enclosed in a if BR2_PACKAGE_COREUTILS .. endif block, otherwise this option appears even when coreutils is disabled.

The comment should use "coreutils" and not "Coreutils"

Quoted 5 lines
package/coreutils/coreutils.mk +0 -0
index 3e8efbf04706..37351663f705 100644

package/coreutils/coreutils.mk COREUTILS_LICENSE_FILES = COPYING · line 22

Quoted 10 lines
package/coreutils/coreutils.mk +5 -1
@@ -14,7 +14,11 @@ COREUTILS_LICENSE_FILES = COPYING
 COREUTILS_AUTORECONF = YES
 COREUTILS_GETTEXTIZE = YES
 
-COREUTILS_CONF_OPTS = --disable-rpath --enable-single-binary=symlinks \
+ifneq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
+	CUSTOM_COREUTILS_CONF_OPTS=--enable-single-binary=symlinks
+endif
+
+COREUTILS_CONF_OPTS = --disable-rpath $(CUSTOM_COREUTILS_CONF_OPTS) \
 	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)

Please do it like this:

COREUTILS_CONF_OPTS = \
	--disable-rpath \
	$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)

ifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),) COREUTILS_CONF_OPTS += --enable-single-binary=symlinks endif

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com