[Toybox] Bash Compatibility Patch

Eric Molitor eric at improbable.io
Sat Jun 29 05:52:37 PDT 2019


I know that you are working on toysh which I'm looking forward to. In the
meantime below is a patch to improve compatibility with older/odd versions
of bash. This fixed a minor build issue I was having on MacOS (which was
using zsh in emulated bash mode) as well as an oddball embedded SDK using a
non-gnu version of bash. I believe these changes are minimal and should be
safe to apply, if not I wanted to at least get them on the mailing list in
case others ran into these issues.

- Eric

diff -ru toybox-0.8.1/scripts/make.sh toybox-0.8.1-patched/scripts/make.sh
--- toybox-0.8.1/scripts/make.sh        2019-05-30 02:00:04.000000000 +0100
+++ toybox-0.8.1-patched/scripts/make.sh        2019-06-29
13:09:40.716153286 +0100
@@ -151,7 +151,7 @@
     $KCONFIG_CONFIG > generated/config.h || exit 1
 fi

-if [ generated/mkflags -ot scripts/mkflags.c ]
+if [ ! -f generated/mkflags ] || [ generated/mkflags -ot scripts/mkflags.c
]
 then
   do_loudly $HOSTCC scripts/mkflags.c -o generated/mkflags || exit 1
 fi
@@ -235,7 +235,7 @@
   ) > generated/globals.h
 fi

-if [ generated/mktags -ot scripts/mktags.c ]
+if [ ! -f generated/mktags ] || [ generated/mktags -ot scripts/mktags.c ]
 then
   do_loudly $HOSTCC scripts/mktags.c -o generated/mktags || exit 1
 fi
@@ -248,7 +248,7 @@
     toys/*/*.c lib/*.c | generated/mktags > generated/tags.h
 fi

-if [ generated/config2help -ot scripts/config2help.c ]
+if [ ! -f generated/config2help ] || [ generated/config2help -ot
scripts/config2help.c ]
 then
   do_loudly $HOSTCC scripts/config2help.c -o generated/config2help || exit
1
 fi
diff -ru toybox-0.8.1/scripts/portability.sh
toybox-0.8.1-patched/scripts/portability.sh
--- toybox-0.8.1/scripts/portability.sh 2019-05-30 02:00:04.000000000 +0100
+++ toybox-0.8.1-patched/scripts/portability.sh 2019-06-29
13:07:54.557626590 +0100
@@ -10,5 +10,5 @@

 if [ -z "$SED" ]
 then
-  [ ! -z "$(which gsed 2>/dev/null)" ] && SED=gsed || SED=sed
+  [ ! -z "$(command -v gsed 2>/dev/null)" ] && SED=gsed || SED=sed
 fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20190629/d9cad02d/attachment.htm>


More information about the Toybox mailing list