summaryrefslogtreecommitdiff
path: root/src/buildscript.sh
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-01-30 15:38:19 +0100
committerOndřej Surý <ondrej@sury.org>2012-01-30 15:38:19 +0100
commit4cecda6c347bd6902b960c6a35a967add7070b0d (patch)
treea462e224ff41ec9f3eb1a0b6e815806f9e8804ad /src/buildscript.sh
parent6c7ca6e4d4e26e4c8cbe0d183966011b3b088a0a (diff)
downloadgolang-4cecda6c347bd6902b960c6a35a967add7070b0d.tar.gz
Imported Upstream version 2012.01.27upstream-weekly/2012.01.27
Diffstat (limited to 'src/buildscript.sh')
-rwxr-xr-xsrc/buildscript.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/buildscript.sh b/src/buildscript.sh
new file mode 100755
index 000000000..1afdb6959
--- /dev/null
+++ b/src/buildscript.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Copyright 2011 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.
+
+. ./buildinfo.sh
+
+for sys in $GOOSARCHES
+do
+ export GOOS=$(echo $sys | sed 's/_.*//')
+ export GOARCH=$(echo $sys | sed 's/.*_//')
+ targ=buildscript/${GOOS}_$GOARCH.sh
+ rm -f $targ
+
+ (echo '#!/usr/bin/env bash
+# AUTO-GENERATED by buildscript.sh; DO NOT EDIT.
+# This script builds the go command (written in Go),
+# and then the go command can build the rest of the tree.
+
+export GOOS='$GOOS'
+export GOARCH='$GOARCH'
+export WORK=$(mktemp -d -t go-build.XXXXXX)
+trap "rm -rf $WORK" EXIT SIGINT SIGTERM
+set -e
+
+'
+ # Save script printed by go install but make shell safe
+ # by quoting variable expansions. On Windows, rewrite
+ # \ paths into / paths. This avoids the \ being interpreted
+ # as a shell escape but also makes sure that we generate the
+ # same scripts on Unix and Windows systems.
+ go install -a -n -t cmd_go_bootstrap cmd/go | sed '
+ s/\$GOBIN/"$GOBIN"/g
+ s/\$GOROOT/"$GOROOT"/g
+ s/\$WORK/"$WORK"/g
+ s;"\$GOBIN"/go;&_bootstrap;g
+ s;\\;/;g
+ '
+ )>$targ
+ chmod +x $targ
+done