aboutsummaryrefslogtreecommitdiff
path: root/package/coreutils/coreutils.mk
diff options
context:
space:
mode:
authorGravatar Markus Mayer <mmayer@broadcom.com>2019-06-06 19:15:34 -0700
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2019-06-20 21:04:19 +0200
commit7989818466f8a963c4b6cc8b5014b04703535d3a (patch)
tree73850f5209f0ed1c8969086ad4b5b8dba58c6239 /package/coreutils/coreutils.mk
parent840cda91152dd8f702de8e77af34cddfbe4c98c8 (diff)
downloadbuildroot-7989818466f8a963c4b6cc8b5014b04703535d3a.tar.gz
buildroot-7989818466f8a963c4b6cc8b5014b04703535d3a.tar.bz2
package/coreutils: allow building as individual binaries
We add configuration option BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES so that coreutils can be built and installed as individual binaries. It can be used if the target file system doesn't support symlinks or symlinks are undesirable. The approach is modelled after Busybox's similarly named configuration option. Signed-off-by: Markus Mayer <mmayer@broadcom.com> [Thomas: adjust to previous preparation commits.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'package/coreutils/coreutils.mk')
-rw-r--r--package/coreutils/coreutils.mk33
1 files changed, 32 insertions, 1 deletions
diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
index c48dc235ac..6b8f3ba4b8 100644
--- a/package/coreutils/coreutils.mk
+++ b/package/coreutils/coreutils.mk
@@ -14,8 +14,15 @@ COREUTILS_LICENSE_FILES = COPYING
COREUTILS_AUTORECONF = YES
COREUTILS_GETTEXTIZE = YES
-COREUTILS_CONF_OPTS = --disable-rpath --enable-single-binary=symlinks \
+COREUTILS_CONF_OPTS = --disable-rpath \
$(if $(BR2_TOOLCHAIN_USES_MUSL),--with-included-regex)
+
+ifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
+COREUTILS_CONF_OPTS += --disable-single-binary
+else
+COREUTILS_CONF_OPTS += --enable-single-binary=symlinks
+endif
+
COREUTILS_CONF_ENV = ac_cv_c_restrict=no \
ac_cv_func_chown_works=yes \
ac_cv_func_euidaccess=no \
@@ -96,6 +103,17 @@ COREUTILS_DEPENDENCIES += openssl
endif
ifeq ($(BR2_ROOTFS_MERGED_USR),)
+# We want to move a few binaries from /usr/bin to /bin. In the case of
+# coreutils being built as multi-call binary, we do so by re-creating
+# the corresponding symlinks. If coreutils is built with individual
+# binaries, we actually move the binaries.
+ifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
+define COREUTILS_FIX_BIN_LOCATION
+ $(foreach f,$(COREUTILS_BIN_PROGS), \
+ mv $(TARGET_DIR)/usr/bin/$(f) $(TARGET_DIR)/bin
+ )
+endef
+else
define COREUTILS_FIX_BIN_LOCATION
# some things go in /bin rather than /usr/bin
$(foreach f,$(COREUTILS_BIN_PROGS), \
@@ -103,6 +121,7 @@ define COREUTILS_FIX_BIN_LOCATION
ln -sf ../usr/bin/coreutils $(TARGET_DIR)/bin/$(f)
)
endef
+endif
COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_FIX_BIN_LOCATION
endif
@@ -111,16 +130,28 @@ COREUTILS_CONF_OPTS += --enable-no-install-program=stdbuf
endif
# link for archaic shells
+ifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
+define COREUTILS_CREATE_TEST_SYMLINK
+ ln -fs test $(TARGET_DIR)/usr/bin/[
+endef
+else
define COREUTILS_CREATE_TEST_SYMLINK
ln -fs coreutils $(TARGET_DIR)/usr/bin/[
endef
+endif
COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_CREATE_TEST_SYMLINK
# gnu thinks chroot is in bin, debian thinks it's in sbin
+ifeq ($(BR2_PACKAGE_COREUTILS_INDIVIDUAL_BINARIES),y)
+define COREUTILS_FIX_CHROOT_LOCATION
+ mv $(TARGET_DIR)/usr/bin/chroot $(TARGET_DIR)/usr/sbin
+endef
+else
define COREUTILS_FIX_CHROOT_LOCATION
rm -f $(TARGET_DIR)/usr/bin/chroot
ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot
endef
+endif
COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_FIX_CHROOT_LOCATION
$(eval $(autotools-package))