[Buildroot] [git commit] package/glibc: drop dependency of utilities on bash

Thomas Petazzoni thomas.petazzoni at bootlin.com
Thu Dec 5 22:15:45 UTC 2019

commit: https://git.buildroot.net/buildroot/commit/?id=862cda57e5e2110a432e9c7592d2f258913223fb
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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 at gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
 package/glibc/Config.in |  4 ----
 package/glibc/glibc.mk  | 11 ++++++++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/package/glibc/Config.in b/package/glibc/Config.in
index b8c2573d96..7b2f246947 100644
--- a/package/glibc/Config.in
+++ b/package/glibc/Config.in
@@ -11,10 +11,6 @@ endif
 	bool "Install glibc utilities"
-	depends on BR2_PACKAGE_BASH
 	  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
diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
index 8eafa55ae1..1b38f8aedb 100644
--- a/package/glibc/glibc.mk
+++ b/package/glibc/glibc.mk
@@ -74,10 +74,19 @@ endef
-	ac_cv_path_BASH_SHELL=/bin/bash \
+	ac_cv_path_BASH_SHELL=/bin/$(if $(BR2_PACKAGE_BASH),bash,sh) \
 	libc_cv_forced_unwind=yes \
+# POSIX shell does not support localization, so remove the corresponding
+# syntax from ldd if bash is not selected.
+ifeq ($(BR2_PACKAGE_BASH),)
+	$(SED) 's/$$"/"/g' $(@D)/elf/ldd.bash.in
 # Override the default library locations of /lib64/<abi> and
 # /usr/lib64/<abi>/ for RISC-V.
 ifeq ($(BR2_riscv),y)

More information about the buildroot mailing list