diff options
author | Russ Cox <rsc@golang.org> | 2012-02-04 00:54:08 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2012-02-04 00:54:08 -0500 |
commit | e943b5875300074ee7c0a22a562246cc1641f17a (patch) | |
tree | 4d55df98a088acb205f199bfc5474852fd6f227f /src/make.bash | |
parent | ff39c5ed4b452204511fdc623893f5ce2fc56491 (diff) | |
download | go-e943b5875300074ee7c0a22a562246cc1641f17a.tar.gz |
build: use cmd/dist
R=bradfitz, ality, r, r, iant, mikioh.mikioh
CC=golang-dev
http://codereview.appspot.com/5615058
Diffstat (limited to 'src/make.bash')
-rwxr-xr-x | src/make.bash | 123 |
1 files changed, 20 insertions, 103 deletions
diff --git a/src/make.bash b/src/make.bash index 9b4377070..1c29568fd 100755 --- a/src/make.bash +++ b/src/make.bash @@ -4,12 +4,12 @@ # license that can be found in the LICENSE file. set -e -if [ ! -f env.bash ]; then +if [ ! -f run.bash ]; then echo 'make.bash must be run from $GOROOT/src' 1>&2 exit 1 fi -. ./env.bash +# Test for bad ld. if ld --version 2>&1 | grep 'gold.* 2\.20' >/dev/null; then echo 'ERROR: Your system has gold 2.20 installed.' echo 'This version is shipped by Ubuntu even though' @@ -21,48 +21,9 @@ if ld --version 2>&1 | grep 'gold.* 2\.20' >/dev/null; then exit 1 fi -# Create target directories -mkdir -p "$GOROOT/bin/tool" -mkdir -p "$GOROOT/pkg" - -# Remove old, pre-tool binaries. -rm -rf "$GOROOT"/bin/go-tool -rm -f "$GOROOT"/bin/[568][acgl] -rm -f "$GOROOT"/bin/{6cov,6nm,cgo,ebnflint,goapi,gofix,goinstall,gomake,gopack,gopprof,gotest,gotype,govet,goyacc,quietgcc} - -# If GOBIN is set and it has a Go compiler, it must also be cleaned. -if [ -n "GOBIN" ]; then - if [ -x "$GOBIN"/5g -o -x "$GOBIN"/6g -o -x "$GOBIN"/8g ]; then - rm -f "$GOBIN"/[568][acgl] - rm -f "$GOBIN"/{6cov,6nm,cgo,ebnflint,goapi,gofix,goinstall,gomake,gopack,gopprof,gotest,gotype,govet,goyacc,quietgcc} - fi -fi - -GOROOT_FINAL=${GOROOT_FINAL:-$GOROOT} - -MAKEFLAGS=${MAKEFLAGS:-"-j4"} -export MAKEFLAGS -unset CDPATH # in case user has it set - -rm -f "$GOBIN"/quietgcc -rm -f "$GOROOT/bin/tool/quietgcc" -CC=${CC:-gcc} -export CC -sed -e "s|@CC@|$CC|" < "$GOROOT"/src/quietgcc.bash > "$GOROOT"/bin/tool/quietgcc -chmod +x "$GOROOT"/bin/tool/quietgcc - -export GOMAKE="$GOROOT"/bin/tool/make -rm -f "$GOBIN"/gomake -rm -f "$GOMAKE" -( - echo '#!/bin/sh' - echo 'export GOROOT=${GOROOT:-'$GOROOT_FINAL'}' - echo 'exec '$MAKE' "$@"' -) >"$GOMAKE" -chmod +x "$GOMAKE" - -# on Fedora 16 the selinux filesystem is mounted at /sys/fs/selinux, -# so loop through the possible selinux mount points +# Test for bad SELinux. +# On Fedora 16 the selinux filesystem is mounted at /sys/fs/selinux, +# so loop through the possible selinux mount points. for se_mount in /selinux /sys/fs/selinux do if [ -d $se_mount -a -f $se_mount/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then @@ -82,67 +43,23 @@ do fi done -bash "$GOROOT"/src/clean.bash - -# pkg builds runtime/cgo and the Go programs in cmd. -for i in lib9 libbio libmach cmd -do - echo; echo; echo %%%% making $i %%%%; echo - "$GOMAKE" -C $i install -done - -echo; echo; echo %%%% making runtime generated files %%%%; echo - -( - cd "$GOROOT"/src/pkg/runtime - ./autogen.sh - "$GOMAKE" install; "$GOMAKE" clean # copy runtime.h to pkg directory -) || exit 1 +# Finally! Run the build. +echo '# Building C bootstrap tool.' +mkdir -p ../bin/tool +gcc -O2 -Wall -Werror -o ../bin/tool/dist -Icmd/dist cmd/dist/*.c echo -echo '# Building go_bootstrap command from bootstrap script.' -if ! ./buildscript/${GOOS}_$GOARCH.sh; then - echo '# Bootstrap script failed.' - if [ ! -x "$GOBIN/go" ]; then - exit 1 - fi - echo '# Regenerating bootstrap script using pre-existing go binary.' - ./buildscript.sh - ./buildscript/${GOOS}_$GOARCH.sh -fi - -# Clean what clean.bash couldn't. -go_bootstrap clean std - -echo '# Building Go code.' -go_bootstrap install -a -v std -rm -f "$GOBIN/go_bootstrap" -# 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 $("$GOMAKE" --no-print-directory -f Make.inc go-env) - echo - echo --- - echo Installed Go for $GOOS/$GOARCH in "$GOROOT". - echo Installed commands in "$GOBIN". - case "$OLDPATH" in - "$GOBIN:"* | *":$GOBIN" | *":$GOBIN:"*) - ;; - *) - echo '***' "You need to add $GOBIN to your "'$PATH.' '***' - esac - 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 -} +echo '# Building compilers and Go bootstrap tool.' +../bin/tool/dist bootstrap -v # builds go_bootstrap +echo -(installed) # run in sub-shell to avoid polluting environment +echo '# Building packages and commands.' +../bin/tool/go_bootstrap clean std +../bin/tool/go_bootstrap install -a -v std +rm -f ../bin/tool/go_bootstrap +echo +if [ "$1" != "--no-banner" ]; then + ../bin/tool/dist banner +fi |