blob: b007418db6bb5b47884c0d605c88bfef03a6cd9f [file] [log] [blame]
Devon H. O'Dell553be842009-11-14 15:29:09 -08001#!/usr/bin/env bash
Kai Backman5748c082009-08-18 07:17:34 -07002# 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
6set -e
7GOBIN="${GOBIN:-$HOME/bin}"
8export MAKEFLAGS=-j4
9
Sergio Luis O. B. Correia6fc82072009-11-23 17:32:51 -080010if ! test -f "$GOROOT"/include/u.h
Kai Backman5748c082009-08-18 07:17:34 -070011then
12 echo '$GOROOT is not set correctly or not exported' 1>&2
13 exit 1
14fi
15
Kai Backman529216f2009-11-14 23:08:22 -080016if ! test -d $GOBIN
17then
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
21fi
22
23case "$GOARCH" in
24arm)
25 ;;
26*)
27 echo '$GOARCH is set to <'$GOARCH'>, must be arm' 1>&2
28 exit 1
29esac
30
31case "$GOOS" in
32linux)
33 ;;
34*)
35 echo '$GOOS is set to <'$GOOS'>, must be linux' 1>&2
36 exit 1
37esac
38
Kai Backman5748c082009-08-18 07:17:34 -070039bash clean.bash
40
41rm -f $GOBIN/quietgcc
42cp quietgcc.bash $GOBIN/quietgcc
43chmod +x $GOBIN/quietgcc
44
Kai Backman529216f2009-11-14 23:08:22 -080045rm -f $GOBIN/gomake
46MAKE=make
47if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
48 MAKE=gmake
49fi
50(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >$GOBIN/gomake
51chmod +x $GOBIN/gomake
52
Russ Cox7fce5ad2009-11-19 21:16:26 -080053bash clean.bash
54
Kai Backman5748c082009-08-18 07:17:34 -070055# TODO(kaib): converge with normal build
Kai Backmanb74fd8e2009-10-23 12:43:01 -070056#for i in lib9 libbio libmach cmd pkg libcgo cmd/cgo cmd/ebnflint cmd/godoc cmd/gofmt
Kai Backman770b8722009-10-29 21:21:14 -070057for i in lib9 libbio libmach cmd pkg cmd/ebnflint cmd/godoc cmd/gofmt
Kai Backman5748c082009-08-18 07:17:34 -070058do
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 Cox7fce5ad2009-11-19 21:16:26 -080070 pkg)
71 bash deps.bash
72 gomake install
73 ;;
Kai Backman5748c082009-08-18 07:17:34 -070074 *)
75 make install
76 esac
77 ) || exit 1
78done
79
80case "`uname`" in
81Darwin)
82 echo;
83 echo %%% run sudo.bash to install debuggers
84 echo
85esac