aboutsummaryrefslogtreecommitdiff
path: root/src/make.bash
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-02-13 22:31:51 -0500
committerRuss Cox <rsc@golang.org>2012-02-13 22:31:51 -0500
commit7b848c69647c52d69127ccef79cc7d01c0ec02c6 (patch)
treeabad1d70e9aced9f6cd2804868e80f19bba8365c /src/make.bash
parent569ef7d49e36048aeca92e387e934d5a53276949 (diff)
downloadgo-7b848c69647c52d69127ccef79cc7d01c0ec02c6.tar.xz
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 #2920. R=golang-dev, r CC=golang-dev https://golang.org/cl/5645093
Diffstat (limited to 'src/make.bash')
-rwxr-xr-xsrc/make.bash28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/make.bash b/src/make.bash
index 81ceeb7298..e30743b683 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