From a9f824da03b3f966c04d3d2bd91891d4156bee3a Mon Sep 17 00:00:00 2001 From: "sbc@chromium.org" Date: Tue, 8 Oct 2013 18:29:50 +0000 Subject: [PATCH] Fix ninja wrapper script on non-x86 linux. The script would previously attempt to run the x86_32 version of ninja on 32-bit arches such as mips and arm rather than display the error message. This error showed up an ARM builder: /mnt/data/b/depot_tools/ninja: line 25: /mnt/data/b/depot_tools/ninja-linux32: cannot execute binary file Review URL: https://codereview.chromium.org/26490004 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@227549 0039d316-1c4b-4281-b951-d872f2087c98 --- ninja | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ninja b/ninja index bd263b48ee..7b76038a1d 100755 --- a/ninja +++ b/ninja @@ -20,12 +20,18 @@ EOF case "$OS" in Linux) - MACHINE=$(getconf LONG_BIT) + MACHINE=$(uname -m) case "$MACHINE" in - 32|64) exec "${THIS_DIR}/ninja-linux${MACHINE}" "$@";; - *) echo Unknown architecture \($MACHINE\) -- unable to run ninja. - print_help - exit 1;; + i?86|x86_64) + LONG_BIT=$(getconf LONG_BIT) + # We know we are on x86 but we need to use getconf to determine + # bittage of the userspace install (e.g. when runing 32-bit userspace + # on x86_64 kernel) + exec "${THIS_DIR}/ninja-linux${LONG_BIT}" "$@";; + *) + echo Unknown architecture \($MACHINE\) -- unable to run ninja. + print_help + exit 1;; esac ;; Darwin) exec "${THIS_DIR}/ninja-mac" "$@";;