cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Copyright 2012 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.
|
|
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
package main
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"flag"
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Initialization for any invocation.
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// The usual variables.
|
2015-01-07 11:38:00 -05:00
|
|
|
var (
|
|
|
|
|
goarch string
|
|
|
|
|
gobin string
|
|
|
|
|
gohostarch string
|
|
|
|
|
gohostchar string
|
|
|
|
|
gohostos string
|
|
|
|
|
goos string
|
|
|
|
|
goarm string
|
|
|
|
|
go386 string
|
|
|
|
|
goroot string
|
|
|
|
|
goroot_final string
|
|
|
|
|
goextlinkenabled string
|
|
|
|
|
workdir string
|
|
|
|
|
tooldir string
|
|
|
|
|
gochar string
|
|
|
|
|
oldgoos string
|
|
|
|
|
oldgoarch string
|
|
|
|
|
oldgochar string
|
|
|
|
|
slash string
|
2015-01-19 12:57:35 -05:00
|
|
|
exe string
|
2015-01-07 11:38:00 -05:00
|
|
|
defaultcc string
|
|
|
|
|
defaultcflags string
|
|
|
|
|
defaultldflags string
|
|
|
|
|
defaultcxxtarget string
|
|
|
|
|
defaultcctarget string
|
|
|
|
|
rebuildall bool
|
|
|
|
|
defaultclang bool
|
|
|
|
|
|
|
|
|
|
sflag bool // build static binaries
|
|
|
|
|
vflag int // verbosity
|
|
|
|
|
)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// The known architecture letters.
|
2015-01-07 11:38:00 -05:00
|
|
|
var gochars = "566899"
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// The known architectures.
|
2015-01-07 11:38:00 -05:00
|
|
|
var okgoarch = []string{
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// same order as gochars
|
|
|
|
|
"arm",
|
|
|
|
|
"amd64",
|
all: merge NaCl branch (part 1)
See golang.org/s/go13nacl for design overview.
This CL is the mostly mechanical changes from rsc's Go 1.2 based NaCl branch, specifically 39cb35750369 to 500771b477cf from https://code.google.com/r/rsc-go13nacl. This CL does not include working NaCl support, there are probably two or three more large merges to come.
CL 15750044 is not included as it involves more invasive changes to the linker which will need to be merged separately.
The exact change lists included are
15050047: syscall: support for Native Client
15360044: syscall: unzip implementation for Native Client
15370044: syscall: Native Client SRPC implementation
15400047: cmd/dist, cmd/go, go/build, test: support for Native Client
15410048: runtime: support for Native Client
15410049: syscall: file descriptor table for Native Client
15410050: syscall: in-memory file system for Native Client
15440048: all: update +build lines for Native Client port
15540045: cmd/6g, cmd/8g, cmd/gc: support for Native Client
15570045: os: support for Native Client
15680044: crypto/..., hash/crc32, reflect, sync/atomic: support for amd64p32
15690044: net: support for Native Client
15690048: runtime: support for fake time like on Go Playground
15690051: build: disable various tests on Native Client
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/68150047
2014-02-25 09:47:42 -05:00
|
|
|
"amd64p32",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"386",
|
2014-12-05 19:13:20 -05:00
|
|
|
"ppc64",
|
|
|
|
|
"ppc64le",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// The known operating systems.
|
2015-01-07 11:38:00 -05:00
|
|
|
var okgoos = []string{
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"darwin",
|
2013-08-24 01:18:04 +10:00
|
|
|
"dragonfly",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"linux",
|
all: add GOOS=android
As android and linux have significant overlap, and
because build tags are a poor way to represent an
OS target, this CL introduces an exception into
go/build: linux is treated as a synonym for android
when matching files.
http://golang.org/s/go14android
https://groups.google.com/forum/#!topic/golang-dev/P1ATVp1mun0
LGTM=rsc, minux
R=golang-codereviews, mikioh.mikioh, dave, aram, minux, gobot, rsc, aram.h, elias.naur, iant
CC=golang-codereviews, rsc
https://golang.org/cl/105270043
2014-07-01 17:21:50 -04:00
|
|
|
"android",
|
2014-01-07 23:12:12 +11:00
|
|
|
"solaris",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"freebsd",
|
all: merge NaCl branch (part 1)
See golang.org/s/go13nacl for design overview.
This CL is the mostly mechanical changes from rsc's Go 1.2 based NaCl branch, specifically 39cb35750369 to 500771b477cf from https://code.google.com/r/rsc-go13nacl. This CL does not include working NaCl support, there are probably two or three more large merges to come.
CL 15750044 is not included as it involves more invasive changes to the linker which will need to be merged separately.
The exact change lists included are
15050047: syscall: support for Native Client
15360044: syscall: unzip implementation for Native Client
15370044: syscall: Native Client SRPC implementation
15400047: cmd/dist, cmd/go, go/build, test: support for Native Client
15410048: runtime: support for Native Client
15410049: syscall: file descriptor table for Native Client
15410050: syscall: in-memory file system for Native Client
15440048: all: update +build lines for Native Client port
15540045: cmd/6g, cmd/8g, cmd/gc: support for Native Client
15570045: os: support for Native Client
15680044: crypto/..., hash/crc32, reflect, sync/atomic: support for amd64p32
15690044: net: support for Native Client
15690048: runtime: support for fake time like on Go Playground
15690051: build: disable various tests on Native Client
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/68150047
2014-02-25 09:47:42 -05:00
|
|
|
"nacl",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"netbsd",
|
|
|
|
|
"openbsd",
|
|
|
|
|
"plan9",
|
|
|
|
|
"windows",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// find reports the first index of p in l[0:n], or else -1.
|
2015-01-07 11:38:00 -05:00
|
|
|
func find(p string, l []string) int {
|
|
|
|
|
for i, s := range l {
|
|
|
|
|
if p == s {
|
|
|
|
|
return i
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
// xinit handles initialization of the various global state, like goroot and goarch.
|
|
|
|
|
func xinit() {
|
|
|
|
|
goroot = os.Getenv("GOROOT")
|
|
|
|
|
if slash == "/" && len(goroot) > 1 || slash == `\` && len(goroot) > 3 {
|
|
|
|
|
// if not "/" or "c:\", then strip trailing path separator
|
|
|
|
|
goroot = strings.TrimSuffix(goroot, slash)
|
|
|
|
|
}
|
|
|
|
|
if goroot == "" {
|
|
|
|
|
fatal("$GOROOT must be set")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goroot_final = os.Getenv("GOROOT_FINAL")
|
|
|
|
|
if goroot_final == "" {
|
|
|
|
|
goroot_final = goroot
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b := os.Getenv("GOBIN")
|
|
|
|
|
if b == "" {
|
|
|
|
|
b = goroot + slash + "bin"
|
|
|
|
|
}
|
|
|
|
|
gobin = b
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("GOOS")
|
|
|
|
|
if b == "" {
|
|
|
|
|
b = gohostos
|
|
|
|
|
}
|
|
|
|
|
goos = b
|
|
|
|
|
if find(goos, okgoos) < 0 {
|
|
|
|
|
fatal("unknown $GOOS %s", goos)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("GOARM")
|
|
|
|
|
if b == "" {
|
|
|
|
|
b = xgetgoarm()
|
|
|
|
|
}
|
|
|
|
|
goarm = b
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("GO386")
|
|
|
|
|
if b == "" {
|
|
|
|
|
if cansse2() {
|
|
|
|
|
b = "sse2"
|
|
|
|
|
} else {
|
|
|
|
|
b = "387"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
go386 = b
|
|
|
|
|
|
2015-02-28 13:48:09 -05:00
|
|
|
p := pathf("%s/src/all.bash", goroot)
|
2015-01-07 11:38:00 -05:00
|
|
|
if !isfile(p) {
|
|
|
|
|
fatal("$GOROOT is not set correctly or not exported\n"+
|
|
|
|
|
"\tGOROOT=%s\n"+
|
|
|
|
|
"\t%s does not exist", goroot, p)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("GOHOSTARCH")
|
|
|
|
|
if b != "" {
|
|
|
|
|
gohostarch = b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i := find(gohostarch, okgoarch)
|
|
|
|
|
if i < 0 {
|
|
|
|
|
fatal("unknown $GOHOSTARCH %s", gohostarch)
|
|
|
|
|
}
|
|
|
|
|
gohostchar = gochars[i : i+1]
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("GOARCH")
|
|
|
|
|
if b == "" {
|
|
|
|
|
b = gohostarch
|
|
|
|
|
}
|
|
|
|
|
goarch = b
|
|
|
|
|
i = find(goarch, okgoarch)
|
|
|
|
|
if i < 0 {
|
|
|
|
|
fatal("unknown $GOARCH %s", goarch)
|
|
|
|
|
}
|
|
|
|
|
gochar = gochars[i : i+1]
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("GO_EXTLINK_ENABLED")
|
|
|
|
|
if b != "" {
|
|
|
|
|
if b != "0" && b != "1" {
|
|
|
|
|
fatal("unknown $GO_EXTLINK_ENABLED %s", b)
|
|
|
|
|
}
|
|
|
|
|
goextlinkenabled = b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("CC")
|
|
|
|
|
if b == "" {
|
2013-08-02 14:58:27 -04:00
|
|
|
// Use clang on OS X, because gcc is deprecated there.
|
|
|
|
|
// Xcode for OS X 10.9 Mavericks will ship a fake "gcc" binary that
|
|
|
|
|
// actually runs clang. We prepare different command
|
|
|
|
|
// lines for the two binaries, so it matters what we call it.
|
|
|
|
|
// See golang.org/issue/5822.
|
2015-01-07 11:38:00 -05:00
|
|
|
if defaultclang {
|
|
|
|
|
b = "clang"
|
|
|
|
|
} else {
|
|
|
|
|
b = "gcc"
|
|
|
|
|
}
|
2013-08-02 14:58:27 -04:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
defaultcc = b
|
2013-03-29 16:33:35 -07:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
defaultcflags = os.Getenv("CFLAGS")
|
2014-03-05 14:10:22 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
defaultldflags = os.Getenv("LDFLAGS")
|
2014-03-05 14:10:22 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
b = os.Getenv("CC_FOR_TARGET")
|
|
|
|
|
if b == "" {
|
|
|
|
|
b = defaultcc
|
2014-02-06 09:11:00 -08:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
defaultcctarget = b
|
|
|
|
|
|
|
|
|
|
b = os.Getenv("CXX_FOR_TARGET")
|
|
|
|
|
if b == "" {
|
|
|
|
|
b = os.Getenv("CXX")
|
|
|
|
|
if b == "" {
|
|
|
|
|
if defaultclang {
|
|
|
|
|
b = "clang++"
|
|
|
|
|
} else {
|
|
|
|
|
b = "g++"
|
|
|
|
|
}
|
2014-02-06 09:11:00 -08:00
|
|
|
}
|
2013-09-24 00:17:08 -04:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
defaultcxxtarget = b
|
|
|
|
|
|
|
|
|
|
// For tools being invoked but also for os.ExpandEnv.
|
|
|
|
|
os.Setenv("GO386", go386)
|
|
|
|
|
os.Setenv("GOARCH", goarch)
|
|
|
|
|
os.Setenv("GOARM", goarm)
|
|
|
|
|
os.Setenv("GOHOSTARCH", gohostarch)
|
|
|
|
|
os.Setenv("GOHOSTOS", gohostos)
|
|
|
|
|
os.Setenv("GOOS", goos)
|
|
|
|
|
os.Setenv("GOROOT", goroot)
|
|
|
|
|
os.Setenv("GOROOT_FINAL", goroot_final)
|
2012-02-28 16:18:24 -05:00
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Make the environment more predictable.
|
2015-01-07 11:38:00 -05:00
|
|
|
os.Setenv("LANG", "C")
|
|
|
|
|
os.Setenv("LANGUAGE", "en_US.UTF8")
|
2012-02-03 18:16:42 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
workdir = xworkdir()
|
|
|
|
|
xatexit(rmworkdir)
|
2012-02-13 22:31:51 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// rmworkdir deletes the work directory.
|
2015-01-07 11:38:00 -05:00
|
|
|
func rmworkdir() {
|
|
|
|
|
if vflag > 1 {
|
|
|
|
|
errprintf("rm -rf %s\n", workdir)
|
|
|
|
|
}
|
|
|
|
|
xremoveall(workdir)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
2012-02-03 18:16:42 -05:00
|
|
|
// Remove trailing spaces.
|
2015-01-07 11:38:00 -05:00
|
|
|
func chomp(s string) string {
|
|
|
|
|
return strings.TrimRight(s, " \t\r\n")
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
func branchtag(branch string) (tag string, precise bool) {
|
|
|
|
|
b := run(goroot, CheckExit, "git", "log", "--decorate=full", "--format=format:%d", "master.."+branch)
|
|
|
|
|
tag = branch
|
|
|
|
|
for _, line := range splitlines(b) {
|
2014-12-08 13:53:11 +11:00
|
|
|
// Each line is either blank, or looks like
|
|
|
|
|
// (tag: refs/tags/go1.4rc2, refs/remotes/origin/release-branch.go1.4, refs/heads/release-branch.go1.4)
|
|
|
|
|
// We need to find an element starting with refs/tags/.
|
2015-01-07 11:38:00 -05:00
|
|
|
i := strings.Index(line, " refs/tags/")
|
|
|
|
|
if i < 0 {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
i += len(" refs/tags/")
|
2014-12-08 13:53:11 +11:00
|
|
|
// The tag name ends at a comma or paren (prefer the first).
|
2015-01-07 11:38:00 -05:00
|
|
|
j := strings.Index(line[i:], ",")
|
|
|
|
|
if j < 0 {
|
|
|
|
|
j = strings.Index(line[i:], ")")
|
|
|
|
|
}
|
|
|
|
|
if j < 0 {
|
|
|
|
|
continue // malformed line; ignore it
|
|
|
|
|
}
|
|
|
|
|
tag = line[i : i+j]
|
|
|
|
|
if i == 0 {
|
|
|
|
|
precise = true // tag denotes HEAD
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
return
|
2014-12-08 13:53:11 +11:00
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
|
|
|
|
|
// findgoversion determines the Go version to use in the version string.
|
2015-01-07 11:38:00 -05:00
|
|
|
func findgoversion() string {
|
2012-02-03 18:16:42 -05:00
|
|
|
// The $GOROOT/VERSION file takes priority, for distributions
|
2014-12-08 13:53:11 +11:00
|
|
|
// without the source repo.
|
2015-01-07 11:38:00 -05:00
|
|
|
path := pathf("%s/VERSION", goroot)
|
|
|
|
|
if isfile(path) {
|
|
|
|
|
b := chomp(readfile(path))
|
2012-02-07 00:38:15 -02:00
|
|
|
// Commands such as "dist version > VERSION" will cause
|
|
|
|
|
// the shell to create an empty VERSION file and set dist's
|
|
|
|
|
// stdout to its fd. dist in turn looks at VERSION and uses
|
|
|
|
|
// its content if available, which is empty at this point.
|
2015-01-07 11:38:00 -05:00
|
|
|
// Only use the VERSION file if it is non-empty.
|
|
|
|
|
if b != "" {
|
|
|
|
|
return b
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The $GOROOT/VERSION.cache file is a cache to avoid invoking
|
2014-12-08 13:53:11 +11:00
|
|
|
// git every time we run this command. Unlike VERSION, it gets
|
2012-02-03 18:16:42 -05:00
|
|
|
// deleted by the clean command.
|
2015-01-07 11:38:00 -05:00
|
|
|
path = pathf("%s/VERSION.cache", goroot)
|
|
|
|
|
if isfile(path) {
|
|
|
|
|
return chomp(readfile(path))
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
2015-02-20 08:34:30 +11:00
|
|
|
// Show a nicer error message if this isn't a Git repo.
|
|
|
|
|
if !isGitRepo() {
|
|
|
|
|
fatal("FAILED: not a Git repo; must put a VERSION file in $GOROOT")
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-08 13:53:11 +11:00
|
|
|
// Otherwise, use Git.
|
2012-02-03 18:16:42 -05:00
|
|
|
// What is the current branch?
|
2015-01-07 11:38:00 -05:00
|
|
|
branch := chomp(run(goroot, CheckExit, "git", "rev-parse", "--abbrev-ref", "HEAD"))
|
2012-02-03 18:16:42 -05:00
|
|
|
|
|
|
|
|
// What are the tags along the current branch?
|
2015-01-07 11:38:00 -05:00
|
|
|
tag := "devel"
|
|
|
|
|
precise := false
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2014-12-08 13:53:11 +11:00
|
|
|
// If we're on a release branch, use the closest matching tag
|
|
|
|
|
// that is on the release branch (and not on the master branch).
|
2015-01-07 11:38:00 -05:00
|
|
|
if strings.HasPrefix(branch, "release-branch.") {
|
|
|
|
|
tag, precise = branchtag(branch)
|
|
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
if !precise {
|
2014-12-08 13:53:11 +11:00
|
|
|
// Tag does not point at HEAD; add hash and date to version.
|
2015-01-07 11:38:00 -05:00
|
|
|
tag += chomp(run(goroot, CheckExit, "git", "log", "-n", "1", "--format=format: +%h %cd", "HEAD"))
|
2014-12-08 13:53:11 +11:00
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
|
|
|
|
|
// Cache version.
|
2015-01-07 11:38:00 -05:00
|
|
|
writefile(tag, path, 0)
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
return tag
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
2015-02-20 08:34:30 +11:00
|
|
|
// isGitRepo reports whether the working directory is inside a Git repository.
|
|
|
|
|
func isGitRepo() bool {
|
|
|
|
|
p := ".git"
|
|
|
|
|
for {
|
|
|
|
|
fi, err := os.Stat(p)
|
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
|
p = filepath.Join("..", p)
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
if err != nil || !fi.IsDir() {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
/*
|
|
|
|
|
* Initial tree setup.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// The old tools that no longer live in $GOBIN or $GOROOT/bin.
|
2015-01-07 11:38:00 -05:00
|
|
|
var oldtool = []string{
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"5a", "5c", "5g", "5l",
|
|
|
|
|
"6a", "6c", "6g", "6l",
|
|
|
|
|
"8a", "8c", "8g", "8l",
|
2014-08-06 23:59:14 -04:00
|
|
|
"9a", "9c", "9g", "9l",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"6cov",
|
|
|
|
|
"6nm",
|
2012-02-13 22:31:51 -05:00
|
|
|
"6prof",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"cgo",
|
|
|
|
|
"ebnflint",
|
|
|
|
|
"goapi",
|
|
|
|
|
"gofix",
|
|
|
|
|
"goinstall",
|
|
|
|
|
"gomake",
|
|
|
|
|
"gopack",
|
|
|
|
|
"gopprof",
|
|
|
|
|
"gotest",
|
|
|
|
|
"gotype",
|
|
|
|
|
"govet",
|
|
|
|
|
"goyacc",
|
|
|
|
|
"quietgcc",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
2012-02-14 00:18:30 -05:00
|
|
|
// Unreleased directories (relative to $GOROOT) that should
|
|
|
|
|
// not be in release branches.
|
2015-01-07 11:38:00 -05:00
|
|
|
var unreleased = []string{
|
2014-04-14 12:33:51 -04:00
|
|
|
"src/cmd/link",
|
2015-01-19 11:45:48 -05:00
|
|
|
"src/cmd/objwriter",
|
2014-09-08 00:06:45 -04:00
|
|
|
"src/debug/goobj",
|
|
|
|
|
"src/old",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
2012-02-14 00:18:30 -05:00
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// setup sets up the tree for the initial build.
|
2015-01-07 11:38:00 -05:00
|
|
|
func setup() {
|
2012-02-13 22:31:51 -05:00
|
|
|
// Create bin directory.
|
2015-01-07 11:38:00 -05:00
|
|
|
if p := pathf("%s/bin", goroot); !isdir(p) {
|
|
|
|
|
xmkdir(p)
|
|
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// Create package directory.
|
2015-01-07 11:38:00 -05:00
|
|
|
if p := pathf("%s/pkg", goroot); !isdir(p) {
|
|
|
|
|
xmkdir(p)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p := pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch)
|
|
|
|
|
if rebuildall {
|
|
|
|
|
xremoveall(p)
|
|
|
|
|
}
|
|
|
|
|
xmkdirall(p)
|
|
|
|
|
|
|
|
|
|
if goos != gohostos || goarch != gohostarch {
|
|
|
|
|
p := pathf("%s/pkg/%s_%s", goroot, goos, goarch)
|
|
|
|
|
if rebuildall {
|
|
|
|
|
xremoveall(p)
|
|
|
|
|
}
|
|
|
|
|
xmkdirall(p)
|
2012-02-13 22:31:51 -05:00
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2012-02-03 18:16:42 -05:00
|
|
|
// Create object directory.
|
|
|
|
|
// We keep it in pkg/ so that all the generated binaries
|
2012-02-13 22:31:51 -05:00
|
|
|
// are in one tree. If pkg/obj/libgc.a exists, it is a dreg from
|
|
|
|
|
// before we used subdirectories of obj. Delete all of obj
|
|
|
|
|
// to clean up.
|
2015-01-07 11:38:00 -05:00
|
|
|
if p := pathf("%s/pkg/obj/libgc.a", goroot); isfile(p) {
|
|
|
|
|
xremoveall(pathf("%s/pkg/obj", goroot))
|
|
|
|
|
}
|
|
|
|
|
p = pathf("%s/pkg/obj/%s_%s", goroot, gohostos, gohostarch)
|
|
|
|
|
if rebuildall {
|
|
|
|
|
xremoveall(p)
|
|
|
|
|
}
|
|
|
|
|
xmkdirall(p)
|
2012-02-13 22:31:51 -05:00
|
|
|
|
|
|
|
|
// Create tool directory.
|
|
|
|
|
// We keep it in pkg/, just like the object directory above.
|
2015-01-07 11:38:00 -05:00
|
|
|
if rebuildall {
|
|
|
|
|
xremoveall(tooldir)
|
|
|
|
|
}
|
|
|
|
|
xmkdirall(tooldir)
|
2012-02-13 22:31:51 -05:00
|
|
|
|
|
|
|
|
// Remove tool binaries from before the tool/gohostos_gohostarch
|
2015-01-07 11:38:00 -05:00
|
|
|
xremoveall(pathf("%s/bin/tool", goroot))
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// Remove old pre-tool binaries.
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, old := range oldtool {
|
|
|
|
|
xremove(pathf("%s/bin/%s", goroot, old))
|
|
|
|
|
}
|
2012-02-13 22:31:51 -05:00
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// If $GOBIN is set and has a Go compiler, it must be cleaned.
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, char := range gochars {
|
|
|
|
|
if isfile(pathf("%s%s%c%s", gobin, slash, char, "g")) {
|
|
|
|
|
for _, old := range oldtool {
|
|
|
|
|
xremove(pathf("%s/%s", gobin, old))
|
|
|
|
|
}
|
|
|
|
|
break
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-14 00:18:30 -05:00
|
|
|
// For release, make sure excluded things are excluded.
|
2015-02-10 23:51:25 -05:00
|
|
|
goversion := findgoversion()
|
2015-01-07 11:38:00 -05:00
|
|
|
if strings.HasPrefix(goversion, "release.") || (strings.HasPrefix(goversion, "go") && !strings.Contains(goversion, "beta")) {
|
|
|
|
|
for _, dir := range unreleased {
|
|
|
|
|
if p := pathf("%s/%s", goroot, dir); isdir(p) {
|
|
|
|
|
fatal("%s should not exist in release build", p)
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-14 00:18:30 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2015-02-28 14:00:44 -05:00
|
|
|
* Tool building
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// deptab lists changes to the default dependencies for a given prefix.
|
2012-02-28 16:18:24 -05:00
|
|
|
// deps ending in /* read the whole directory; deps beginning with -
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// exclude files with that prefix.
|
2015-01-07 11:38:00 -05:00
|
|
|
var deptab = []struct {
|
|
|
|
|
prefix string // prefix of target
|
|
|
|
|
dep []string // dependency tweaks for targets with that prefix
|
|
|
|
|
}{
|
|
|
|
|
{"cmd/go", []string{
|
2013-08-02 14:58:27 -04:00
|
|
|
"zdefaultcc.go",
|
|
|
|
|
}},
|
2015-01-07 11:38:00 -05:00
|
|
|
{"runtime", []string{
|
2012-02-03 18:16:42 -05:00
|
|
|
"zversion.go",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}},
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// depsuffix records the allowed suffixes for source files.
|
2015-01-07 11:38:00 -05:00
|
|
|
var depsuffix = []string{
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
".s",
|
|
|
|
|
".go",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// gentab records how to generate some trivial files.
|
2015-01-07 11:38:00 -05:00
|
|
|
var gentab = []struct {
|
|
|
|
|
nameprefix string
|
|
|
|
|
gen func(string, string)
|
|
|
|
|
}{
|
2013-08-02 14:58:27 -04:00
|
|
|
{"zdefaultcc.go", mkzdefaultcc},
|
2012-02-03 18:16:42 -05:00
|
|
|
{"zversion.go", mkzversion},
|
2013-12-08 22:48:11 -05:00
|
|
|
|
|
|
|
|
// not generated anymore, but delete the file if we see it
|
|
|
|
|
{"enam.c", nil},
|
2015-02-24 21:40:57 -05:00
|
|
|
{"anames5.c", nil},
|
|
|
|
|
{"anames6.c", nil},
|
|
|
|
|
{"anames8.c", nil},
|
|
|
|
|
{"anames9.c", nil},
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// install installs the library, package, or binary associated with dir,
|
|
|
|
|
// which is relative to $GOROOT/src.
|
2015-01-07 11:38:00 -05:00
|
|
|
func install(dir string) {
|
|
|
|
|
if vflag > 0 {
|
|
|
|
|
if goos != gohostos || goarch != gohostarch {
|
|
|
|
|
errprintf("%s (%s/%s)\n", dir, goos, goarch)
|
|
|
|
|
} else {
|
|
|
|
|
errprintf("%s\n", dir)
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
var clean []string
|
|
|
|
|
defer func() {
|
|
|
|
|
for _, name := range clean {
|
|
|
|
|
xremove(name)
|
|
|
|
|
}
|
|
|
|
|
}()
|
2012-05-01 22:32:46 -07:00
|
|
|
|
2012-02-14 00:18:30 -05:00
|
|
|
// path = full path to dir.
|
2015-01-07 11:38:00 -05:00
|
|
|
path := pathf("%s/src/%s", goroot, dir)
|
|
|
|
|
name := filepath.Base(dir)
|
2012-02-14 00:18:30 -05:00
|
|
|
|
2015-02-10 17:11:36 -08:00
|
|
|
ispkg := !strings.HasPrefix(dir, "cmd/") || strings.HasPrefix(dir, "cmd/internal/") || strings.HasPrefix(dir, "cmd/asm/internal/")
|
2012-02-28 16:18:24 -05:00
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Start final link command line.
|
2012-02-23 15:38:07 -05:00
|
|
|
// Note: code below knows that link.p[targ] is the target.
|
2015-01-07 11:38:00 -05:00
|
|
|
var (
|
|
|
|
|
link []string
|
|
|
|
|
targ int
|
|
|
|
|
ispackcmd bool
|
|
|
|
|
)
|
2015-02-28 14:00:44 -05:00
|
|
|
if ispkg {
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Go library (package).
|
2015-01-07 11:38:00 -05:00
|
|
|
ispackcmd = true
|
|
|
|
|
link = []string{"pack", pathf("%s/pkg/%s_%s/%s.a", goroot, goos, goarch, dir)}
|
|
|
|
|
targ = len(link) - 1
|
|
|
|
|
xmkdirall(filepath.Dir(link[targ]))
|
2015-02-28 14:00:44 -05:00
|
|
|
} else {
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Go command.
|
2015-01-07 11:38:00 -05:00
|
|
|
elem := name
|
|
|
|
|
if elem == "go" {
|
|
|
|
|
elem = "go_bootstrap"
|
|
|
|
|
}
|
|
|
|
|
link = []string{fmt.Sprintf("%s/%sl", tooldir, gochar), "-o", pathf("%s/%s%s", tooldir, elem, exe)}
|
|
|
|
|
targ = len(link) - 1
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
ttarg := mtime(link[targ])
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// Gather files that are sources for this target.
|
|
|
|
|
// Everything in that directory, and any target-specific
|
|
|
|
|
// additions.
|
2015-01-07 11:38:00 -05:00
|
|
|
files := xreaddir(path)
|
2012-02-06 13:33:22 -05:00
|
|
|
|
|
|
|
|
// Remove files beginning with . or _,
|
|
|
|
|
// which are likely to be editor temporary files.
|
|
|
|
|
// This is the same heuristic build.ScanDir uses.
|
|
|
|
|
// There do exist real C files beginning with _,
|
|
|
|
|
// so limit that check to just Go files.
|
2015-01-07 11:38:00 -05:00
|
|
|
files = filter(files, func(p string) bool {
|
|
|
|
|
return !strings.HasPrefix(p, ".") && (!strings.HasPrefix(p, "_") || !strings.HasSuffix(p, ".go"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
for _, dt := range deptab {
|
|
|
|
|
if dir == dt.prefix || strings.HasSuffix(dt.prefix, "/") && strings.HasPrefix(dir, dt.prefix) {
|
|
|
|
|
for _, p := range dt.dep {
|
|
|
|
|
p = os.ExpandEnv(p)
|
2015-02-28 14:00:44 -05:00
|
|
|
files = append(files, p)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
files = uniq(files)
|
2012-02-28 16:18:24 -05:00
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Convert to absolute paths.
|
2015-01-07 11:38:00 -05:00
|
|
|
for i, p := range files {
|
|
|
|
|
if !isabs(p) {
|
|
|
|
|
files[i] = pathf("%s/%s", path, p)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Is the target up-to-date?
|
2015-01-07 11:38:00 -05:00
|
|
|
var gofiles, missing []string
|
|
|
|
|
stale := rebuildall
|
|
|
|
|
files = filter(files, func(p string) bool {
|
|
|
|
|
for _, suf := range depsuffix {
|
|
|
|
|
if strings.HasSuffix(p, suf) {
|
|
|
|
|
goto ok
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
ok:
|
2015-01-07 11:38:00 -05:00
|
|
|
t := mtime(p)
|
|
|
|
|
if !t.IsZero() && !strings.HasSuffix(p, ".a") && !shouldbuild(p, dir) {
|
|
|
|
|
return false
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
if strings.HasSuffix(p, ".go") {
|
|
|
|
|
gofiles = append(gofiles, p)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
if t.After(ttarg) {
|
|
|
|
|
stale = true
|
|
|
|
|
}
|
|
|
|
|
if t.IsZero() {
|
|
|
|
|
missing = append(missing, p)
|
|
|
|
|
}
|
|
|
|
|
return true
|
|
|
|
|
})
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2012-05-01 22:32:46 -07:00
|
|
|
// If there are no files to compile, we're done.
|
2015-01-07 11:38:00 -05:00
|
|
|
if len(files) == 0 {
|
|
|
|
|
return
|
|
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
if !stale {
|
|
|
|
|
return
|
|
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
2012-02-03 18:16:42 -05:00
|
|
|
// For package runtime, copy some files into the work space.
|
2015-01-07 11:38:00 -05:00
|
|
|
if dir == "runtime" {
|
|
|
|
|
// For use by assembly and C files.
|
|
|
|
|
copyfile(pathf("%s/pkg/%s_%s/textflag.h", goroot, goos, goarch),
|
2015-02-28 13:48:09 -05:00
|
|
|
pathf("%s/src/runtime/textflag.h", goroot), 0)
|
2015-01-07 11:38:00 -05:00
|
|
|
copyfile(pathf("%s/pkg/%s_%s/funcdata.h", goroot, goos, goarch),
|
|
|
|
|
pathf("%s/src/runtime/funcdata.h", goroot), 0)
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Generate any missing files; regenerate existing ones.
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, p := range files {
|
|
|
|
|
elem := filepath.Base(p)
|
|
|
|
|
for _, gt := range gentab {
|
|
|
|
|
if gt.gen == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
if strings.HasPrefix(elem, gt.nameprefix) {
|
|
|
|
|
if vflag > 1 {
|
|
|
|
|
errprintf("generate %s\n", p)
|
|
|
|
|
}
|
|
|
|
|
gt.gen(path, p)
|
2012-02-03 18:16:42 -05:00
|
|
|
// Do not add generated file to clean list.
|
2014-09-08 00:06:45 -04:00
|
|
|
// In runtime, we want to be able to
|
2012-02-03 18:16:42 -05:00
|
|
|
// build the package with the go tool,
|
|
|
|
|
// and it assumes these generated files already
|
|
|
|
|
// exist (it does not know how to build them).
|
|
|
|
|
// The 'clean' command can remove
|
|
|
|
|
// the generated files.
|
2015-01-07 11:38:00 -05:00
|
|
|
goto built
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
// Did not rebuild p.
|
2015-01-07 11:38:00 -05:00
|
|
|
if find(p, missing) >= 0 {
|
|
|
|
|
fatal("missing file %s", p)
|
|
|
|
|
}
|
|
|
|
|
built:
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
2015-02-28 14:00:44 -05:00
|
|
|
if goos != gohostos || goarch != gohostarch {
|
2012-02-13 22:31:51 -05:00
|
|
|
// We've generated the right files; the go command can do the build.
|
2015-01-07 11:38:00 -05:00
|
|
|
if vflag > 1 {
|
|
|
|
|
errprintf("skip build for cross-compile %s\n", dir)
|
|
|
|
|
}
|
|
|
|
|
return
|
2012-02-13 22:31:51 -05:00
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
var archive string
|
2015-02-28 14:00:44 -05:00
|
|
|
// The next loop will compile individual non-Go files.
|
|
|
|
|
// Hand the Go files to the compiler en masse.
|
|
|
|
|
// For package runtime, this writes go_asm.h, which
|
|
|
|
|
// the assembly files will need.
|
|
|
|
|
pkg := dir
|
|
|
|
|
if strings.HasPrefix(dir, "cmd/") {
|
|
|
|
|
pkg = "main"
|
|
|
|
|
}
|
|
|
|
|
b := pathf("%s/_go_.a", workdir)
|
|
|
|
|
clean = append(clean, b)
|
|
|
|
|
if !ispackcmd {
|
|
|
|
|
link = append(link, b)
|
|
|
|
|
} else {
|
|
|
|
|
archive = b
|
2014-11-11 01:29:05 -05:00
|
|
|
}
|
2015-02-28 14:00:44 -05:00
|
|
|
compile := []string{pathf("%s/%sg", tooldir, gochar), "-pack", "-o", b, "-p", pkg}
|
|
|
|
|
if dir == "runtime" {
|
|
|
|
|
compile = append(compile, "-+", "-asmhdr", pathf("%s/go_asm.h", workdir))
|
|
|
|
|
}
|
|
|
|
|
compile = append(compile, gofiles...)
|
|
|
|
|
run(path, CheckExit|ShowOutput, compile...)
|
2014-11-11 01:29:05 -05:00
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Compile the files.
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, p := range files {
|
2015-02-28 14:00:44 -05:00
|
|
|
if !strings.HasSuffix(p, ".s") {
|
2015-01-07 11:38:00 -05:00
|
|
|
continue
|
|
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
var compile []string
|
2015-02-28 14:00:44 -05:00
|
|
|
// Assembly file for a Go package.
|
|
|
|
|
compile = []string{
|
2015-02-28 14:24:28 -05:00
|
|
|
pathf("%s/asm", tooldir),
|
2015-02-28 14:00:44 -05:00
|
|
|
"-I", workdir,
|
|
|
|
|
"-I", pathf("%s/pkg/%s_%s", goroot, goos, goarch),
|
|
|
|
|
"-D", "GOOS_" + goos,
|
|
|
|
|
"-D", "GOARCH_" + goarch,
|
|
|
|
|
"-D", "GOOS_GOARCH_" + goos + "_" + goarch,
|
2012-02-28 16:18:24 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
doclean := true
|
|
|
|
|
b := pathf("%s/%s", workdir, filepath.Base(p))
|
2012-02-03 18:16:42 -05:00
|
|
|
|
2012-05-01 22:32:46 -07:00
|
|
|
// Change the last character of the output file (which was c or s).
|
2015-01-07 11:38:00 -05:00
|
|
|
if gohostos == "plan9" {
|
|
|
|
|
b = b[:len(b)-1] + gohostchar
|
|
|
|
|
} else {
|
|
|
|
|
b = b[:len(b)-1] + "o"
|
|
|
|
|
}
|
|
|
|
|
compile = append(compile, "-o", b, p)
|
|
|
|
|
bgrun(path, compile...)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
link = append(link, b)
|
|
|
|
|
if doclean {
|
|
|
|
|
clean = append(clean, b)
|
|
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
bgwait()
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-02-28 14:00:44 -05:00
|
|
|
if ispackcmd {
|
2015-01-07 11:38:00 -05:00
|
|
|
xremove(link[targ])
|
|
|
|
|
dopack(link[targ], archive, link[targ+1:])
|
|
|
|
|
return
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove target before writing it.
|
2015-01-07 11:38:00 -05:00
|
|
|
xremove(link[targ])
|
|
|
|
|
run("", CheckExit|ShowOutput, link...)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// matchfield reports whether the field matches this build.
|
2015-01-07 11:38:00 -05:00
|
|
|
func matchfield(f string) bool {
|
|
|
|
|
for _, tag := range strings.Split(f, ",") {
|
|
|
|
|
if tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" || (goos == "android" && tag == "linux") {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
return true
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// shouldbuild reports whether we should build this file.
|
|
|
|
|
// It applies the same rules that are used with context tags
|
|
|
|
|
// in package go/build, except that the GOOS and GOARCH
|
|
|
|
|
// can appear anywhere in the file name, not just after _.
|
|
|
|
|
// In particular, they can be the entire file name (like windows.c).
|
|
|
|
|
// We also allow the special tag cmd_go_bootstrap.
|
|
|
|
|
// See ../go/bootstrap.go and package go/build.
|
2015-01-07 11:38:00 -05:00
|
|
|
func shouldbuild(file, dir string) bool {
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Check file name for GOOS or GOARCH.
|
2015-01-07 11:38:00 -05:00
|
|
|
name := filepath.Base(file)
|
|
|
|
|
excluded := func(list []string, ok string) bool {
|
|
|
|
|
for _, x := range list {
|
|
|
|
|
if x == ok {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
i := strings.Index(name, x)
|
|
|
|
|
if i < 0 {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
i += len(x)
|
|
|
|
|
if i == len(name) || name[i] == '.' || name[i] == '_' {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if excluded(okgoos, goos) || excluded(okgoarch, goarch) {
|
|
|
|
|
return false
|
2014-08-06 23:59:14 -04:00
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Omit test files.
|
2015-01-07 11:38:00 -05:00
|
|
|
if strings.Contains(name, "_test") {
|
|
|
|
|
return false
|
|
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2012-02-03 18:16:42 -05:00
|
|
|
// cmd/go/doc.go has a giant /* */ comment before
|
|
|
|
|
// it gets to the important detail that it is not part of
|
|
|
|
|
// package main. We don't parse those comments,
|
|
|
|
|
// so special case that file.
|
2015-01-07 11:38:00 -05:00
|
|
|
if strings.HasSuffix(file, "cmd/go/doc.go") || strings.HasSuffix(file, "cmd\\go\\doc.go") {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if strings.HasSuffix(file, "cmd/cgo/doc.go") || strings.HasSuffix(file, "cmd\\cgo\\doc.go") {
|
|
|
|
|
return false
|
|
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
|
|
|
|
// Check file contents for // +build lines.
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, p := range splitlines(readfile(file)) {
|
|
|
|
|
p = strings.TrimSpace(p)
|
|
|
|
|
if p == "" {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
if strings.Contains(p, "package documentation") {
|
|
|
|
|
return false
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
if strings.Contains(p, "package main") && dir != "cmd/go" && dir != "cmd/cgo" {
|
|
|
|
|
return false
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
if !strings.HasPrefix(p, "//") {
|
|
|
|
|
break
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
if !strings.Contains(p, "+build") {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
fields := splitfields(p)
|
|
|
|
|
if len(fields) < 2 || fields[1] != "+build" {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
for _, p := range fields[2:] {
|
|
|
|
|
if (p[0] == '!' && !matchfield(p[1:])) || matchfield(p) {
|
|
|
|
|
goto fieldmatch
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
fieldmatch:
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
return true
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// copy copies the file src to dst, via memory (so only good for small files).
|
2015-01-07 11:38:00 -05:00
|
|
|
func copyfile(dst, src string, exec int) {
|
|
|
|
|
if vflag > 1 {
|
|
|
|
|
errprintf("cp %s %s\n", src, dst)
|
|
|
|
|
}
|
|
|
|
|
writefile(readfile(src), dst, exec)
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
2013-12-17 21:44:18 -05:00
|
|
|
// dopack copies the package src to dst,
|
|
|
|
|
// appending the files listed in extra.
|
|
|
|
|
// The archive format is the traditional Unix ar format.
|
2015-01-07 11:38:00 -05:00
|
|
|
func dopack(dst, src string, extra []string) {
|
|
|
|
|
bdst := bytes.NewBufferString(readfile(src))
|
|
|
|
|
for _, file := range extra {
|
|
|
|
|
b := readfile(file)
|
2013-12-17 21:44:18 -05:00
|
|
|
// find last path element for archive member name
|
2015-01-07 11:38:00 -05:00
|
|
|
i := strings.LastIndex(file, "/") + 1
|
|
|
|
|
j := strings.LastIndex(file, `\`) + 1
|
|
|
|
|
if i < j {
|
|
|
|
|
i = j
|
2013-12-17 21:44:18 -05:00
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
fmt.Fprintf(bdst, "%-16.16s%-12d%-6d%-6d%-8o%-10d`\n", file[i:], 0, 0, 0, 0644, len(b))
|
|
|
|
|
bdst.WriteString(b)
|
|
|
|
|
if len(b)&1 != 0 {
|
|
|
|
|
bdst.WriteByte(0)
|
2013-12-17 21:44:18 -05:00
|
|
|
}
|
|
|
|
|
}
|
2015-01-07 11:38:00 -05:00
|
|
|
writefile(bdst.String(), dst, 0)
|
2013-12-17 21:44:18 -05:00
|
|
|
}
|
|
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// buildorder records the order of builds for the 'go bootstrap' command.
|
2015-01-19 12:57:35 -05:00
|
|
|
// The Go packages and commands must be in dependency order,
|
|
|
|
|
// maintained by hand, but the order doesn't change often.
|
2015-01-07 11:38:00 -05:00
|
|
|
var buildorder = []string{
|
2015-01-19 12:57:35 -05:00
|
|
|
// Go libraries and programs for bootstrap.
|
2014-09-08 00:06:45 -04:00
|
|
|
"runtime",
|
|
|
|
|
"errors",
|
|
|
|
|
"sync/atomic",
|
|
|
|
|
"sync",
|
|
|
|
|
"io",
|
|
|
|
|
"unicode",
|
|
|
|
|
"unicode/utf8",
|
|
|
|
|
"unicode/utf16",
|
|
|
|
|
"bytes",
|
|
|
|
|
"math",
|
|
|
|
|
"strings",
|
|
|
|
|
"strconv",
|
|
|
|
|
"bufio",
|
|
|
|
|
"sort",
|
|
|
|
|
"container/heap",
|
|
|
|
|
"encoding/base64",
|
|
|
|
|
"syscall",
|
|
|
|
|
"time",
|
2015-02-24 02:35:55 -08:00
|
|
|
"internal/syscall/windows",
|
2014-09-08 00:06:45 -04:00
|
|
|
"os",
|
|
|
|
|
"reflect",
|
|
|
|
|
"fmt",
|
|
|
|
|
"encoding",
|
2015-01-19 12:57:35 -05:00
|
|
|
"encoding/binary",
|
2014-09-08 00:06:45 -04:00
|
|
|
"encoding/json",
|
|
|
|
|
"flag",
|
|
|
|
|
"path/filepath",
|
|
|
|
|
"path",
|
|
|
|
|
"io/ioutil",
|
|
|
|
|
"log",
|
|
|
|
|
"regexp/syntax",
|
|
|
|
|
"regexp",
|
|
|
|
|
"go/token",
|
|
|
|
|
"go/scanner",
|
|
|
|
|
"go/ast",
|
|
|
|
|
"go/parser",
|
|
|
|
|
"os/exec",
|
|
|
|
|
"os/signal",
|
|
|
|
|
"net/url",
|
|
|
|
|
"text/template/parse",
|
|
|
|
|
"text/template",
|
|
|
|
|
"go/doc",
|
|
|
|
|
"go/build",
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
"cmd/go",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
|
2012-02-03 18:16:42 -05:00
|
|
|
// cleantab records the directories to clean in 'go clean'.
|
|
|
|
|
// It is bigger than the buildorder because we clean all the
|
|
|
|
|
// compilers but build only the $GOARCH ones.
|
2015-01-07 11:38:00 -05:00
|
|
|
var cleantab = []string{
|
2014-09-08 00:06:45 -04:00
|
|
|
// Commands and C libraries.
|
2012-02-03 18:16:42 -05:00
|
|
|
"cmd/5g",
|
|
|
|
|
"cmd/5l",
|
|
|
|
|
"cmd/6g",
|
|
|
|
|
"cmd/6l",
|
|
|
|
|
"cmd/8g",
|
|
|
|
|
"cmd/8l",
|
2014-08-06 23:59:14 -04:00
|
|
|
"cmd/9g",
|
|
|
|
|
"cmd/9l",
|
2015-01-07 11:38:00 -05:00
|
|
|
"cmd/go",
|
2015-02-28 14:24:28 -05:00
|
|
|
"cmd/old5a",
|
|
|
|
|
"cmd/old6a",
|
|
|
|
|
"cmd/old8a",
|
|
|
|
|
"cmd/old9a",
|
2014-09-08 00:06:45 -04:00
|
|
|
|
|
|
|
|
// Go packages.
|
|
|
|
|
"bufio",
|
|
|
|
|
"bytes",
|
|
|
|
|
"container/heap",
|
|
|
|
|
"encoding",
|
|
|
|
|
"encoding/base64",
|
|
|
|
|
"encoding/json",
|
|
|
|
|
"errors",
|
|
|
|
|
"flag",
|
|
|
|
|
"fmt",
|
|
|
|
|
"go/ast",
|
|
|
|
|
"go/build",
|
|
|
|
|
"go/doc",
|
|
|
|
|
"go/parser",
|
|
|
|
|
"go/scanner",
|
|
|
|
|
"go/token",
|
|
|
|
|
"io",
|
|
|
|
|
"io/ioutil",
|
|
|
|
|
"log",
|
|
|
|
|
"math",
|
|
|
|
|
"net/url",
|
|
|
|
|
"os",
|
|
|
|
|
"os/exec",
|
|
|
|
|
"path",
|
|
|
|
|
"path/filepath",
|
|
|
|
|
"reflect",
|
|
|
|
|
"regexp",
|
|
|
|
|
"regexp/syntax",
|
|
|
|
|
"runtime",
|
|
|
|
|
"sort",
|
|
|
|
|
"strconv",
|
|
|
|
|
"strings",
|
|
|
|
|
"sync",
|
|
|
|
|
"sync/atomic",
|
|
|
|
|
"syscall",
|
|
|
|
|
"text/template",
|
|
|
|
|
"text/template/parse",
|
|
|
|
|
"time",
|
|
|
|
|
"unicode",
|
|
|
|
|
"unicode/utf16",
|
|
|
|
|
"unicode/utf8",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
var runtimegen = []string{
|
2014-12-05 16:24:20 -05:00
|
|
|
"zaexperiment.h",
|
|
|
|
|
"zversion.go",
|
2015-01-07 11:38:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func clean() {
|
|
|
|
|
for _, name := range cleantab {
|
|
|
|
|
path := pathf("%s/src/%s", goroot, name)
|
2012-02-03 18:16:42 -05:00
|
|
|
// Remove generated files.
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, elem := range xreaddir(path) {
|
|
|
|
|
for _, gt := range gentab {
|
|
|
|
|
if strings.HasPrefix(elem, gt.nameprefix) {
|
|
|
|
|
xremove(pathf("%s/%s", path, elem))
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Remove generated binary named for directory.
|
2015-01-07 11:38:00 -05:00
|
|
|
if strings.HasPrefix(name, "cmd/") {
|
|
|
|
|
xremove(pathf("%s/%s", path, name[4:]))
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
// remove runtimegen files.
|
|
|
|
|
path := pathf("%s/src/runtime", goroot)
|
|
|
|
|
for _, elem := range runtimegen {
|
|
|
|
|
xremove(pathf("%s/%s", path, elem))
|
|
|
|
|
}
|
2012-05-04 00:58:48 +08:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
if rebuildall {
|
2012-02-13 22:31:51 -05:00
|
|
|
// Remove object tree.
|
2015-01-07 11:38:00 -05:00
|
|
|
xremoveall(pathf("%s/pkg/obj/%s_%s", goroot, gohostos, gohostarch))
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2012-02-13 22:31:51 -05:00
|
|
|
// Remove installed packages and tools.
|
2015-01-07 11:38:00 -05:00
|
|
|
xremoveall(pathf("%s/pkg/%s_%s", goroot, gohostos, gohostarch))
|
|
|
|
|
xremoveall(pathf("%s/pkg/%s_%s", goroot, goos, goarch))
|
|
|
|
|
xremoveall(tooldir)
|
2012-02-13 22:31:51 -05:00
|
|
|
|
|
|
|
|
// Remove cached version info.
|
2015-01-07 11:38:00 -05:00
|
|
|
xremove(pathf("%s/VERSION.cache", goroot))
|
2012-02-13 22:31:51 -05:00
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* command implementations
|
|
|
|
|
*/
|
|
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
func usage() {
|
|
|
|
|
xprintf("usage: go tool dist [command]\n" +
|
|
|
|
|
"Commands are:\n" +
|
|
|
|
|
"\n" +
|
|
|
|
|
"banner print installation banner\n" +
|
|
|
|
|
"bootstrap rebuild everything\n" +
|
|
|
|
|
"clean deletes all built files\n" +
|
|
|
|
|
"env [-p] print environment (-p: include $PATH)\n" +
|
|
|
|
|
"install [dir] install individual directory\n" +
|
|
|
|
|
"version print Go version\n" +
|
|
|
|
|
"\n" +
|
|
|
|
|
"All commands take -v flags to emit extra information.\n",
|
|
|
|
|
)
|
|
|
|
|
xexit(2)
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The env command prints the default environment.
|
2015-01-07 11:38:00 -05:00
|
|
|
func cmdenv() {
|
|
|
|
|
path := flag.Bool("p", false, "emit updated PATH")
|
|
|
|
|
plan9 := flag.Bool("9", false, "emit plan 9 syntax")
|
|
|
|
|
windows := flag.Bool("w", false, "emit windows syntax")
|
|
|
|
|
xflagparse(0)
|
|
|
|
|
|
|
|
|
|
format := "%s=\"%s\"\n"
|
|
|
|
|
switch {
|
|
|
|
|
case *plan9:
|
|
|
|
|
format = "%s='%s'\n"
|
|
|
|
|
case *windows:
|
|
|
|
|
format = "set %s=%s\r\n"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xprintf(format, "CC", defaultcc)
|
|
|
|
|
xprintf(format, "CC_FOR_TARGET", defaultcctarget)
|
|
|
|
|
xprintf(format, "GOROOT", goroot)
|
|
|
|
|
xprintf(format, "GOBIN", gobin)
|
|
|
|
|
xprintf(format, "GOARCH", goarch)
|
|
|
|
|
xprintf(format, "GOOS", goos)
|
|
|
|
|
xprintf(format, "GOHOSTARCH", gohostarch)
|
|
|
|
|
xprintf(format, "GOHOSTOS", gohostos)
|
|
|
|
|
xprintf(format, "GOTOOLDIR", tooldir)
|
|
|
|
|
xprintf(format, "GOCHAR", gochar)
|
|
|
|
|
if goarch == "arm" {
|
|
|
|
|
xprintf(format, "GOARM", goarm)
|
|
|
|
|
}
|
|
|
|
|
if goarch == "386" {
|
|
|
|
|
xprintf(format, "GO386", go386)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if *path {
|
|
|
|
|
sep := ":"
|
|
|
|
|
if gohostos == "windows" {
|
|
|
|
|
sep = ";"
|
|
|
|
|
}
|
|
|
|
|
xprintf(format, "PATH", fmt.Sprintf("%s%s%s", gobin, sep, os.Getenv("PATH")))
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// The bootstrap command runs a build from scratch,
|
|
|
|
|
// stopping at having installed the go_bootstrap command.
|
2015-01-07 11:38:00 -05:00
|
|
|
func cmdbootstrap() {
|
|
|
|
|
flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
|
|
|
|
|
flag.BoolVar(&sflag, "s", sflag, "build static binaries")
|
|
|
|
|
xflagparse(0)
|
|
|
|
|
|
|
|
|
|
if isdir(pathf("%s/src/pkg", goroot)) {
|
|
|
|
|
fatal("\n\n"+
|
|
|
|
|
"The Go package sources have moved to $GOROOT/src.\n"+
|
|
|
|
|
"*** %s still exists. ***\n"+
|
|
|
|
|
"It probably contains stale files that may confuse the build.\n"+
|
|
|
|
|
"Please (check what's there and) remove it and try again.\n"+
|
|
|
|
|
"See http://golang.org/s/go14nopkg\n",
|
|
|
|
|
pathf("%s/src/pkg", goroot))
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
if rebuildall {
|
|
|
|
|
clean()
|
2014-09-08 00:06:45 -04:00
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
setup()
|
2012-03-05 16:13:33 -05:00
|
|
|
|
2015-01-19 12:57:35 -05:00
|
|
|
bootstrapBuildTools()
|
|
|
|
|
|
2012-02-13 22:31:51 -05:00
|
|
|
// For the main bootstrap, building for host os/arch.
|
2015-01-07 11:38:00 -05:00
|
|
|
oldgoos = goos
|
|
|
|
|
oldgoarch = goarch
|
|
|
|
|
oldgochar = gochar
|
|
|
|
|
goos = gohostos
|
|
|
|
|
goarch = gohostarch
|
|
|
|
|
gochar = gohostchar
|
|
|
|
|
os.Setenv("GOHOSTARCH", gohostarch)
|
|
|
|
|
os.Setenv("GOHOSTOS", gohostos)
|
|
|
|
|
os.Setenv("GOARCH", goarch)
|
|
|
|
|
os.Setenv("GOOS", goos)
|
|
|
|
|
|
2015-01-19 12:57:35 -05:00
|
|
|
// TODO(rsc): Enable when appropriate.
|
|
|
|
|
// This step is only needed if we believe that the Go compiler built from Go 1.4
|
|
|
|
|
// will produce different object files than the Go compiler built from itself.
|
|
|
|
|
// In the absence of bugs, that should not happen.
|
|
|
|
|
// And if there are bugs, they're more likely in the current development tree
|
|
|
|
|
// than in a standard release like Go 1.4, so don't do this rebuild by default.
|
|
|
|
|
if false {
|
|
|
|
|
xprintf("##### Building Go toolchain using itself.\n")
|
|
|
|
|
for _, pattern := range buildorder {
|
|
|
|
|
if pattern == "cmd/go" {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
dir := pattern
|
|
|
|
|
if strings.Contains(pattern, "%s") {
|
|
|
|
|
dir = fmt.Sprintf(pattern, gohostchar)
|
|
|
|
|
}
|
|
|
|
|
install(dir)
|
|
|
|
|
if oldgochar != gohostchar && strings.Contains(pattern, "%s") {
|
|
|
|
|
install(fmt.Sprintf(pattern, oldgochar))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
xprintf("\n")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xprintf("##### Building compilers and go_bootstrap for host, %s/%s.\n", gohostos, gohostarch)
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, pattern := range buildorder {
|
|
|
|
|
dir := pattern
|
|
|
|
|
if strings.Contains(pattern, "%s") {
|
|
|
|
|
dir = fmt.Sprintf(pattern, gohostchar)
|
|
|
|
|
}
|
|
|
|
|
install(dir)
|
|
|
|
|
if oldgochar != gohostchar && strings.Contains(pattern, "%s") {
|
|
|
|
|
install(fmt.Sprintf(pattern, oldgochar))
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-13 22:31:51 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
goos = oldgoos
|
|
|
|
|
goarch = oldgoarch
|
|
|
|
|
gochar = oldgochar
|
|
|
|
|
os.Setenv("GOARCH", goarch)
|
|
|
|
|
os.Setenv("GOOS", goos)
|
2012-02-13 22:31:51 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
// Build runtime for actual goos/goarch too.
|
|
|
|
|
if goos != gohostos || goarch != gohostarch {
|
|
|
|
|
install("runtime")
|
|
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
|
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
func defaulttarg() string {
|
2012-02-17 11:29:34 -05:00
|
|
|
// xgetwd might return a path with symlinks fully resolved, and if
|
|
|
|
|
// there happens to be symlinks in goroot, then the hasprefix test
|
|
|
|
|
// will never succeed. Instead, we use xrealwd to get a canonical
|
|
|
|
|
// goroot/src before the comparison to avoid this problem.
|
2015-01-07 11:38:00 -05:00
|
|
|
pwd := xgetwd()
|
|
|
|
|
src := pathf("%s/src/", goroot)
|
|
|
|
|
real_src := xrealwd(src)
|
|
|
|
|
if !strings.HasPrefix(pwd, real_src) {
|
|
|
|
|
fatal("current directory %s is not under %s", pwd, real_src)
|
|
|
|
|
}
|
|
|
|
|
pwd = pwd[len(real_src):]
|
2012-02-17 11:29:34 -05:00
|
|
|
// guard againt xrealwd return the directory without the trailing /
|
2015-01-07 11:38:00 -05:00
|
|
|
pwd = strings.TrimPrefix(pwd, "/")
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
return pwd
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
// Install installs the list of packages named on the command line.
|
2015-01-07 11:38:00 -05:00
|
|
|
func cmdinstall() {
|
|
|
|
|
flag.BoolVar(&sflag, "s", sflag, "build static binaries")
|
|
|
|
|
xflagparse(-1)
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
if flag.NArg() == 0 {
|
|
|
|
|
install(defaulttarg())
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
for _, arg := range flag.Args() {
|
|
|
|
|
install(arg)
|
|
|
|
|
}
|
cmd/dist: new command
dist is short for distribution. This is the new Go distribution tool.
The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.
It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.
This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap). I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.
This tool is not nearly as nice as the go tool. There are many
special cases that turn into simple if statements or tables in
the code. Please forgive that. C does not enjoy the benefits
that we designed into Go.
I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments. Make thinks it is invoking
quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c
but bash (quietgcc is a bash script) thinks it is being invoked as
quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c
which obviously does not have the desired effect. Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.
It is big for a single CL, and for that I apologize. I can cut it into
separate CLs along file boundaries if people would prefer that.
R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality, hcwfrichter
CC=golang-dev
https://golang.org/cl/5620045
2012-02-02 19:41:39 -05:00
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
|
|
|
|
|
// Clean deletes temporary objects.
|
2015-01-07 11:38:00 -05:00
|
|
|
func cmdclean() {
|
|
|
|
|
xflagparse(0)
|
|
|
|
|
clean()
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Banner prints the 'now you've installed Go' banner.
|
2015-01-07 11:38:00 -05:00
|
|
|
func cmdbanner() {
|
|
|
|
|
xflagparse(0)
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
xprintf("\n")
|
|
|
|
|
xprintf("---\n")
|
|
|
|
|
xprintf("Installed Go for %s/%s in %s\n", goos, goarch, goroot)
|
|
|
|
|
xprintf("Installed commands in %s\n", gobin)
|
2012-02-03 18:16:42 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
if !xsamefile(goroot_final, goroot) {
|
2013-09-04 17:02:08 -07:00
|
|
|
// If the files are to be moved, don't check that gobin
|
|
|
|
|
// is on PATH; assume they know what they are doing.
|
2015-01-07 11:38:00 -05:00
|
|
|
} else if gohostos == "plan9" {
|
2013-03-15 05:04:19 +01:00
|
|
|
// Check that gobin is bound before /bin.
|
2015-01-07 11:38:00 -05:00
|
|
|
pid := strings.Replace(readfile("#c/pid"), " ", "", -1)
|
|
|
|
|
ns := fmt.Sprintf("/proc/%s/ns", pid)
|
|
|
|
|
if !strings.Contains(readfile(ns), fmt.Sprintf("bind -b %s /bin", gobin)) {
|
|
|
|
|
xprintf("*** You need to bind %s before /bin.\n", gobin)
|
|
|
|
|
}
|
2013-03-15 05:04:19 +01:00
|
|
|
} else {
|
|
|
|
|
// Check that gobin appears in $PATH.
|
2015-01-07 11:38:00 -05:00
|
|
|
pathsep := ":"
|
|
|
|
|
if gohostos == "windows" {
|
|
|
|
|
pathsep = ";"
|
|
|
|
|
}
|
|
|
|
|
if !strings.Contains(pathsep+os.Getenv("PATH")+pathsep, pathsep+gobin+pathsep) {
|
|
|
|
|
xprintf("*** You need to add %s to your PATH.\n", gobin)
|
|
|
|
|
}
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
2012-02-28 16:18:24 -05:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
if !xsamefile(goroot_final, goroot) {
|
|
|
|
|
xprintf("\n"+
|
2012-02-03 18:16:42 -05:00
|
|
|
"The binaries expect %s to be copied or moved to %s\n",
|
2015-01-07 11:38:00 -05:00
|
|
|
goroot, goroot_final)
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Version prints the Go version.
|
2015-01-07 11:38:00 -05:00
|
|
|
func cmdversion() {
|
|
|
|
|
xflagparse(0)
|
2015-02-10 23:51:25 -05:00
|
|
|
xprintf("%s\n", findgoversion())
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|