]> Cypherpunks repositories - gostls13.git/commitdiff
build: do not build all C compilers
authorShenghou Ma <minux.ma@gmail.com>
Tue, 24 Jan 2012 20:03:41 +0000 (15:03 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 24 Jan 2012 20:03:41 +0000 (15:03 -0500)
        In order to allow buildscript.sh to generate buildscripts for all
        $GOOS/$GOARCH combinations, we have to generate dummy files for cmd/go.
        Fixes #2586.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5557050

src/cmd/Makefile
src/pkg/runtime/mkasmh.sh
src/pkg/runtime/mkgodefs.sh

index c2f817a916a9b9f58665434dd26cc4341644e0ff..40d2778420bb42a3508309bc53261512dbf7fc2d 100644 (file)
@@ -8,12 +8,9 @@ all: install
 
 # Only build tools for current architecture, and only tools written in C.
 # The tools written in Go are managed by ../pkg/Makefile.
-# We need all the C compilers for rebuilding generated files in runtime.
 DIRS=\
        $(O)a\
-       5c\
-       6c\
-       8c\
+       $(O)c\
        $(O)g\
        $(O)l\
        cc\
index ba48d0a137a2940d04c3681392120d610092bc37..26a1263bede0830e734467b7305f8ead009218da 100755 (executable)
@@ -29,6 +29,10 @@ cat <<'EOF'
 // AUTO-GENERATED by autogen.sh; DO NOT EDIT
 
 EOF
+if [ ! -x "${GOBIN:=$GOROOT/bin}/$CC" ]; then
+       echo "// dummy file for cmd/go to correctly generate buildscript"
+       exit
+fi
 
 case "$GOARCH" in
 386)
@@ -110,7 +114,7 @@ arm)
 esac
 echo
 
-$CC $CFLAGS -a proc.c |
+$GOBIN/$CC $CFLAGS -a proc.c |
 awk '
 { gsub(/\r/, ""); }
 /^aggr G$/ { aggr="g" }
index 1f9feac4e127241d0d2b626786c0984dee7f92ce..b7cd229b78c31b80c07f1da3773ec79c0d73766b 100755 (executable)
@@ -27,7 +27,14 @@ cp signals_$GOOS.h signals_GOOS.h
 cat <<EOF
 // Go definitions for C variables and types.
 // AUTO-GENERATED by autogen.sh; DO NOT EDIT
+EOF
+if [ ! -x "${GOBIN:=$GOROOT/bin}/$CC" ]; then
+       echo "// dummy file for cmd/go to correctly generate buildscript"
+       echo "package runtime"
+       exit
+fi
 
+cat <<EOF
 package runtime
 import "unsafe"
 var _ unsafe.Pointer
@@ -35,7 +42,7 @@ var _ unsafe.Pointer
 EOF
 
 for i in "$@"; do
-       $CC $CFLAGS -q $i
+       $GOBIN/$CC $CFLAGS -q $i
 done | awk '
 /^func/ { next }
 /^const/ { next }