r.c.ladan@gmail.com | ec238db | 2014-06-02 20:39:42 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
evan@chromium.org | 5b83491 | 2012-01-13 23:33:35 +0000 | [diff] [blame] | 2 | |
scottmg@chromium.org | c7bf35f | 2012-04-13 20:17:29 +0000 | [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 | |
thakis@chromium.org | df0fcd6 | 2012-01-14 01:37:46 +0000 | [diff] [blame] | 7 | OS="$(uname -s)" |
thakis@chromium.org | fdf5ca8 | 2012-11-01 21:50:26 +0000 | [diff] [blame] | 8 | THIS_DIR="$(dirname "${0}")" |
thakis@chromium.org | df0fcd6 | 2012-01-14 01:37:46 +0000 | [diff] [blame] | 9 | |
thakis@chromium.org | a5957db | 2012-12-11 22:15:40 +0000 | [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 ~ |
Takuto Ikuta | a21a7c5 | 2018-12-03 12:24:53 +0000 | [diff] [blame] | 15 | git clone https://github.com/ninja-build/ninja.git -b v1.8.2 |
thakis@chromium.org | bf216bf | 2014-11-24 21:19:14 +0000 | [diff] [blame] | 16 | cd ninja && ./configure.py --bootstrap |
thakis@chromium.org | a5957db | 2012-12-11 22:15:40 +0000 | [diff] [blame] | 17 | Then add ~/ninja/ to your PATH. |
| 18 | EOF |
| 19 | } |
| 20 | |
tony@chromium.org | 5f52223 | 2012-12-11 18:00:15 +0000 | [diff] [blame] | 21 | case "$OS" in |
| 22 | Linux) |
sbc@chromium.org | a9f824d | 2013-10-08 18:29:50 +0000 | [diff] [blame] | 23 | MACHINE=$(uname -m) |
tony@chromium.org | 5f52223 | 2012-12-11 18:00:15 +0000 | [diff] [blame] | 24 | case "$MACHINE" in |
sbc@chromium.org | a9f824d | 2013-10-08 18:29:50 +0000 | [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 15:38:27 -0800 | [diff] [blame] | 28 | # bittage of the userspace install (e.g. when running 32-bit userspace |
sbc@chromium.org | a9f824d | 2013-10-08 18:29:50 +0000 | [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;; |
tony@chromium.org | 5f52223 | 2012-12-11 18:00:15 +0000 | [diff] [blame] | 35 | esac |
| 36 | ;; |
| 37 | Darwin) exec "${THIS_DIR}/ninja-mac" "$@";; |
| 38 | CYGWIN*) exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; |
primiano@chromium.org | 1019fe7 | 2016-01-28 19:56:39 +0000 | [diff] [blame] | 39 | MINGW*) cmd.exe //c $0.exe "$@";; |
tony@chromium.org | 5f52223 | 2012-12-11 18:00:15 +0000 | [diff] [blame] | 40 | *) echo "Unsupported OS ${OS}" |
thakis@chromium.org | a5957db | 2012-12-11 22:15:40 +0000 | [diff] [blame] | 41 | print_help |
tony@chromium.org | 5f52223 | 2012-12-11 18:00:15 +0000 | [diff] [blame] | 42 | exit 1;; |
| 43 | esac |