2012-05-01 23:32:46 -06:00
|
|
|
#!/bin/rc -e
|
|
|
|
# Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
2015-01-13 00:01:18 -07:00
|
|
|
# See golang.org/s/go15bootstrap for an overview of the build process.
|
|
|
|
|
2012-05-01 23:32:46 -06:00
|
|
|
# Environment variables that control make.rc:
|
|
|
|
#
|
|
|
|
# GOROOT_FINAL: The expected final Go root, baked into binaries.
|
|
|
|
# The default is the location of the Go tree during the build.
|
|
|
|
#
|
|
|
|
# GOHOSTARCH: The architecture for host tools (compilers and
|
|
|
|
# binaries). Binaries of this type must be executable on the current
|
|
|
|
# system, so the only common reason to set this is to set
|
|
|
|
# GOHOSTARCH=386 on an amd64 machine.
|
|
|
|
#
|
|
|
|
# GOARCH: The target architecture for installed packages and tools.
|
|
|
|
#
|
|
|
|
# GOOS: The target operating system for installed packages and tools.
|
|
|
|
#
|
2015-05-28 01:13:23 -06:00
|
|
|
# GO_GCFLAGS: Additional go tool compile arguments to use when
|
2012-05-01 23:32:46 -06:00
|
|
|
# building the packages and commands.
|
|
|
|
#
|
2015-05-28 01:13:23 -06:00
|
|
|
# GO_LDFLAGS: Additional go tool link arguments to use when
|
2012-05-01 23:32:46 -06:00
|
|
|
# building the commands.
|
|
|
|
#
|
2013-02-26 10:25:46 -07:00
|
|
|
# CGO_ENABLED: Controls cgo usage during the build. Set it to 1
|
|
|
|
# to include all cgo related files, .c and .go file with "cgo"
|
|
|
|
# build directive, in the build. Set it to 0 to ignore them.
|
2012-05-01 23:32:46 -06:00
|
|
|
|
|
|
|
rfork e
|
2013-02-26 10:25:46 -07:00
|
|
|
if(! test -f run.rc){
|
2012-05-01 23:32:46 -06:00
|
|
|
echo 'make.rc must be run from $GOROOT/src' >[1=2]
|
|
|
|
exit wrongdir
|
|
|
|
}
|
|
|
|
|
|
|
|
# Clean old generated file that will cause problems in the build.
|
2014-09-07 22:06:45 -06:00
|
|
|
rm -f ./runtime/runtime_defs.go
|
2012-05-01 23:32:46 -06:00
|
|
|
|
|
|
|
# Determine the host compiler toolchain.
|
|
|
|
eval `{grep '^(CC|LD|O)=' /$objtype/mkfile}
|
|
|
|
|
2015-05-28 01:13:23 -06:00
|
|
|
echo '##### Building Go bootstrap tool.'
|
2012-05-01 23:32:46 -06:00
|
|
|
echo cmd/dist
|
|
|
|
GOROOT = `{cd .. && pwd}
|
2015-01-13 00:01:18 -07:00
|
|
|
if(! ~ $#GOROOT_BOOTSTRAP 1)
|
|
|
|
GOROOT_BOOTSTRAP = $home/go1.4
|
|
|
|
if(! test -x $GOROOT_BOOTSTRAP/bin/go){
|
|
|
|
echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go.' >[1=2]
|
|
|
|
echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2]
|
|
|
|
exit bootstrap
|
|
|
|
}
|
|
|
|
rm -f cmd/dist/dist
|
2015-01-14 13:14:54 -07:00
|
|
|
GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist
|
2012-05-01 23:32:46 -06:00
|
|
|
|
|
|
|
eval `{./cmd/dist/dist env -9}
|
|
|
|
echo
|
|
|
|
|
|
|
|
if(~ $1 --dist-tool){
|
|
|
|
# Stop after building dist tool.
|
|
|
|
mkdir -p $GOTOOLDIR
|
|
|
|
if(! ~ $2 '')
|
|
|
|
cp cmd/dist/dist $2
|
|
|
|
mv cmd/dist/dist $GOTOOLDIR/dist
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
buildall = -a
|
|
|
|
if(~ $1 --no-clean)
|
|
|
|
buildall = ()
|
|
|
|
./cmd/dist/dist bootstrap $buildall -v # builds go_bootstrap
|
|
|
|
# Delay move of dist tool to now, because bootstrap may clear tool directory.
|
|
|
|
mv cmd/dist/dist $GOTOOLDIR/dist
|
|
|
|
echo
|
|
|
|
|
2013-02-26 10:25:46 -07:00
|
|
|
# Run only one process at a time on 9vx.
|
|
|
|
if(~ $sysname vx32)
|
|
|
|
pflag = (-p 1)
|
2012-05-01 23:32:46 -06:00
|
|
|
|
|
|
|
if(! ~ $GOHOSTARCH $GOARCH || ! ~ $GOHOSTOS $GOOS){
|
2015-05-28 01:13:23 -06:00
|
|
|
echo '##### Building packages and commands for host,' $GOHOSTOS/$GOHOSTARCH^.
|
2012-05-01 23:32:46 -06:00
|
|
|
GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
|
2015-02-22 10:41:32 -07:00
|
|
|
$GOTOOLDIR/go_bootstrap install -gcflags $"GO_GCFLAGS -ldflags $"GO_LDFLAGS -v $pflag std cmd
|
2012-05-01 23:32:46 -06:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2015-05-28 01:13:23 -06:00
|
|
|
echo '##### Building packages and commands for' $GOOS/$GOARCH^.
|
2015-02-22 10:41:32 -07:00
|
|
|
$GOTOOLDIR/go_bootstrap install -gcflags $"GO_GCFLAGS -ldflags $"GO_LDFLAGS -v $pflag std cmd
|
2012-05-01 23:32:46 -06:00
|
|
|
echo
|
|
|
|
|
|
|
|
rm -f $GOTOOLDIR/go_bootstrap
|
|
|
|
|
|
|
|
if(! ~ $1 --no-banner)
|
|
|
|
$GOTOOLDIR/dist banner
|
2013-05-24 14:55:19 -06:00
|
|
|
|
|
|
|
status=''
|