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() { | |
11 cat <<-EOF | |
M-A Ruel
2012/12/11 18:45:06
I only meant to have " cat << EOF" and the rest n
| |
12 No prebuilt ninja binary was found for this system. | |
13 Try building your own binary by doing: | |
14 cd ~ | |
15 git clone https://github.com/martine/ninja.git -b v1.0.0 | |
16 ./ninja/bootstrap.py | |
17 Then add ~/ninja/ to your PATH. | |
18 EOF | |
19 } | |
20 | |
10 if [ "${OS}" = "Linux" ]; then | 21 if [ "${OS}" = "Linux" ]; then |
11 machine=$(getconf LONG_BIT) | 22 machine=$(getconf LONG_BIT) |
12 if [[ "$machine" = "64" ]]; then | 23 if [[ "$machine" = "64" ]]; then |
13 exec "${THIS_DIR}/ninja-linux64" "$@" | 24 exec "${THIS_DIR}/ninja-linux64" "$@" |
14 elif [[ "$machine" = "32" ]]; then | 25 elif [[ "$machine" = "32" ]]; then |
15 exec "${THIS_DIR}/ninja-linux32" "$@" | 26 exec "${THIS_DIR}/ninja-linux32" "$@" |
16 else | 27 else |
17 echo Unknown architecture \($machine\) -- unable to run ninja. | 28 echo "Unknown architecture ${machine}." |
29 print_help | |
18 exit 1 | 30 exit 1 |
19 fi | 31 fi |
20 elif [ "${OS}" = "Darwin" ]; then | 32 elif [ "${OS}" = "Darwin" ]; then |
21 exec "${THIS_DIR}/ninja-mac" "$@" | 33 exec "${THIS_DIR}/ninja-mac" "$@" |
22 elif [[ ${OS} == CYGWIN* ]]; then | 34 elif [[ ${OS} == CYGWIN* ]]; then |
23 exec cmd.exe /c `cygpath -t windows $0`.exe "$@" | 35 exec cmd.exe /c `cygpath -t windows $0`.exe "$@" |
24 elif [[ ${OS} == MINGW32* ]]; then | 36 elif [[ ${OS} == MINGW32* ]]; then |
25 cmd.exe //c $0.exe "$@" | 37 cmd.exe //c $0.exe "$@" |
26 else | 38 else |
27 echo "Unsupported OS ${OS}" | 39 echo "Unsupported OS ${OS}" |
40 print_help | |
28 exit 1 | 41 exit 1 |
29 fi | 42 fi |
30 | 43 |
OLD | NEW |