summaryrefslogtreecommitdiff
path: root/src/env.bash
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-08-24 20:00:33 -0400
committerRuss Cox <rsc@golang.org>2010-08-24 20:00:33 -0400
commitdcb6b277d7e6cc76451e9c12c3fa7d3227a7510c (patch)
treeebe80eb78031e7655219cef81feafdd2a6d43c21 /src/env.bash
parent245294d7b6cbc887554e424574ff36f88df42c00 (diff)
downloadgo-dcb6b277d7e6cc76451e9c12c3fa7d3227a7510c.tar.gz
build: $GOBIN defaults to $GOROOT/bin
R=r CC=golang-dev http://codereview.appspot.com/1982049
Diffstat (limited to 'src/env.bash')
-rw-r--r--src/env.bash27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/env.bash b/src/env.bash
index fc6f5bea6..b858e069b 100644
--- a/src/env.bash
+++ b/src/env.bash
@@ -3,21 +3,6 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-if test -z "$GOBIN"; then
- if ! test -d "$HOME"/bin; then
- echo '$GOBIN is not set and $HOME/bin is not a directory or does not exist.' 1>&2
- echo 'mkdir $HOME/bin or set $GOBIN to a directory where binaries should' 1>&2
- echo 'be installed.' 1>&2
- exit 1
- fi
- GOBIN="$HOME/bin"
-elif ! test -d "$GOBIN"; then
- echo '$GOBIN is not a directory or does not exist' 1>&2
- echo 'create it or set $GOBIN differently' 1>&2
- exit 1
-fi
-export GOBIN
-
export GOROOT=${GOROOT:-$(cd ..; pwd)}
if ! test -f "$GOROOT"/include/u.h
@@ -36,6 +21,16 @@ if [ "$DIR1" != "$DIR2" ]; then
exit 1
fi
+export GOBIN=${GOBIN:-"$GOROOT/bin"}
+if [ ! -d "$GOBIN" ]; then
+ echo '$GOBIN is not a directory or does not exist' 1>&2
+ echo 'create it or set $GOBIN differently' 1>&2
+ exit 1
+fi
+
+export OLDPATH=$PATH
+export PATH=/bin:/usr/bin:$GOBIN:$PATH
+
MAKE=make
if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
MAKE=gmake
@@ -43,7 +38,7 @@ fi
# Tried to use . <($MAKE ...) here, but it cannot set environment
# variables in the version of bash that ships with OS X. Amazing.
-eval $($MAKE --no-print-directory -f Make.inc.in go-env | egrep 'GOARCH|GOOS|GO_ENV')
+eval $($MAKE --no-print-directory -f Make.inc go-env | egrep 'GOARCH|GOOS|GO_ENV')
# Shell doesn't tell us whether make succeeded,
# so Make.inc generates a fake variable name.