aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Molitor <eric@improbable.io>2019-06-29 07:52:00 -0500
committerRob Landley <rob@landley.net>2019-06-29 12:31:22 -0500
commit78991600dde43868bb3e362a014dd81dc8784b5f (patch)
tree7ce2cb6fb7b182cfd551dd9155214251ae859a25
parent5363b092986416b4ec99716bb2b309856ff22526 (diff)
downloadtoybox-78991600dde43868bb3e362a014dd81dc8784b5f.tar.gz
Bash Compatibility Patch
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.
-rwxr-xr-xscripts/make.sh6
-rw-r--r--scripts/portability.sh2
2 files changed, 4 insertions, 4 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 6649999e..2a78844d 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -152,7 +152,7 @@ then
$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
@@ -236,7 +236,7 @@ then
) > 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
@@ -249,7 +249,7 @@ then
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 --git a/scripts/portability.sh b/scripts/portability.sh
index abeb31f2..618022c7 100644
--- a/scripts/portability.sh
+++ b/scripts/portability.sh
@@ -10,5 +10,5 @@ fi
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