diff options
author | Russ Cox <rsc@golang.org> | 2012-02-13 22:31:51 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2012-02-13 22:31:51 -0500 |
commit | 56435395989fa49773b9f83dcf3a4344447035e8 (patch) | |
tree | 406b0e9686a3e8a0379b937e1ab81bc1025d0e39 /src/make.bash | |
parent | 49b3d319d5fac1b92c9114d13d703984263eb4bb (diff) | |
download | go-56435395989fa49773b9f83dcf3a4344447035e8.tar.gz |
cmd/dist: cross-compiling fixes
This CL makes it possible to run make.bash with
GOOS and GOARCH set to something other than
the native host GOOS and GOARCH.
As part of the CL, the tool directory moves from bin/tool/
to pkg/tool/goos_goarch where goos and goarch are
the values for the host system (running the build), not
the target. pkg/ is not technically appropriate, but C objects
are there now tool (pkg/obj/) so this puts all the generated
binaries in one place (rm -rf $GOROOT/pkg cleans everything).
Including goos_goarch in the name allows different systems
to share a single $GOROOT on a shared file system.
Fixes issue 2920.
R=golang-dev, r
CC=golang-dev
http://codereview.appspot.com/5645093
Diffstat (limited to 'src/make.bash')
-rwxr-xr-x | src/make.bash | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/make.bash b/src/make.bash index 81ceeb729..e30743b68 100755 --- a/src/make.bash +++ b/src/make.bash @@ -61,24 +61,36 @@ mkdir -p ../bin/tool export GOROOT="$(cd .. && pwd)" GOROOT_FINAL="${GOROOT_FINAL:-$GOROOT}" DEFGOROOT='-DGOROOT_FINAL="'"$GOROOT_FINAL"'"' -gcc -O2 -Wall -Werror -o ../bin/tool/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c +gcc -O2 -Wall -Werror -ggdb -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c +eval $(./cmd/dist/dist env) echo if [ "$1" = "--dist-tool" ]; then # Stop after building dist tool. + mv cmd/dist/dist $GOTOOLDIR/dist exit 0 fi -echo '# Building compilers and Go bootstrap tool.' -../bin/tool/dist bootstrap -v # builds go_bootstrap +echo "# Building compilers and Go bootstrap tool for host, $GOHOSTOS/$GOHOSTARCH." +./cmd/dist/dist bootstrap -a -v # builds go_bootstrap +# Delay move of dist tool to now, because bootstrap cleared tool directory. +mv cmd/dist/dist $GOTOOLDIR/dist +$GOTOOLDIR/go_bootstrap clean -i std echo -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 +if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then + echo "# Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." + GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ + $GOTOOLDIR/go_bootstrap install -v std + echo +fi + +echo "# Building packages and commands for $GOOS/$GOARCH." +$GOTOOLDIR/go_bootstrap install -v std echo +rm -f $GOTOOLDIR/go_bootstrap + if [ "$1" != "--no-banner" ]; then - ../bin/tool/dist banner + $GOTOOLDIR/dist banner fi |