1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:00:09 -07:00

Build changes to support work on the BSDs.

This does still contain some FreeBSD-specific bits, but
it's a pain to do partial diffs.

R=rsc
https://golang.org/cl/152138
This commit is contained in:
Devon H. O'Dell 2009-11-14 15:29:09 -08:00 committed by Russ Cox
parent 96bcdff662
commit 553be8427e
20 changed files with 65 additions and 48 deletions

View File

@ -69,7 +69,7 @@ dir:
@echo $(dir) @echo $(dir)
%.make: %.make:
(cd $* && make) (cd $* && gomake)
# To use cgo in a Go package, add a line # To use cgo in a Go package, add a line
# #

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
@ -13,6 +13,6 @@ do(
if test -f clean.bash; then if test -f clean.bash; then
bash clean.bash bash clean.bash
else else
make clean gomake clean
fi fi
)done )done

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # 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 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 do
cd $i cd $i
make clean gomake clean
cd .. cd ..
done done

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
@ -94,8 +94,8 @@ fi
set -e set -e
make testpackage-clean gomake testpackage-clean
make testpackage "GOTESTFILES=$gofiles" gomake testpackage "GOTESTFILES=$gofiles"
if $havex; then if $havex; then
$GC -o $xofile $xgofiles $GC -o $xofile $xgofiles
fi fi
@ -107,7 +107,7 @@ trap "rm -f _testmain.go _testmain.$O" 0 1 2 3 14 15
MAKEFLAGS= MAKEFLAGS=
MAKELEVEL= MAKELEVEL=
importpath=$(make -s importpath) importpath=$(gomake -s importpath)
{ {
# test functions are named TestFoo # test functions are named TestFoo
# the grep -v eliminates methods and other special names # the grep -v eliminates methods and other special names

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
@ -15,13 +15,13 @@ fi
cd ${O}l cd ${O}l
bash mkenam bash mkenam
make enam.o gomake enam.o
cd .. cd ..
for i in cc ${O}l ${O}a ${O}c gc ${O}g gopack nm cov godefs prof gotest for i in cc ${O}l ${O}a ${O}c gc ${O}g gopack nm cov godefs prof gotest
do do
echo; echo; echo %%%% making $i %%%%; echo echo; echo; echo %%%% making $i %%%%; echo
cd $i cd $i
make install gomake install
cd .. cd ..
done done

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
@ -29,7 +29,7 @@ amd64 | 386 | arm)
esac esac
case "$GOOS" in case "$GOOS" in
darwin | linux | nacl) darwin | linux | nacl | freebsd)
;; ;;
*) *)
echo '$GOOS is set to <'$GOOS'>, must be darwin, linux, or nacl' 1>&2 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 sed -e "s|@CC@|$CC|" < quietgcc.bash > $GOBIN/quietgcc
chmod +x $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 if ! (cd lib9 && which quietgcc) >/dev/null 2>&1; then
echo "installed quietgcc as $GOBIN/quietgcc but 'which quietgcc' fails" 1>&2 echo "installed quietgcc as $GOBIN/quietgcc but 'which quietgcc' fails" 1>&2
echo "double-check that $GOBIN is in your "'$PATH' 1>&2 echo "double-check that $GOBIN is in your "'$PATH' 1>&2
@ -83,7 +91,7 @@ do
bash make.bash bash make.bash
;; ;;
*) *)
make install gomake install
esac esac
) || exit 1 ) || exit 1
esac esac

View File

@ -120,16 +120,16 @@ nuke.dirs: $(addsuffix .nuke, $(DIRS))
test.dirs: $(addsuffix .test, $(TEST)) test.dirs: $(addsuffix .test, $(TEST))
%.clean: %.clean:
+cd $* && make clean +cd $* && gomake clean
%.install: %.install:
+cd $* && make install +cd $* && gomake install
%.nuke: %.nuke:
+cd $* && make nuke +cd $* && gomake nuke
%.test: %.test:
+cd $* && make test +cd $* && gomake test
clean: clean.dirs clean: clean.dirs

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
@ -99,6 +99,10 @@ _* | *_ | _)
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2 echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
exit 1 exit 1
;; ;;
freebsd_amd64)
mksysnum="mksysnum_freebsd.sh /usr/src/sys/kern/syscalls.master"
mktypes="godefs -gsyscall -f-m64"
;;
darwin_386) darwin_386)
mksyscall="mksyscall.sh -l32" mksyscall="mksyscall.sh -l32"
mksysnum="mksysnum_darwin.sh /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master" mksysnum="mksysnum_darwin.sh /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
@ -38,6 +38,11 @@ includes_Darwin='
#include <sys/event.h> #include <sys/event.h>
' '
includes_FreeBSD='
#include <sys/wait.h>
#include <sys/event.h>
'
includes=' includes='
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
@ -19,10 +19,10 @@ maketest() {
do do
( (
xcd $i xcd $i
make clean gomake clean
time make time gomake
make install gomake install
make test gomake test
) || exit $? ) || exit $?
done done
} }
@ -34,31 +34,31 @@ maketest \
# from what maketest does. # from what maketest does.
(xcd pkg/sync; (xcd pkg/sync;
make clean; gomake clean;
time make time gomake
GOMAXPROCS=10 make test GOMAXPROCS=10 gomake test
) || exit $? ) || exit $?
(xcd cmd/gofmt (xcd cmd/gofmt
make clean gomake clean
time make time gomake
time make smoketest time gomake smoketest
) || exit $? ) || exit $?
(xcd cmd/ebnflint (xcd cmd/ebnflint
make clean gomake clean
time make time gomake
time make test time gomake test
) || exit $? ) || exit $?
(xcd ../misc/cgo/stdio (xcd ../misc/cgo/stdio
make clean gomake clean
./test.bash ./test.bash
) || exit $? ) || exit $?
(xcd pkg/exp/ogle (xcd pkg/exp/ogle
make clean gomake clean
time make ogle time gomake ogle
) || exit $? ) || exit $?
(xcd ../doc/progs (xcd ../doc/progs

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright 2009 The Go Authors. All rights reserved. # Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.