[klibc] [PATCH] klcc: Remove the need for bash

Olliver Schinagl oliver at schinagl.nl
Sat Jul 25 01:59:01 PDT 2020


Currently, in the entire klibc bash is only used to identify the path of
the perl binary. It is doing so using the bash built-in 'type' function,
which is POSIX compliant according to [0], but the option -c is not.

By using `command -v` instead, we achieve the same result, in a POSIX
compliant manor [1], potentially removing the unneeded bash dependency.

0 https://www.unix.com/man-page/posix/1p/type/
1 https://www.unix.com/man-page/posix/1p/command/

Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
---
 klcc/Kbuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/klcc/Kbuild b/klcc/Kbuild
index eae753ff..0e625802 100644
--- a/klcc/Kbuild
+++ b/klcc/Kbuild
@@ -35,7 +35,7 @@ targets := $(KLIBCCROSS)klcc
 quiet_cmd_klcc = GEN     $@
       cmd_klcc = $(PERL) $< $(srctree)/$(src)/klcc.in \
                             $(obj)/$(KLIBCCROSS)klibc.config \
-                            $(shell bash -c 'type -p $(PERL)') \
+                            $(shell command -v $(PERL)) \
 			      > $@ || ( rm -f $@ ; exit 1 ) && \
 			      chmod a+x $@
 $(obj)/$(KLIBCCROSS)klcc: $(src)/makeklcc.pl $(src)/klcc.in \
-- 
2.27.0



More information about the klibc mailing list