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 echo "No prebuilt ninja binary was found for this system." | |
Lei Zhang
2012/12/10 20:34:45
you can also:
cat << __EOF
here is
my
message
__E
Nico
2012/12/11 04:49:34
Done.
| |
12 echo "Try building your own binary by doing:" | |
13 echo " cd ~" | |
14 echo " git clone https://github.com/martine/ninja.git" | |
15 echo " cd ninja" | |
16 echo " git checkout v1.0.0" | |
17 echo " ./bootstrap.py" | |
18 echo "Then add ~/ninja/ to your PATH." | |
19 } | |
20 | |
10 if [ "${OS}" = "Linux" ]; then | 21 if [ "${OS}" = "Linux" ]; then |
11 exec "${THIS_DIR}/ninja-linux64" "$@" | 22 machine=$(getconf LONG_BIT) |
23 if [ "$machine" = "64" ]; then | |
24 exec "${THIS_DIR}/ninja-linux64" "$@" | |
25 else | |
26 echo "Unsupported machine ${machine}" | |
27 print_help | |
28 exit 1 | |
29 fi | |
12 elif [ "${OS}" = "Darwin" ]; then | 30 elif [ "${OS}" = "Darwin" ]; then |
13 exec "${THIS_DIR}/ninja-mac" "$@" | 31 exec "${THIS_DIR}/ninja-mac" "$@" |
14 elif [[ ${OS} == CYGWIN* ]]; then | 32 elif [[ ${OS} == CYGWIN* ]]; then |
15 exec cmd.exe /c `cygpath -t windows $0`.exe "$@" | 33 exec cmd.exe /c `cygpath -t windows $0`.exe "$@" |
16 elif [[ ${OS} == MINGW32* ]]; then | 34 elif [[ ${OS} == MINGW32* ]]; then |
17 cmd.exe //c $0.exe "$@" | 35 cmd.exe //c $0.exe "$@" |
18 else | 36 else |
19 echo "Unsupported OS ${OS}" | 37 echo "Unsupported OS ${OS}" |
38 print_help | |
20 exit 1 | 39 exit 1 |
21 fi | 40 fi |
22 | |
OLD | NEW |