diff options
Diffstat (limited to 'src/make.bash')
-rwxr-xr-x | src/make.bash | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/make.bash b/src/make.bash index b2de37b72..2d83b6f4d 100755 --- a/src/make.bash +++ b/src/make.bash @@ -23,9 +23,15 @@ # GO_LDFLAGS: Additional 5l/6l/8l arguments to use when # building the commands. # +# GO_CCFLAGS: Additional 5c/6c/8c arguments to use when +# building. +# # CGO_ENABLED: Controls cgo usage during the build. Set it to 1 # to include all cgo related files, .c and .go file with "cgo" # build directive, in the build. Set it to 0 to ignore them. +# +# CC: Command line to run to get at host C compiler. +# Default is "gcc". Also supported: "clang". set -e if [ ! -f run.bash ]; then @@ -77,6 +83,13 @@ do fi done +# Test for debian/kFreeBSD. +# cmd/dist will detect kFreeBSD as freebsd/$GOARCH, but we need to +# disable cgo manually. +if [ "$(uname -s)" == "GNU/kFreeBSD" ]; then + export CGO_ENABLED=0 +fi + # Clean old generated file that will cause problems in the build. rm -f ./pkg/runtime/runtime_defs.go @@ -93,7 +106,7 @@ case "$GOHOSTARCH" in 386) mflag=-m32;; amd64) mflag=-m64;; esac -gcc $mflag -O2 -Wall -Werror -ggdb -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c +${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c eval $(./cmd/dist/dist env -p) echo @@ -122,12 +135,12 @@ echo if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then echo "# Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ - "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std + "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std echo fi echo "# Building packages and commands for $GOOS/$GOARCH." -"$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std +"$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std echo rm -f "$GOTOOLDIR"/go_bootstrap |