]> Cypherpunks repositories - gostls13.git/commitdiff
Build changes to support work on the BSDs.
authorDevon H. O'Dell <devon.odell@gmail.com>
Sat, 14 Nov 2009 23:29:09 +0000 (15:29 -0800)
committerRuss Cox <rsc@golang.org>
Sat, 14 Nov 2009 23:29:09 +0000 (15:29 -0800)
This does still contain some FreeBSD-specific bits, but
it's a pain to do partial diffs.

R=rsc
https://golang.org/cl/152138

20 files changed:
src/Make.pkg
src/all-arm.bash
src/all-nacl.bash
src/all.bash
src/clean.bash
src/cmd/clean.bash
src/cmd/gofmt/test.sh
src/cmd/gotest/gotest
src/cmd/make.bash
src/make-arm.bash
src/make.bash
src/pkg/Makefile
src/pkg/deps.bash
src/pkg/exp/eval/test.bash
src/pkg/syscall/mkall.sh
src/pkg/syscall/mkerrors.sh
src/quietgcc.bash
src/run.bash
src/sudo.bash
test/run

index fd8e5bdb612bae70cbdb6a6e739adaea4b16230e..dc0e70f37a8468c6021773c43df1eeb205f8dd7d 100644 (file)
@@ -69,7 +69,7 @@ dir:
        @echo $(dir)
 
 %.make:
-       (cd $* && make)
+       (cd $* && gomake)
 
 # To use cgo in a Go package, add a line
 #
index 0bf9927af24412c74be8698877ba72b66d124035..e089b9cf407438bfb3451d40e4a36e6c6e1d2c70 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index 9270b5d20c5f0bf2dd46cc786f8bc29a5dca6d03..b022b4341e8998844c975501d42f7907143090de 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index 006ac5965e067a8e568eb8f59f77924fa5e84b7d..67c19cd43fd3fd9b8460cb27a96ccb4088b1ff13 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index b9012ea04d9032e7d64ae62b81e865607a78a973..411321b55dc231c4b2d59e988343a536b230953f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -13,6 +13,6 @@ do(
        if test -f clean.bash; then
                bash clean.bash
        else
-               make clean
+               gomake clean
        fi
 )done
index 3237d4c965d182e4f9ccebd2e2b9106b35855877..7a8ec107b373803f3817e12fd46d09e3e1ff0080 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -6,6 +6,6 @@
 for i in cc 6l 6a 6c 8l 8a 8c 8g 5l 5a 5c 5g gc 6g gopack nm cgo cov ebnflint godefs godoc gofmt gotest goyacc hgpatch prof
 do
        cd $i
-       make clean
+       gomake clean
        cd ..
 done
index 7f276ef5b6d4cd531da1ff0e70c5f34b26388890..08afc6536258991f345df27cc3777b5d39f62653 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index b43fe4d28364607bd3affec81da11d8b0ac84257..87bb7fafb0246dd76a879c317c7b7d627cc54053 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -94,8 +94,8 @@ fi
 
 set -e
 
-make testpackage-clean
-make testpackage "GOTESTFILES=$gofiles"
+gomake testpackage-clean
+gomake testpackage "GOTESTFILES=$gofiles"
 if $havex; then
        $GC -o $xofile $xgofiles
 fi
@@ -107,7 +107,7 @@ trap "rm -f _testmain.go _testmain.$O" 0 1 2 3 14 15
 MAKEFLAGS=
 MAKELEVEL=
 
-importpath=$(make -s importpath)
+importpath=$(gomake -s importpath)
 {
        # test functions are named TestFoo
        # the grep -v eliminates methods and other special names
index 3068096332d228cbd0ec51d624b8034d96bbc58a..db31b7b5aca3b617369ae9df668bef5021cb2ab3 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -15,13 +15,13 @@ fi
 
 cd ${O}l
 bash mkenam
-make enam.o
+gomake enam.o
 cd ..
 
 for i in cc ${O}l ${O}a ${O}c gc ${O}g gopack nm cov godefs prof gotest
 do
        echo; echo; echo %%%% making $i %%%%; echo
        cd $i
-       make install
+       gomake install
        cd ..
 done
index d47467bcb0a880b124c470b4e921d619d6437d78..239e7c6b6b89c1a429946589b7fa3b8a2a10655b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index 06c1f128cdc3dbb6343948975d2d35cac5d65680..2038fe2394932785327b7806276edd68af9ec6f9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -29,7 +29,7 @@ amd64 | 386 | arm)
 esac
 
 case "$GOOS" in
-darwin | linux | nacl)
+darwin | linux | nacl | freebsd)
        ;;
 *)
        echo '$GOOS is set to <'$GOOS'>, must be darwin, linux, or nacl' 1>&2
@@ -41,6 +41,14 @@ CC=${CC:-gcc}
 sed -e "s|@CC@|$CC|" < quietgcc.bash > $GOBIN/quietgcc
 chmod +x $GOBIN/quietgcc
 
+rm -f $GOBIN/gomake
+MAKE=make
+if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
+       MAKE=gmake
+fi
+(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >$GOBIN/gomake
+chmod +x $GOBIN/gomake
+
 if ! (cd lib9 && which quietgcc) >/dev/null 2>&1; then
        echo "installed quietgcc as $GOBIN/quietgcc but 'which quietgcc' fails" 1>&2
        echo "double-check that $GOBIN is in your "'$PATH' 1>&2
@@ -83,7 +91,7 @@ do
                                bash make.bash
                                ;;
                        *)
-                               make install
+                               gomake install
                        esac
                )  || exit 1
        esac
index 2869af2e0760023643e1ad9a898f453a28cd4816..4b251d4b854b028554ea60e5100bc2ea26908366 100644 (file)
@@ -120,16 +120,16 @@ nuke.dirs: $(addsuffix .nuke, $(DIRS))
 test.dirs: $(addsuffix .test, $(TEST))
 
 %.clean:
-       +cd $* && make clean
+       +cd $* && gomake clean
 
 %.install:
-       +cd $* && make install
+       +cd $* && gomake install
 
 %.nuke:
-       +cd $* && make nuke
+       +cd $* && gomake nuke
 
 %.test:
-       +cd $* && make test
+       +cd $* && gomake test
 
 clean: clean.dirs
 
index b0d1d7aa57670bd0616473b8c34b131af645d03f..10273e028157ebff8670ef7b9137c3c5501cb573 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index 81f4c3dd11c5523bba4bb19cc23a4193558a4eaf..dabaa280ba6ebb5c22126161e29d31fe2a95c473 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index d0383f54a83eba1367688afb38c88269a8d886fa..390392e6f82e46eabfc2daee3d5af2fb2cf86168 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -99,6 +99,10 @@ _* | *_ | _)
        echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
        exit 1
        ;;
+freebsd_amd64)
+       mksysnum="mksysnum_freebsd.sh /usr/src/sys/kern/syscalls.master"
+       mktypes="godefs -gsyscall -f-m64"
+       ;;
 darwin_386)
        mksyscall="mksyscall.sh -l32"
        mksysnum="mksysnum_darwin.sh /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master"
index 669cd85a50ff5ac67e64df04f6c00c90cb9803b3..92bc9c545388ec7f683b8bbf2ff0045de2f3452d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -38,6 +38,11 @@ includes_Darwin='
 #include <sys/event.h>
 '
 
+includes_FreeBSD='
+#include <sys/wait.h>
+#include <sys/event.h>
+'
+
 includes='
 #include <sys/types.h>
 #include <fcntl.h>
index 54e091e25b2dbc567f4540a3803125b30bcc9f14..dd3db364266f375e982332125528e3c2372edfbe 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index c13eb221896fafe0bfb3045137ef926f4da08ffa..e307ddcc1f5f3f0b95dd578ceb07b94df39f1154 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
@@ -19,10 +19,10 @@ maketest() {
        do
                (
                        xcd $i
-                       make clean
-                       time make
-                       make install
-                       make test
+                       gomake clean
+                       time gomake
+                       gomake install
+                       gomake test
                ) || exit $?
        done
 }
@@ -34,31 +34,31 @@ maketest \
 # from what maketest does.
 
 (xcd pkg/sync;
-make clean;
-time make
-GOMAXPROCS=10 make test
+gomake clean;
+time gomake
+GOMAXPROCS=10 gomake test
 ) || exit $?
 
 (xcd cmd/gofmt
-make clean
-time make
-time make smoketest
+gomake clean
+time gomake
+time gomake smoketest
 ) || exit $?
 
 (xcd cmd/ebnflint
-make clean
-time make
-time make test
+gomake clean
+time gomake
+time gomake test
 ) || exit $?
 
 (xcd ../misc/cgo/stdio
-make clean
+gomake clean
 ./test.bash
 ) || exit $?
 
 (xcd pkg/exp/ogle
-make clean
-time make ogle
+gomake clean
+time gomake ogle
 ) || exit $?
 
 (xcd ../doc/progs
index 7c7b43cb3b294497fd6584dbaccc04b4ead5b8c3..68f9905912e7aebef351ed670fc10c3d9dbce8f0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.
index 00cfede6628ab4913189dd0794f1b28f7d377db7..47f300fe6d905d206033d768ee56949935648631 100755 (executable)
--- a/test/run
+++ b/test/run
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright 2009 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.