[email protected] | df0fcd6 | 2012-01-14 01:37:46 | [diff] [blame] | 1 | #!/bin/bash |
[email protected] | 5b83491 | 2012-01-13 23:33:35 | [diff] [blame] | 2 | |
[email protected] | c7bf35f | 2012-04-13 20:17:29 | [diff] [blame] | 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 | ||||
5 | # found in the LICENSE file. | ||||
6 | |||||
[email protected] | df0fcd6 | 2012-01-14 01:37:46 | [diff] [blame] | 7 | OS="$(uname -s)" |
[email protected] | fdf5ca8 | 2012-11-01 21:50:26 | [diff] [blame] | 8 | THIS_DIR="$(dirname "${0}")" |
[email protected] | df0fcd6 | 2012-01-14 01:37:46 | [diff] [blame] | 9 | |
[email protected] | a5957db | 2012-12-11 22:15:40 | [diff] [blame^] | 10 | function print_help() { |
11 | cat <<-EOF | ||||
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 | |||||
[email protected] | 5f52223 | 2012-12-11 18:00:15 | [diff] [blame] | 21 | case "$OS" in |
22 | Linux) | ||||
23 | MACHINE=$(getconf LONG_BIT) | ||||
24 | case "$MACHINE" in | ||||
25 | 32|64) exec "${THIS_DIR}/ninja-linux${MACHINE}" "$@";; | ||||
26 | *) echo Unknown architecture \($MACHINE\) -- unable to run ninja. | ||||
[email protected] | a5957db | 2012-12-11 22:15:40 | [diff] [blame^] | 27 | print_help |
[email protected] | 5f52223 | 2012-12-11 18:00:15 | [diff] [blame] | 28 | exit 1;; |
29 | esac | ||||
30 | ;; | ||||
31 | Darwin) exec "${THIS_DIR}/ninja-mac" "$@";; | ||||
32 | CYGWIN*) exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; | ||||
33 | MINGW32*) cmd.exe //c $0.exe "$@";; | ||||
34 | *) echo "Unsupported OS ${OS}" | ||||
[email protected] | a5957db | 2012-12-11 22:15:40 | [diff] [blame^] | 35 | print_help |
[email protected] | 5f52223 | 2012-12-11 18:00:15 | [diff] [blame] | 36 | exit 1;; |
37 | esac |