[email protected] | ec238db | 2014-06-02 20:39:42 | [diff] [blame] | 1 | #!/usr/bin/env 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 ~ | ||||
thakis | 28a1ff4 | 2016-11-09 17:29:10 | [diff] [blame] | 15 | git clone https://github.com/martine/ninja.git -b v1.7.2 |
[email protected] | bf216bf | 2014-11-24 21:19:14 | [diff] [blame] | 16 | cd ninja && ./configure.py --bootstrap |
[email protected] | a5957db | 2012-12-11 22:15:40 | [diff] [blame] | 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) | ||||
[email protected] | a9f824d | 2013-10-08 18:29:50 | [diff] [blame] | 23 | MACHINE=$(uname -m) |
[email protected] | 5f52223 | 2012-12-11 18:00:15 | [diff] [blame] | 24 | case "$MACHINE" in |
[email protected] | a9f824d | 2013-10-08 18:29:50 | [diff] [blame] | 25 | i?86|x86_64) |
26 | LONG_BIT=$(getconf LONG_BIT) | ||||
27 | # We know we are on x86 but we need to use getconf to determine | ||||
Quinten Yearsley | 442fb64 | 2016-12-15 23:38:27 | [diff] [blame] | 28 | # bittage of the userspace install (e.g. when running 32-bit userspace |
[email protected] | a9f824d | 2013-10-08 18:29:50 | [diff] [blame] | 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;; | ||||
[email protected] | 5f52223 | 2012-12-11 18:00:15 | [diff] [blame] | 35 | esac |
36 | ;; | ||||
37 | Darwin) exec "${THIS_DIR}/ninja-mac" "$@";; | ||||
38 | CYGWIN*) exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; | ||||
[email protected] | 1019fe7 | 2016-01-28 19:56:39 | [diff] [blame] | 39 | MINGW*) cmd.exe //c $0.exe "$@";; |
[email protected] | 5f52223 | 2012-12-11 18:00:15 | [diff] [blame] | 40 | *) echo "Unsupported OS ${OS}" |
[email protected] | a5957db | 2012-12-11 22:15:40 | [diff] [blame] | 41 | print_help |
[email protected] | 5f52223 | 2012-12-11 18:00:15 | [diff] [blame] | 42 | exit 1;; |
43 | esac |