Commit 7e19e533 authored by Gustavo Niemeyer's avatar Gustavo Niemeyer

build: add GO_ prefix to LDFLAGS and GCFLAGS

Build environments will often define stock LDFLAGS
that are not compatible with the gc ld, causing
non-obvious failures midway through the build.

R=golang-dev, rsc, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5724044
parent d1bd332a
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
# #
# GOOS: The target operating system for installed packages and tools. # GOOS: The target operating system for installed packages and tools.
# #
# GCFLAGS: Additional 5g/6g/8g arguments to use when # GO_GCFLAGS: Additional 5g/6g/8g arguments to use when
# building the packages and commands. # building the packages and commands.
# #
# LDFLAGS: Additional 5l/6l/8l arguments to use when # GO_LDFLAGS: Additional 5l/6l/8l arguments to use when
# building the packages and commands. # building the packages and commands.
# #
# CGO_ENABLED: Setting this to 0 disables the use of cgo # CGO_ENABLED: Setting this to 0 disables the use of cgo
...@@ -89,11 +89,11 @@ echo ...@@ -89,11 +89,11 @@ echo
if [ "$1" = "--dist-tool" ]; then if [ "$1" = "--dist-tool" ]; then
# Stop after building dist tool. # Stop after building dist tool.
mkdir -p $GOTOOLDIR mkdir -p "$GOTOOLDIR"
if [ "$2" != "" ]; then if [ "$2" != "" ]; then
cp cmd/dist/dist "$2" cp cmd/dist/dist "$2"
fi fi
mv cmd/dist/dist $GOTOOLDIR/dist mv cmd/dist/dist "$GOTOOLDIR"/dist
exit 0 exit 0
fi fi
...@@ -104,23 +104,23 @@ if [ "$1" = "--no-clean" ]; then ...@@ -104,23 +104,23 @@ if [ "$1" = "--no-clean" ]; then
fi fi
./cmd/dist/dist bootstrap $buildall -v # builds go_bootstrap ./cmd/dist/dist bootstrap $buildall -v # builds go_bootstrap
# Delay move of dist tool to now, because bootstrap may clear tool directory. # Delay move of dist tool to now, because bootstrap may clear tool directory.
mv cmd/dist/dist $GOTOOLDIR/dist mv cmd/dist/dist "$GOTOOLDIR"/dist
$GOTOOLDIR/go_bootstrap clean -i std "$GOTOOLDIR"/go_bootstrap clean -i std
echo echo
if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
echo "# Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." echo "# Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
$GOTOOLDIR/go_bootstrap install -gcflags "$GCFLAGS" -ldflags "$LDFLAGS" -v std "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std
echo echo
fi fi
echo "# Building packages and commands for $GOOS/$GOARCH." echo "# Building packages and commands for $GOOS/$GOARCH."
$GOTOOLDIR/go_bootstrap install -gcflags "$GCFLAGS" -ldflags "$LDFLAGS" -v std "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std
echo echo
rm -f $GOTOOLDIR/go_bootstrap rm -f "$GOTOOLDIR"/go_bootstrap
if [ "$1" != "--no-banner" ]; then if [ "$1" != "--no-banner" ]; then
$GOTOOLDIR/dist banner "$GOTOOLDIR"/dist banner
fi fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment