| OLD | NEW | 
|---|
| 1 #!/bin/bash | 1 #!/bin/bash | 
| 2 | 2 | 
| 3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 Google Inc. All rights reserved. | 
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be | 
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. | 
| 6 | 6 | 
| 7 OS="$(uname -s)" | 7 OS="$(uname -s)" | 
| 8 THIS_DIR="$(dirname "${0}")" | 8 THIS_DIR="$(dirname "${0}")" | 
| 9 | 9 | 
| 10 function print_help() { | 10 function print_help() { | 
| 11 cat <<-EOF | 11 cat <<-EOF | 
| 12 No prebuilt ninja binary was found for this system. | 12 No prebuilt ninja binary was found for this system. | 
| 13 Try building your own binary by doing: | 13 Try building your own binary by doing: | 
| 14   cd ~ | 14   cd ~ | 
| 15   git clone https://github.com/martine/ninja.git -b v1.4.0 | 15   git clone https://github.com/martine/ninja.git -b v1.4.0 | 
| 16   ./ninja/bootstrap.py | 16   ./ninja/bootstrap.py | 
| 17 Then add ~/ninja/ to your PATH. | 17 Then add ~/ninja/ to your PATH. | 
| 18 EOF | 18 EOF | 
| 19 } | 19 } | 
| 20 | 20 | 
| 21 case "$OS" in | 21 case "$OS" in | 
| 22   Linux) | 22   Linux) | 
| 23     MACHINE=$(getconf LONG_BIT) | 23     MACHINE=$(uname -m) | 
| 24     case "$MACHINE" in | 24     case "$MACHINE" in | 
| 25       32|64)  exec "${THIS_DIR}/ninja-linux${MACHINE}" "$@";; | 25       i?86|x86_64) | 
| 26       *)      echo Unknown architecture \($MACHINE\) -- unable to run ninja. | 26         LONG_BIT=$(getconf LONG_BIT) | 
| 27               print_help | 27         # We know we are on x86 but we need to use getconf to determine | 
| 28               exit 1;; | 28         # bittage of the userspace install (e.g. when runing 32-bit userspace | 
|  | 29         # on x86_64 kernel) | 
|  | 30         exec "${THIS_DIR}/ninja-linux${LONG_BIT}" "$@";; | 
|  | 31       *) | 
|  | 32         echo Unknown architecture \($MACHINE\) -- unable to run ninja. | 
|  | 33         print_help | 
|  | 34         exit 1;; | 
| 29     esac | 35     esac | 
| 30     ;; | 36     ;; | 
| 31   Darwin)    exec "${THIS_DIR}/ninja-mac" "$@";; | 37   Darwin)    exec "${THIS_DIR}/ninja-mac" "$@";; | 
| 32   CYGWIN*)   exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; | 38   CYGWIN*)   exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; | 
| 33   MINGW32*)  cmd.exe //c $0.exe "$@";; | 39   MINGW32*)  cmd.exe //c $0.exe "$@";; | 
| 34   *)         echo "Unsupported OS ${OS}" | 40   *)         echo "Unsupported OS ${OS}" | 
| 35              print_help | 41              print_help | 
| 36              exit 1;; | 42              exit 1;; | 
| 37 esac | 43 esac | 
| OLD | NEW | 
|---|