package/glibc: drop dependency of utilities on bash
authorCarlos Santos <unixmania@gmail.com>
Tue, 3 Dec 2019 00:14:05 +0000 (21:14 -0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Thu, 5 Dec 2019 22:15:45 +0000 (23:15 +0100)
The dependency was added because ldd uses bash-specific syntax to
localize messages. Add a post-patch hook, instead, to replace the
occurrences of $"foo" by "foo", simply, so the code becomes POSIX
sh compliant if bash is not selected.

Also set the configuration environment accordingly to replace the
/bin/bash hashbang by /bin/sh.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/glibc/Config.in
package/glibc/glibc.mk

index b8c2573d96e486b9ee9bf5cacc2cb623fed04826..7b2f24694761c57cbcd8240fa2275945fe48f1ec 100644 (file)
@@ -11,10 +11,6 @@ endif
 
 config BR2_PACKAGE_GLIBC_UTILS
        bool "Install glibc utilities"
-       depends on BR2_PACKAGE_BASH
        help
          Enabling this option will compile and install the getconf,
          ldconfig, ldd and locale glibc utilities for the target.
-
-comment "glibc utilities need bash"
-       depends on !BR2_PACKAGE_BASH
index 8eafa55ae1bfa2de8a30c24b80e7b6d0d59bfe63..1b38f8aedbb2a996bc9b75e58c32fb7d10ef9b81 100644 (file)
@@ -74,10 +74,19 @@ endef
 endif
 
 GLIBC_CONF_ENV = \
-       ac_cv_path_BASH_SHELL=/bin/bash \
+       ac_cv_path_BASH_SHELL=/bin/$(if $(BR2_PACKAGE_BASH),bash,sh) \
        libc_cv_forced_unwind=yes \
        libc_cv_ssp=no
 
+# POSIX shell does not support localization, so remove the corresponding
+# syntax from ldd if bash is not selected.
+ifeq ($(BR2_PACKAGE_BASH),)
+define GLIBC_LDD_NO_BASH
+       $(SED) 's/$$"/"/g' $(@D)/elf/ldd.bash.in
+endef
+GLIBC_POST_PATCH_HOOKS += GLIBC_LDD_NO_BASH
+endif
+
 # Override the default library locations of /lib64/<abi> and
 # /usr/lib64/<abi>/ for RISC-V.
 ifeq ($(BR2_riscv),y)