mirror of
https://github.com/golang/go
synced 2024-11-21 22:04:39 -07:00
Remove GOBIN in PATH dependency; don't assume cwd is $GOROOT/src
This change removes the necessity to have GOBIN in $PATH, and also doesn't assume that the build is being run from $GOROOT/src. This is a minimal set of necessary changes to get Go to build happily from the FreeBSD ports collection. R=rsc CC=golang-dev https://golang.org/cl/171044
This commit is contained in:
parent
0714fbb6ae
commit
857d4cf1a9
@ -82,10 +82,9 @@ plus one optional variable:</p>
|
|||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
The location where binaries will be installed.
|
The location where binaries will be installed.
|
||||||
If you set <code>$GOBIN</code>, you need to ensure that it
|
The default is <code>$HOME/bin</code>.
|
||||||
is in your <code>$PATH</code> so that newly built Go-specific
|
After installing, you will want to arrange to add this
|
||||||
command such as the compiler can be found during the build.
|
directory to your <code>$PATH</code>, so you can use the tools.
|
||||||
The default, <code>$HOME/bin</code>, may already be in your <code>$PATH</code>.
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@ -204,9 +203,7 @@ $ sudo apt-get install bison gcc libc6-dev ed make
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To build the Go distribution, make sure <code>$GOBIN</code>
|
To build the Go distribution, run
|
||||||
(or <code>$HOME/bin</code> if <code>$GOBIN</code> is not set)
|
|
||||||
is in your <code>$PATH</code> and then run
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
. "$GOROOT"/src/Make.$GOARCH
|
. "$GOROOT"/src/Make.$GOARCH
|
||||||
|
|
||||||
if [ -z "$O" ]; then
|
if [ -z "$O" ]; then
|
||||||
@ -30,11 +32,11 @@ for i in \
|
|||||||
; do
|
; do
|
||||||
BASE=$(basename $i .go)
|
BASE=$(basename $i .go)
|
||||||
|
|
||||||
$GC $i
|
"$GOBIN"/$GC $i
|
||||||
done
|
done
|
||||||
|
|
||||||
function testit {
|
function testit {
|
||||||
$LD $1.$O
|
"$GOBIN"/$LD $1.$O
|
||||||
x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes
|
x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes
|
||||||
if [ "$x" != "$3" ]
|
if [ "$x" != "$3" ]
|
||||||
then
|
then
|
||||||
@ -43,7 +45,7 @@ function testit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testitpipe {
|
function testitpipe {
|
||||||
$LD $1.$O
|
"$GOBIN"/$LD $1.$O
|
||||||
x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes
|
x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes
|
||||||
if [ "$x" != "$3" ]
|
if [ "$x" != "$3" ]
|
||||||
then
|
then
|
||||||
@ -72,7 +74,7 @@ testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29"
|
|||||||
testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29"
|
testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29"
|
||||||
|
|
||||||
# server hangs; don't run it, just compile it
|
# server hangs; don't run it, just compile it
|
||||||
$GC server.go
|
"$GOBIN"/$GC server.go
|
||||||
testit server1 "" ""
|
testit server1 "" ""
|
||||||
|
|
||||||
rm -f $O.out *.$O
|
rm -f $O.out *.$O
|
||||||
|
@ -13,5 +13,5 @@ CLEANFILES+=hello fib chain run.out
|
|||||||
include ../../../src/Make.pkg
|
include ../../../src/Make.pkg
|
||||||
|
|
||||||
%: install %.go
|
%: install %.go
|
||||||
$(GC) $*.go
|
$(QUOTED_GOBIN)/$(GC) $*.go
|
||||||
$(LD) -o $@ $*.$O
|
$(QUOTED_GOBIN)/$(LD) -o $@ $*.$O
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
gomake hello fib chain
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
"$GOBIN"/gomake hello fib chain
|
||||||
echo '*' hello >run.out
|
echo '*' hello >run.out
|
||||||
./hello >>run.out
|
./hello >>run.out
|
||||||
echo '*' fib >>run.out
|
echo '*' fib >>run.out
|
||||||
@ -12,4 +13,4 @@ echo '*' fib >>run.out
|
|||||||
echo '*' chain >>run.out
|
echo '*' chain >>run.out
|
||||||
./chain >>run.out
|
./chain >>run.out
|
||||||
diff run.out golden.out
|
diff run.out golden.out
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
|
@ -15,10 +15,10 @@ QUOTED_GOBIN=$(subst $(space),\ ,$(GOBIN))
|
|||||||
all: $(TARG)
|
all: $(TARG)
|
||||||
|
|
||||||
$(TARG): _go_.$O $(OFILES)
|
$(TARG): _go_.$O $(OFILES)
|
||||||
$(LD) -o $@ _go_.$O $(OFILES)
|
$(QUOTED_GOBIN)/$(LD) -o $@ _go_.$O $(OFILES)
|
||||||
|
|
||||||
_go_.$O: $(GOFILES)
|
_go_.$O: $(GOFILES)
|
||||||
$(GC) -o $@ $(GOFILES)
|
$(QUOTED_GOBIN)/$(GC) -o $@ $(GOFILES)
|
||||||
|
|
||||||
install: $(QUOTED_GOBIN)/$(TARG)
|
install: $(QUOTED_GOBIN)/$(TARG)
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
CC=quietgcc
|
|
||||||
LD=quietgcc
|
|
||||||
CFLAGS=-ggdb -I"$(GOROOT)"/include -O2 -fno-inline
|
CFLAGS=-ggdb -I"$(GOROOT)"/include -O2 -fno-inline
|
||||||
O=o
|
O=o
|
||||||
YFLAGS=-d
|
YFLAGS=-d
|
||||||
@ -13,7 +11,15 @@ nullstring :=
|
|||||||
space := $(nullstring) # a space at the end
|
space := $(nullstring) # a space at the end
|
||||||
QUOTED_HOME=$(subst $(space),\ ,$(HOME))
|
QUOTED_HOME=$(subst $(space),\ ,$(HOME))
|
||||||
GOBIN=$(QUOTED_HOME)/bin
|
GOBIN=$(QUOTED_HOME)/bin
|
||||||
|
QUOTED_GOBIN=$(subst $(space),\ ,$(GOBIN))
|
||||||
|
else
|
||||||
|
nullstring :=
|
||||||
|
space := $(nullstring) # a space at the end
|
||||||
|
QUOTED_GOBIN=$(subst $(space),\ ,$(GOBIN))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CC=$(QUOTED_GOBIN)/quietgcc
|
||||||
|
LD=$(QUOTED_GOBIN)/quietgcc
|
||||||
PWD=$(shell pwd)
|
PWD=$(shell pwd)
|
||||||
|
|
||||||
%.$O: %.c
|
%.$O: %.c
|
||||||
|
36
src/Make.pkg
36
src/Make.pkg
@ -6,6 +6,18 @@ all: package
|
|||||||
package: _obj/$(TARG).a
|
package: _obj/$(TARG).a
|
||||||
testpackage: _test/$(TARG).a
|
testpackage: _test/$(TARG).a
|
||||||
|
|
||||||
|
ifndef GOBIN
|
||||||
|
nullstring :=
|
||||||
|
space := $(nullstring) # a space at the end
|
||||||
|
QUOTED_HOME=$(subst $(space),\ ,$(HOME))
|
||||||
|
GOBIN=$(QUOTED_HOME)/bin
|
||||||
|
QUOTED_GOBIN=$(subst $(space),\ ,$(GOBIN))
|
||||||
|
else
|
||||||
|
nullstring :=
|
||||||
|
space := $(nullstring) # a space at the end
|
||||||
|
QUOTED_GOBIN=$(subst $(space),\ ,$(GOBIN))
|
||||||
|
endif
|
||||||
|
|
||||||
# GNU Make 3.80 has a bug in lastword
|
# GNU Make 3.80 has a bug in lastword
|
||||||
# elem=$(lastword $(subst /, ,$(TARG)))
|
# elem=$(lastword $(subst /, ,$(TARG)))
|
||||||
TARG_words=$(subst /, ,$(TARG))
|
TARG_words=$(subst /, ,$(TARG))
|
||||||
@ -31,14 +43,14 @@ INSTALLFILES+=$(patsubst %.go,$(pkgdir)/$(dir)/$(elem)_%.so,$(CGOFILES))
|
|||||||
PREREQ+=$(patsubst %,%.make,$(DEPS))
|
PREREQ+=$(patsubst %,%.make,$(DEPS))
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
gotest
|
$(QUOTED_GOBIN)/gotest
|
||||||
6cov -g $(shell pwd) $O.out | grep -v '_test\.go:'
|
$(QUOTED_GOBIN)/6cov -g $(shell pwd) $O.out | grep -v '_test\.go:'
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.[$(OS)o] *.a [$(OS)].out *.cgo[12].go *.cgo[34].c *.so _obj _test _testmain.go $(CLEANFILES)
|
rm -rf *.[$(OS)o] *.a [$(OS)].out *.cgo[12].go *.cgo[34].c *.so _obj _test _testmain.go $(CLEANFILES)
|
||||||
|
|
||||||
test:
|
test:
|
||||||
gotest
|
$(QUOTED_GOBIN)/gotest
|
||||||
|
|
||||||
nuke: clean
|
nuke: clean
|
||||||
rm -f $(pkgdir)/$(TARG).a
|
rm -f $(pkgdir)/$(TARG).a
|
||||||
@ -53,20 +65,20 @@ $(pkgdir)/$(TARG).a: package
|
|||||||
cp _obj/$(TARG).a "$@"
|
cp _obj/$(TARG).a "$@"
|
||||||
|
|
||||||
_go_.$O: $(GOFILES) $(PREREQ)
|
_go_.$O: $(GOFILES) $(PREREQ)
|
||||||
$(GC) -o $@ $(GOFILES)
|
$(QUOTED_GOBIN)/$(GC) -o $@ $(GOFILES)
|
||||||
|
|
||||||
_gotest_.$O: $(GOFILES) $(GOTESTFILES) $(PREREQ)
|
_gotest_.$O: $(GOFILES) $(GOTESTFILES) $(PREREQ)
|
||||||
$(GC) -o $@ $(GOFILES) $(GOTESTFILES)
|
$(QUOTED_GOBIN)/$(GC) -o $@ $(GOFILES) $(GOTESTFILES)
|
||||||
|
|
||||||
_obj/$(TARG).a: _go_.$O $(OFILES)
|
_obj/$(TARG).a: _go_.$O $(OFILES)
|
||||||
@mkdir -p _obj/$(dir)
|
@mkdir -p _obj/$(dir)
|
||||||
rm -f _obj/$(TARG).a
|
rm -f _obj/$(TARG).a
|
||||||
gopack grc $@ _go_.$O $(OFILES)
|
$(QUOTED_GOBIN)/gopack grc $@ _go_.$O $(OFILES)
|
||||||
|
|
||||||
_test/$(TARG).a: _gotest_.$O $(OFILES)
|
_test/$(TARG).a: _gotest_.$O $(OFILES)
|
||||||
@mkdir -p _test/$(dir)
|
@mkdir -p _test/$(dir)
|
||||||
rm -f _test/$(TARG).a
|
rm -f _test/$(TARG).a
|
||||||
gopack grc $@ _gotest_.$O $(OFILES)
|
$(QUOTED_GOBIN)/gopack grc $@ _gotest_.$O $(OFILES)
|
||||||
|
|
||||||
importpath:
|
importpath:
|
||||||
@echo $(TARG)
|
@echo $(TARG)
|
||||||
@ -75,7 +87,7 @@ dir:
|
|||||||
@echo $(dir)
|
@echo $(dir)
|
||||||
|
|
||||||
%.make:
|
%.make:
|
||||||
(cd $* && gomake)
|
(cd $* && $(QUOTED_GOBIN)/gomake)
|
||||||
|
|
||||||
# To use cgo in a Go package, add a line
|
# To use cgo in a Go package, add a line
|
||||||
#
|
#
|
||||||
@ -94,7 +106,7 @@ dir:
|
|||||||
# x.cgo4.c - C implementations compiled with gcc to create dynamic library
|
# x.cgo4.c - C implementations compiled with gcc to create dynamic library
|
||||||
#
|
#
|
||||||
%.cgo1.go %.cgo2.go %.cgo3.c %.cgo4.c: %.go
|
%.cgo1.go %.cgo2.go %.cgo3.c %.cgo4.c: %.go
|
||||||
CGOPKGPATH=$(dir) cgo $(CGO_CFLAGS) $*.go
|
CGOPKGPATH=$(dir) $(QUOTED_GOBIN)/cgo $(CGO_CFLAGS) $*.go
|
||||||
|
|
||||||
# The rules above added x.cgo1.go and x.cgo2.go to $(GOFILES),
|
# The rules above added x.cgo1.go and x.cgo2.go to $(GOFILES),
|
||||||
# added x.cgo3.$O to $OFILES, and added the installed copy of
|
# added x.cgo3.$O to $OFILES, and added the installed copy of
|
||||||
@ -104,7 +116,7 @@ dir:
|
|||||||
RUNTIME_CFLAGS_amd64=-D_64BIT
|
RUNTIME_CFLAGS_amd64=-D_64BIT
|
||||||
RUNTIME_CFLAGS=-I"$(GOROOT)/src/pkg/runtime" $(RUNTIME_CFLAGS_$(GOARCH))
|
RUNTIME_CFLAGS=-I"$(GOROOT)/src/pkg/runtime" $(RUNTIME_CFLAGS_$(GOARCH))
|
||||||
%.cgo3.$O: %.cgo3.c
|
%.cgo3.$O: %.cgo3.c
|
||||||
$(CC) $(CFLAGS) $(RUNTIME_CFLAGS) $*.cgo3.c
|
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $(RUNTIME_CFLAGS) $*.cgo3.c
|
||||||
|
|
||||||
# Have to run gcc with the right size argument on hybrid 32/64 machines.
|
# Have to run gcc with the right size argument on hybrid 32/64 machines.
|
||||||
_CGO_CFLAGS_386=-m32
|
_CGO_CFLAGS_386=-m32
|
||||||
@ -129,10 +141,10 @@ $(pkgdir)/$(dir)/$(elem)_%.so: $(elem)_%.so
|
|||||||
# These come last so that the rules above can override them
|
# These come last so that the rules above can override them
|
||||||
# for more specific file names.
|
# for more specific file names.
|
||||||
%.$O: %.c
|
%.$O: %.c
|
||||||
$(CC) $(CFLAGS) $*.c
|
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $*.c
|
||||||
|
|
||||||
%.$O: %.s
|
%.$O: %.s
|
||||||
$(AS) $*.s
|
$(QUOTED_GOBIN)/$(AS) $*.s
|
||||||
|
|
||||||
%.$O: $(HFILES)
|
%.$O: $(HFILES)
|
||||||
|
|
||||||
|
11
src/Makefile
11
src/Makefile
@ -1,11 +1,16 @@
|
|||||||
|
# GNU Make syntax:
|
||||||
|
nullstring :=
|
||||||
|
space := $(nullstring) # a space at the end
|
||||||
|
QUOTED_GOROOT=$(subst $(space),\ ,$(GOROOT))
|
||||||
|
|
||||||
all: build run
|
all: build run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
bash $(GOROOT)/src/make.bash
|
bash $(QUOTED_GOROOT)/src/make.bash
|
||||||
|
|
||||||
run:
|
run:
|
||||||
bash $(GOROOT)/src/run.bash
|
bash $(QUOTED_GOROOT)/src/run.bash
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
bash $(GOROOT)/src/clean.bash
|
bash $(QUOTED_GOROOT)/src/clean.bash
|
||||||
|
|
||||||
|
@ -3,16 +3,18 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
rm -rf "$GOROOT"/pkg/${GOOS}_$GOARCH
|
rm -rf "$GOROOT"/pkg/${GOOS}_$GOARCH
|
||||||
rm -f "$GOROOT"/lib/*.a
|
rm -f "$GOROOT"/lib/*.a
|
||||||
for i in lib9 libbio libcgo libmach cmd pkg \
|
for i in lib9 libbio libcgo libmach cmd pkg \
|
||||||
../misc/cgo/gmp ../misc/cgo/stdio \
|
../misc/cgo/gmp ../misc/cgo/stdio \
|
||||||
../test/bench
|
../test/bench
|
||||||
do(
|
do(
|
||||||
cd $i || exit 1
|
cd "$GOROOT"/src/$i || exit 1
|
||||||
if test -f clean.bash; then
|
if test -f clean.bash; then
|
||||||
bash clean.bash
|
bash clean.bash
|
||||||
else
|
else
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
fi
|
fi
|
||||||
)done
|
)done
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
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
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
@ -11,5 +11,5 @@ GOFILES=\
|
|||||||
include ../../Make.cmd
|
include ../../Make.cmd
|
||||||
|
|
||||||
test: $(TARG)
|
test: $(TARG)
|
||||||
$(TARG) -start="SourceFile" "$(GOROOT)"/doc/go_spec.html
|
$(QUOTED_GOBIN)/$(TARG) -start="SourceFile" "$(GOROOT)"/doc/go_spec.html
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
. "$GOROOT"/src/Make.$GOARCH
|
. "$GOROOT"/src/Make.$GOARCH
|
||||||
if [ -z "$GC" ]; then
|
if [ -z "$GC" ]; then
|
||||||
echo 'missing $GC - maybe no Make.$GOARCH?' 1>&2
|
echo 'missing $GC - maybe no Make.$GOARCH?' 1>&2
|
||||||
@ -15,7 +17,7 @@ gcc -o mkbuiltin1 mkbuiltin1.c
|
|||||||
rm -f _builtin.c
|
rm -f _builtin.c
|
||||||
for i in runtime unsafe
|
for i in runtime unsafe
|
||||||
do
|
do
|
||||||
$GC -A $i.go
|
"$GOBIN"/$GC -A $i.go
|
||||||
O=$O ./mkbuiltin1 $i >>_builtin.c
|
O=$O ./mkbuiltin1 $i >>_builtin.c
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ unset LANG
|
|||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LC_CTYPE=C
|
export LC_CTYPE=C
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
_GC=$GC # Make.$GOARCH will overwrite this
|
_GC=$GC # Make.$GOARCH will overwrite this
|
||||||
|
|
||||||
if [ ! -f [Mm]akefile ]; then
|
if [ ! -f [Mm]akefile ]; then
|
||||||
@ -94,10 +96,10 @@ fi
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
gomake testpackage-clean
|
"$GOBIN"/gomake testpackage-clean
|
||||||
gomake testpackage "GOTESTFILES=$gofiles"
|
"$GOBIN"/gomake testpackage "GOTESTFILES=$gofiles"
|
||||||
if $havex; then
|
if $havex; then
|
||||||
$GC -o $xofile $xgofiles
|
"$GOBIN"/$GC -o $xofile $xgofiles
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# They all compile; now generate the code to call them.
|
# They all compile; now generate the code to call them.
|
||||||
@ -107,20 +109,20 @@ trap "rm -f _testmain.go _testmain.$O" 0 1 2 3 14 15
|
|||||||
MAKEFLAGS=
|
MAKEFLAGS=
|
||||||
MAKELEVEL=
|
MAKELEVEL=
|
||||||
|
|
||||||
importpath=$(gomake -s importpath)
|
importpath=$("$GOBIN"/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
|
||||||
# that have multiple dots.
|
# that have multiple dots.
|
||||||
pattern='Test([^a-z].*)?'
|
pattern='Test([^a-z].*)?'
|
||||||
tests=$(6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
|
tests=$("$GOBIN"/6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
|
||||||
if [ "x$tests" = x ]; then
|
if [ "x$tests" = x ]; then
|
||||||
echo 'gotest: error: no tests matching '$pattern in _test/$importpath.a $xofile 1>&2
|
echo 'gotest: error: no tests matching '$pattern in _test/$importpath.a $xofile 1>&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
# benchmarks are named BenchmarkFoo.
|
# benchmarks are named BenchmarkFoo.
|
||||||
pattern='Benchmark([^a-z].*)?'
|
pattern='Benchmark([^a-z].*)?'
|
||||||
benchmarks=$(6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
|
benchmarks=$("$GOBIN"/6nm -s _test/$importpath.a $xofile | egrep ' T .*·'$pattern'$' | grep -v '·.*[.·]' | sed 's/.* //; s/·/./')
|
||||||
|
|
||||||
# package spec
|
# package spec
|
||||||
echo 'package main'
|
echo 'package main'
|
||||||
@ -159,6 +161,6 @@ importpath=$(gomake -s importpath)
|
|||||||
echo '}'
|
echo '}'
|
||||||
}>_testmain.go
|
}>_testmain.go
|
||||||
|
|
||||||
$GC _testmain.go
|
"$GOBIN"/$GC _testmain.go
|
||||||
$GL _testmain.$O
|
"$GOBIN"/$GL _testmain.$O
|
||||||
$E ./$O.out "$@"
|
$E ./$O.out "$@"
|
||||||
|
@ -7,6 +7,8 @@ set -e
|
|||||||
|
|
||||||
bash clean.bash
|
bash clean.bash
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
. "$GOROOT"/src/Make.$GOARCH
|
. "$GOROOT"/src/Make.$GOARCH
|
||||||
if [ -z "$O" ]; then
|
if [ -z "$O" ]; then
|
||||||
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
|
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
|
||||||
@ -15,13 +17,13 @@ fi
|
|||||||
|
|
||||||
cd ${O}l
|
cd ${O}l
|
||||||
bash mkenam
|
bash mkenam
|
||||||
gomake enam.o
|
"$GOBIN"/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
|
||||||
gomake install
|
"$GOBIN"/gomake install
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
@ -4,6 +4,21 @@
|
|||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
if test -z "$GOBIN"; then
|
||||||
|
if ! test -d "$HOME"/bin; then
|
||||||
|
echo '$GOBIN is not set and $HOME/bin is not a directory or does not exist.' 1>&2
|
||||||
|
echo 'mkdir $HOME/bin or set $GOBIN to a directory where binaries should' 1>&2
|
||||||
|
echo 'be installed.' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
GOBIN="$HOME/bin"
|
||||||
|
elif ! test -d "$GOBIN"; then
|
||||||
|
echo '$GOBIN is not a directory or does not exist' 1>&2
|
||||||
|
echo 'create it or set $GOBIN differently' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
GOBIN="${GOBIN:-$HOME/bin}"
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
export MAKEFLAGS=-j4
|
export MAKEFLAGS=-j4
|
||||||
|
|
||||||
@ -13,13 +28,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -d $GOBIN
|
|
||||||
then
|
|
||||||
echo '$GOBIN is not a directory or does not exist' 1>&2
|
|
||||||
echo 'create it or set $GOBIN differently' 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$GOARCH" in
|
case "$GOARCH" in
|
||||||
arm)
|
arm)
|
||||||
;;
|
;;
|
||||||
@ -38,17 +46,17 @@ esac
|
|||||||
|
|
||||||
bash clean.bash
|
bash clean.bash
|
||||||
|
|
||||||
rm -f $GOBIN/quietgcc
|
rm -f "$GOBIN"/quietgcc
|
||||||
cp quietgcc.bash $GOBIN/quietgcc
|
cp quietgcc.bash "$GOBIN"/quietgcc
|
||||||
chmod +x $GOBIN/quietgcc
|
chmod +x "$GOBIN"/quietgcc
|
||||||
|
|
||||||
rm -f $GOBIN/gomake
|
rm -f "$GOBIN"/gomake
|
||||||
MAKE=make
|
MAKE=make
|
||||||
if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
|
if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
|
||||||
MAKE=gmake
|
MAKE=gmake
|
||||||
fi
|
fi
|
||||||
(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >$GOBIN/gomake
|
(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >"$GOBIN"/gomake
|
||||||
chmod +x $GOBIN/gomake
|
chmod +x "$GOBIN"/gomake
|
||||||
|
|
||||||
bash clean.bash
|
bash clean.bash
|
||||||
|
|
||||||
|
@ -4,6 +4,21 @@
|
|||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
if test -z "$GOBIN"; then
|
||||||
|
if ! test -d "$HOME"/bin; then
|
||||||
|
echo '$GOBIN is not set and $HOME/bin is not a directory or does not exist.' 1>&2
|
||||||
|
echo 'mkdir $HOME/bin or set $GOBIN to a directory where binaries should' 1>&2
|
||||||
|
echo 'be installed.' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
GOBIN="$HOME/bin"
|
||||||
|
elif ! test -d "$GOBIN"; then
|
||||||
|
echo '$GOBIN is not a directory or does not exist' 1>&2
|
||||||
|
echo 'create it or set $GOBIN differently' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
GOBIN="${GOBIN:-$HOME/bin}"
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
export MAKEFLAGS=-j4
|
export MAKEFLAGS=-j4
|
||||||
|
|
||||||
@ -15,13 +30,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -d "$GOBIN"
|
|
||||||
then
|
|
||||||
echo '$GOBIN is not a directory or does not exist' 1>&2
|
|
||||||
echo 'create it or set $GOBIN differently' 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$GOARCH" in
|
case "$GOARCH" in
|
||||||
amd64 | 386 | arm)
|
amd64 | 386 | arm)
|
||||||
;;
|
;;
|
||||||
@ -40,7 +48,7 @@ esac
|
|||||||
|
|
||||||
rm -f "$GOBIN"/quietgcc
|
rm -f "$GOBIN"/quietgcc
|
||||||
CC=${CC:-gcc}
|
CC=${CC:-gcc}
|
||||||
sed -e "s|@CC@|$CC|" < quietgcc.bash > "$GOBIN"/quietgcc
|
sed -e "s|@CC@|$CC|" < "$GOROOT"/src/quietgcc.bash > "$GOBIN"/quietgcc
|
||||||
chmod +x "$GOBIN"/quietgcc
|
chmod +x "$GOBIN"/quietgcc
|
||||||
|
|
||||||
rm -f "$GOBIN"/gomake
|
rm -f "$GOBIN"/gomake
|
||||||
@ -51,12 +59,6 @@ fi
|
|||||||
(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >"$GOBIN"/gomake
|
(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >"$GOBIN"/gomake
|
||||||
chmod +x "$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
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d /selinux -a -f /selinux/booleans/allow_execstack ] ; then
|
if [ -d /selinux -a -f /selinux/booleans/allow_execstack ] ; then
|
||||||
if ! cat /selinux/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
|
if ! cat /selinux/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
|
||||||
echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
|
echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
|
||||||
@ -74,10 +76,10 @@ if [ -d /selinux -a -f /selinux/booleans/allow_execstack ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
cd pkg;
|
cd "$GOROOT"/src/pkg;
|
||||||
bash deps.bash # do this here so clean.bash will work in the pkg directory
|
bash deps.bash # do this here so clean.bash will work in the pkg directory
|
||||||
)
|
)
|
||||||
bash clean.bash
|
bash "$GOROOT"/src/clean.bash
|
||||||
|
|
||||||
for i in lib9 libbio libmach cmd pkg libcgo cmd/cgo cmd/ebnflint cmd/godoc cmd/gofmt cmd/goyacc cmd/hgpatch
|
for i in lib9 libbio libmach cmd pkg libcgo cmd/cgo cmd/ebnflint cmd/godoc cmd/gofmt cmd/goyacc cmd/hgpatch
|
||||||
do
|
do
|
||||||
@ -91,16 +93,16 @@ do
|
|||||||
# test the exit status.
|
# test the exit status.
|
||||||
(
|
(
|
||||||
echo; echo; echo %%%% making $i %%%%; echo
|
echo; echo; echo %%%% making $i %%%%; echo
|
||||||
cd $i
|
cd "$GOROOT"/src/$i
|
||||||
case $i in
|
case $i in
|
||||||
cmd)
|
cmd)
|
||||||
bash make.bash
|
bash make.bash
|
||||||
;;
|
;;
|
||||||
pkg)
|
pkg)
|
||||||
gomake install
|
"$GOBIN"/gomake install
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
gomake install
|
"$GOBIN"/gomake install
|
||||||
esac
|
esac
|
||||||
) || exit 1
|
) || exit 1
|
||||||
esac
|
esac
|
||||||
|
@ -9,8 +9,11 @@
|
|||||||
# line and do not contain imports.
|
# line and do not contain imports.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
make
|
|
||||||
6g main.go && 6l main.6
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
|
"$GOBIN"/gomake
|
||||||
|
"$GOBIN"/6g main.go && "$GOBIN"/6l main.6
|
||||||
(
|
(
|
||||||
for i in $(egrep -l '// \$G (\$D/)?\$F\.go \&\& \$L \$F\.\$A && \./\$A\.out' "$GOROOT"/test/*.go "$GOROOT"/test/*/*.go)
|
for i in $(egrep -l '// \$G (\$D/)?\$F\.go \&\& \$L \$F\.\$A && \./\$A\.out' "$GOROOT"/test/*.go "$GOROOT"/test/*/*.go)
|
||||||
do
|
do
|
||||||
|
@ -23,7 +23,7 @@ CLEANFILES+=ogle
|
|||||||
include ../../../Make.pkg
|
include ../../../Make.pkg
|
||||||
|
|
||||||
main.$O: main.go package
|
main.$O: main.go package
|
||||||
$(GC) -I_obj $<
|
$(QUOTED_GOBIN)/$(GC) -I_obj $<
|
||||||
|
|
||||||
ogle: main.$O
|
ogle: main.$O
|
||||||
$(LD) -L_obj -o $@ $<
|
$(QUOTED_GOBIN)/$(LD) -L_obj -o $@ $<
|
||||||
|
@ -92,27 +92,27 @@ $(GOARCH)/asm.h: mkasmh.sh runtime.acid.$(GOARCH)
|
|||||||
mv -f $@.x $@
|
mv -f $@.x $@
|
||||||
|
|
||||||
cgo2c: cgo2c.c
|
cgo2c: cgo2c.c
|
||||||
quietgcc -o $@ $<
|
$(QUOTED_GOBIN)/quietgcc -o $@ $<
|
||||||
|
|
||||||
%.c: %.cgo cgo2c
|
%.c: %.cgo cgo2c
|
||||||
./cgo2c $< > $@.tmp
|
./cgo2c $< > $@.tmp
|
||||||
mv -f $@.tmp $@
|
mv -f $@.tmp $@
|
||||||
|
|
||||||
%.$O: $(GOARCH)/%.c
|
%.$O: $(GOARCH)/%.c
|
||||||
$(CC) $(CFLAGS) $<
|
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
|
||||||
|
|
||||||
%.$O: $(GOOS)/%.c
|
%.$O: $(GOOS)/%.c
|
||||||
$(CC) $(CFLAGS) $<
|
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
|
||||||
|
|
||||||
%.$O: $(GOOS)/$(GOARCH)/%.c
|
%.$O: $(GOOS)/$(GOARCH)/%.c
|
||||||
$(CC) $(CFLAGS) $<
|
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $<
|
||||||
|
|
||||||
%.$O: $(GOARCH)/%.s $(GOARCH)/asm.h
|
%.$O: $(GOARCH)/%.s $(GOARCH)/asm.h
|
||||||
$(AS) $<
|
$(QUOTED_GOBIN)/$(AS) $<
|
||||||
|
|
||||||
%.$O: $(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h
|
%.$O: $(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h
|
||||||
$(AS) $<
|
$(QUOTED_GOBIN)/$(AS) $<
|
||||||
|
|
||||||
# for discovering offsets inside structs when debugging
|
# for discovering offsets inside structs when debugging
|
||||||
runtime.acid.$(GOARCH): runtime.h proc.c
|
runtime.acid.$(GOARCH): runtime.h proc.c
|
||||||
$(CC) -a proc.c >$@
|
$(QUOTED_GOBIN)/$(CC) -a proc.c >$@
|
||||||
|
36
src/run.bash
36
src/run.bash
@ -5,13 +5,15 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
# no core files, please
|
# no core files, please
|
||||||
ulimit -c 0
|
ulimit -c 0
|
||||||
|
|
||||||
xcd() {
|
xcd() {
|
||||||
echo
|
echo
|
||||||
echo --- cd $1
|
echo --- cd $1
|
||||||
builtin cd $1
|
builtin cd "$GOROOT"/src/$1
|
||||||
}
|
}
|
||||||
|
|
||||||
maketest() {
|
maketest() {
|
||||||
@ -19,10 +21,10 @@ maketest() {
|
|||||||
do
|
do
|
||||||
(
|
(
|
||||||
xcd $i
|
xcd $i
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
time gomake
|
time "$GOBIN"/gomake
|
||||||
gomake install
|
"$GOBIN"/gomake install
|
||||||
gomake test
|
"$GOBIN"/gomake test
|
||||||
) || exit $?
|
) || exit $?
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -34,31 +36,31 @@ maketest \
|
|||||||
# from what maketest does.
|
# from what maketest does.
|
||||||
|
|
||||||
(xcd pkg/sync;
|
(xcd pkg/sync;
|
||||||
gomake clean;
|
"$GOBIN"/gomake clean;
|
||||||
time gomake
|
time "$GOBIN"/gomake
|
||||||
GOMAXPROCS=10 gomake test
|
GOMAXPROCS=10 "$GOBIN"/gomake test
|
||||||
) || exit $?
|
) || exit $?
|
||||||
|
|
||||||
(xcd cmd/gofmt
|
(xcd cmd/gofmt
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
time gomake
|
time "$GOBIN"/gomake
|
||||||
time gomake smoketest
|
time "$GOBIN"/gomake smoketest
|
||||||
) || exit $?
|
) || exit $?
|
||||||
|
|
||||||
(xcd cmd/ebnflint
|
(xcd cmd/ebnflint
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
time gomake
|
time "$GOBIN"/gomake
|
||||||
time gomake test
|
time "$GOBIN"/gomake test
|
||||||
) || exit $?
|
) || exit $?
|
||||||
|
|
||||||
(xcd ../misc/cgo/stdio
|
(xcd ../misc/cgo/stdio
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
./test.bash
|
./test.bash
|
||||||
) || exit $?
|
) || exit $?
|
||||||
|
|
||||||
(xcd pkg/exp/ogle
|
(xcd pkg/exp/ogle
|
||||||
gomake clean
|
"$GOBIN"/gomake clean
|
||||||
time gomake ogle
|
time "$GOBIN"/gomake ogle
|
||||||
) || exit $?
|
) || exit $?
|
||||||
|
|
||||||
(xcd ../doc/progs
|
(xcd ../doc/progs
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
GOBIN="${GOBIN:-$HOME/bin}"
|
||||||
|
|
||||||
. "$GOROOT"/src/Make.$GOARCH
|
. "$GOROOT"/src/Make.$GOARCH
|
||||||
PATH=.:$PATH
|
PATH=.:$PATH
|
||||||
|
|
||||||
@ -15,11 +18,11 @@ X-test)
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
gc() {
|
gc() {
|
||||||
$GC $1.go; $LD $1.$O
|
"$GOBIN"/$GC $1.go; "$GOBIN"/$LD $1.$O
|
||||||
}
|
}
|
||||||
|
|
||||||
gc_B() {
|
gc_B() {
|
||||||
$GC -B $1.go; $LD $1.$O
|
"$GOBIN"/$GC -B $1.go; "$GOBIN"/$LD $1.$O
|
||||||
}
|
}
|
||||||
|
|
||||||
runonly() {
|
runonly() {
|
||||||
|
Loading…
Reference in New Issue
Block a user