summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorJürgen Hötzel <juergen@hoetzel.info>2017-01-06 01:15:49 +0100
committerJan Vorlicek <janvorli@microsoft.com>2017-01-06 01:15:49 +0100
commit7f8557fb17c58a093bf54bd17e965b9181bba772 (patch)
tree95b32f51004af7006b1ce7105187f1821e578fcb /build.sh
parent1ba20a12ef18140d0ee1867fe5b0c0106bdbaf57 (diff)
downloadcoreclr-7f8557fb17c58a093bf54bd17e965b9181bba772.tar.gz
coreclr-7f8557fb17c58a093bf54bd17e965b9181bba772.tar.bz2
coreclr-7f8557fb17c58a093bf54bd17e965b9181bba772.zip
Use POSIX "command" instead of non-standard "which" (#8823)
GNU which might not be installed on a minimal GNU/Linux installation. Refs #6994 and #7025.
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh18
1 files changed, 3 insertions, 15 deletions
diff --git a/build.sh b/build.sh
index c4d13b1473..868c824fb9 100755
--- a/build.sh
+++ b/build.sh
@@ -2,16 +2,8 @@
# resolve python-version to use
if [ "$PYTHON" == "" ] ; then
- if which python >/dev/null 2>&1
+ if ! PYTHON=$(command -v python || command -v python2 || command -v python 2.7)
then
- PYTHON=python
- elif which python2 >/dev/null 2>&1
- then
- PYTHON=python2
- elif which python2.7 >/dev/null 2>&1
- then
- PYTHON=python2.7
- else
echo "Unable to locate build-dependency python2.x!" 1>&2
exit 1
fi
@@ -19,7 +11,7 @@ fi
# validate python-dependency
# useful in case of explicitly set option.
-if ! which $PYTHON > /dev/null 2>&1
+if ! command -v $PYTHON > /dev/null
then
echo "Unable to locate build-dependency python2.x ($PYTHON)!" 1>&2
exit 1
@@ -196,11 +188,7 @@ build_native()
if [ $__UseNinja == 1 ]; then
generator="ninja"
buildFile="build.ninja"
- if which ninja >/dev/null 2>&1; then
- buildTool="ninja"
- elif which ninja-build >/dev/null 2>&1; then
- buildTool="ninja-build"
- else
+ if ! buildTool=$(command -v ninja || command -v ninja-build); then
echo "Unable to locate ninja!" 1>&2
exit 1
fi