Devon H. O'Dell | 553be84 | 2009-11-14 15:29:09 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Kai Backman | 5748c08 | 2009-08-18 07:17:34 -0700 | [diff] [blame] | 2 | # Copyright 2009 The Go Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style |
| 4 | # license that can be found in the LICENSE file. |
| 5 | |
| 6 | set -e |
| 7 | GOBIN="${GOBIN:-$HOME/bin}" |
| 8 | export MAKEFLAGS=-j4 |
| 9 | |
Sergio Luis O. B. Correia | 6fc8207 | 2009-11-23 17:32:51 -0800 | [diff] [blame] | 10 | if ! test -f "$GOROOT"/include/u.h |
Kai Backman | 5748c08 | 2009-08-18 07:17:34 -0700 | [diff] [blame] | 11 | then |
| 12 | echo '$GOROOT is not set correctly or not exported' 1>&2 |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
Kai Backman | 529216f | 2009-11-14 23:08:22 -0800 | [diff] [blame] | 16 | if ! test -d $GOBIN |
| 17 | then |
| 18 | echo '$GOBIN is not a directory or does not exist' 1>&2 |
| 19 | echo 'create it or set $GOBIN differently' 1>&2 |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
| 23 | case "$GOARCH" in |
| 24 | arm) |
| 25 | ;; |
| 26 | *) |
| 27 | echo '$GOARCH is set to <'$GOARCH'>, must be arm' 1>&2 |
| 28 | exit 1 |
| 29 | esac |
| 30 | |
| 31 | case "$GOOS" in |
| 32 | linux) |
| 33 | ;; |
| 34 | *) |
| 35 | echo '$GOOS is set to <'$GOOS'>, must be linux' 1>&2 |
| 36 | exit 1 |
| 37 | esac |
| 38 | |
Kai Backman | 5748c08 | 2009-08-18 07:17:34 -0700 | [diff] [blame] | 39 | bash clean.bash |
| 40 | |
| 41 | rm -f $GOBIN/quietgcc |
| 42 | cp quietgcc.bash $GOBIN/quietgcc |
| 43 | chmod +x $GOBIN/quietgcc |
| 44 | |
Kai Backman | 529216f | 2009-11-14 23:08:22 -0800 | [diff] [blame] | 45 | rm -f $GOBIN/gomake |
| 46 | MAKE=make |
| 47 | if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then |
| 48 | MAKE=gmake |
| 49 | fi |
| 50 | (echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >$GOBIN/gomake |
| 51 | chmod +x $GOBIN/gomake |
| 52 | |
Russ Cox | 7fce5ad | 2009-11-19 21:16:26 -0800 | [diff] [blame] | 53 | bash clean.bash |
| 54 | |
Kai Backman | 5748c08 | 2009-08-18 07:17:34 -0700 | [diff] [blame] | 55 | # TODO(kaib): converge with normal build |
Kai Backman | b74fd8e | 2009-10-23 12:43:01 -0700 | [diff] [blame] | 56 | #for i in lib9 libbio libmach cmd pkg libcgo cmd/cgo cmd/ebnflint cmd/godoc cmd/gofmt |
Kai Backman | 770b872 | 2009-10-29 21:21:14 -0700 | [diff] [blame] | 57 | for i in lib9 libbio libmach cmd pkg cmd/ebnflint cmd/godoc cmd/gofmt |
Kai Backman | 5748c08 | 2009-08-18 07:17:34 -0700 | [diff] [blame] | 58 | do |
| 59 | # The ( ) here are to preserve the current directory |
| 60 | # for the next round despite the cd $i below. |
| 61 | # set -e does not apply to ( ) so we must explicitly |
| 62 | # test the exit status. |
| 63 | ( |
| 64 | echo; echo; echo %%%% making $i %%%%; echo |
| 65 | cd $i |
| 66 | case $i in |
| 67 | cmd) |
| 68 | bash make.bash |
| 69 | ;; |
Russ Cox | 7fce5ad | 2009-11-19 21:16:26 -0800 | [diff] [blame] | 70 | pkg) |
| 71 | bash deps.bash |
| 72 | gomake install |
| 73 | ;; |
Kai Backman | 5748c08 | 2009-08-18 07:17:34 -0700 | [diff] [blame] | 74 | *) |
| 75 | make install |
| 76 | esac |
| 77 | ) || exit 1 |
| 78 | done |
| 79 | |
| 80 | case "`uname`" in |
| 81 | Darwin) |
| 82 | echo; |
| 83 | echo %%% run sudo.bash to install debuggers |
| 84 | echo |
| 85 | esac |