blob: 282cc2768728014ed3acbec6a3d522919054312d [file] [log] [blame]
[email protected]ec238db2014-06-02 20:39:421#!/usr/bin/env bash
[email protected]5b834912012-01-13 23:33:352
[email protected]c7bf35f2012-04-13 20:17:293# 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]df0fcd62012-01-14 01:37:467OS="$(uname -s)"
[email protected]fdf5ca82012-11-01 21:50:268THIS_DIR="$(dirname "${0}")"
[email protected]df0fcd62012-01-14 01:37:469
[email protected]a5957db2012-12-11 22:15:4010function print_help() {
11cat <<-EOF
12No prebuilt ninja binary was found for this system.
13Try building your own binary by doing:
14 cd ~
thakis28a1ff42016-11-09 17:29:1015 git clone https://github.com/martine/ninja.git -b v1.7.2
[email protected]bf216bf2014-11-24 21:19:1416 cd ninja && ./configure.py --bootstrap
[email protected]a5957db2012-12-11 22:15:4017Then add ~/ninja/ to your PATH.
18EOF
19}
20
[email protected]5f522232012-12-11 18:00:1521case "$OS" in
22 Linux)
[email protected]a9f824d2013-10-08 18:29:5023 MACHINE=$(uname -m)
[email protected]5f522232012-12-11 18:00:1524 case "$MACHINE" in
[email protected]a9f824d2013-10-08 18:29:5025 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 Yearsley442fb642016-12-15 23:38:2728 # bittage of the userspace install (e.g. when running 32-bit userspace
[email protected]a9f824d2013-10-08 18:29:5029 # 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]5f522232012-12-11 18:00:1535 esac
36 ;;
37 Darwin) exec "${THIS_DIR}/ninja-mac" "$@";;
38 CYGWIN*) exec cmd.exe /c $(cygpath -t windows $0).exe "$@";;
[email protected]1019fe72016-01-28 19:56:3939 MINGW*) cmd.exe //c $0.exe "$@";;
[email protected]5f522232012-12-11 18:00:1540 *) echo "Unsupported OS ${OS}"
[email protected]a5957db2012-12-11 22:15:4041 print_help
[email protected]5f522232012-12-11 18:00:1542 exit 1;;
43esac