summaryrefslogtreecommitdiff
path: root/src/make.bash
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-08-18 10:08:49 -0400
committerRuss Cox <rsc@golang.org>2010-08-18 10:08:49 -0400
commitd5a213c027d18c2c8de4b869af2b6839badb3871 (patch)
treefce12a0753dcdb206ec0d64d571afcfc1711145c /src/make.bash
parentae4b93f1aa082f2529247d0eddcc5a04ffa71564 (diff)
downloadgo-d5a213c027d18c2c8de4b869af2b6839badb3871.tar.gz
build: no required environment variables
R=adg, r, PeterGo CC=golang-dev http://codereview.appspot.com/1942044
Diffstat (limited to 'src/make.bash')
-rwxr-xr-xsrc/make.bash45
1 files changed, 35 insertions, 10 deletions
diff --git a/src/make.bash b/src/make.bash
index b95635b56..6124dbfb7 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -4,8 +4,16 @@
# license that can be found in the LICENSE file.
set -e
+if [ ! -f env.bash ]; then
+ echo 'make.bash must be run from $GOROOT/src' 1>&2
+ exit 1
+fi
. ./env.bash
+GOROOT_FINAL=${GOROOT_FINAL:-$GOROOT}
+rm -f Make.inc
+sed 's!@@GOROOT@@!'"$GOROOT_FINAL"'!' Make.inc.in >Make.inc
+
MAKEFLAGS=${MAKEFLAGS:-"-j4"}
export MAKEFLAGS
unset CDPATH # in case user has it set
@@ -17,11 +25,11 @@ sed -e "s|@CC@|$CC|" < "$GOROOT"/src/quietgcc.bash > "$GOBIN"/quietgcc
chmod +x "$GOBIN"/quietgcc
rm -f "$GOBIN"/gomake
-MAKE=make
-if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
- MAKE=gmake
-fi
-(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >"$GOBIN"/gomake
+(
+ echo '#!/bin/sh'
+ echo 'export GOROOT=${GOROOT:-'$GOROOT_FINAL'}'
+ echo 'exec '$MAKE' "$@"'
+) >"$GOBIN"/gomake
chmod +x "$GOBIN"/gomake
if [ -d /selinux -a -f /selinux/booleans/allow_execstack ] ; then
@@ -73,9 +81,26 @@ do
esac
done
-case "`uname`" in
-Darwin)
- echo;
- echo %%% run sudo.bash to install debuggers
+# Print post-install messages.
+# Implemented as a function so that all.bash can repeat the output
+# after run.bash finishes running all the tests.
+installed() {
+ eval $("$GOBIN"/gomake -f Make.inc go-env)
echo
-esac
+ echo ---
+ echo Installed Go for $GOOS/$GOARCH in "$GOROOT".
+ echo Installed commands in "$GOBIN".
+ echo The compiler is $GC.
+ if [ "$(uname)" = "Darwin" ]; then
+ echo
+ echo On OS X the debuggers must be installed setgrp procmod.
+ echo Read and run ./sudo.bash to install the debuggers.
+ fi
+ if [ "$GOROOT_FINAL" != "$GOROOT" ]; then
+ echo
+ echo The binaries expect "$GOROOT" to be copied or moved to "$GOROOT_FINAL".
+ fi
+}
+
+(installed) # run in sub-shell to avoid polluting environment
+