mirror of
https://github.com/golang/go
synced 2024-11-17 22:34:47 -07:00
cmd/dist: produce intermedate .a files in a temporary location
Before this change, the .a files for the intermediate go toolchains were produced in the same location as the install target. This change has them produced in a temporary location instead. This change, combined with go install not producing .a files for most stdlib packages by default results in a build of the distribution only producing .a's for the five packages in std that require cgo. (Before this change, the .a's for the final build were not being produced, but stale ones from the intermediate builds were left behind.) For #47257 Change-Id: I91b826cd1ce9aad9c492fb865e36d34dc8bb188e Reviewed-on: https://go-review.googlesource.com/c/go/+/436135 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
0156b797e6
commit
7f255ba065
13
src/cmd/dist/build.go
vendored
13
src/cmd/dist/build.go
vendored
@ -488,6 +488,16 @@ func setup() {
|
|||||||
xmkdirall(p)
|
xmkdirall(p)
|
||||||
xatexit(func() { xremoveall(p) })
|
xatexit(func() { xremoveall(p) })
|
||||||
|
|
||||||
|
// Create alternate driectory for intermediate
|
||||||
|
// standard library .a's to be placed rather than
|
||||||
|
// the final build's install locations.
|
||||||
|
p = pathf("%s/pkg/obj/go-bootstrap", goroot)
|
||||||
|
if rebuildall {
|
||||||
|
xremoveall(p)
|
||||||
|
}
|
||||||
|
xmkdirall(p)
|
||||||
|
xatexit(func() { xremoveall(p) })
|
||||||
|
|
||||||
// Create tool directory.
|
// Create tool directory.
|
||||||
// We keep it in pkg/, just like the object directory above.
|
// We keep it in pkg/, just like the object directory above.
|
||||||
if rebuildall {
|
if rebuildall {
|
||||||
@ -651,6 +661,7 @@ func runInstall(pkg string, ch chan struct{}) {
|
|||||||
link = append(link, goldflags)
|
link = append(link, goldflags)
|
||||||
}
|
}
|
||||||
link = append(link, "-extld="+compilerEnvLookup(defaultcc, goos, goarch))
|
link = append(link, "-extld="+compilerEnvLookup(defaultcc, goos, goarch))
|
||||||
|
link = append(link, "-L="+pathf("%s/pkg/obj/go-bootstrap/%s_%s", goroot, goos, goarch))
|
||||||
link = append(link, "-o", pathf("%s/%s%s", tooldir, elem, exe))
|
link = append(link, "-o", pathf("%s/%s%s", tooldir, elem, exe))
|
||||||
targ = len(link) - 1
|
targ = len(link) - 1
|
||||||
}
|
}
|
||||||
@ -934,7 +945,7 @@ func runInstall(pkg string, ch chan struct{}) {
|
|||||||
// packagefile returns the path to a compiled .a file for the given package
|
// packagefile returns the path to a compiled .a file for the given package
|
||||||
// path. Paths may need to be resolved with resolveVendor first.
|
// path. Paths may need to be resolved with resolveVendor first.
|
||||||
func packagefile(pkg string) string {
|
func packagefile(pkg string) string {
|
||||||
return pathf("%s/pkg/%s_%s/%s.a", goroot, goos, goarch, pkg)
|
return pathf("%s/pkg/obj/go-bootstrap/%s_%s/%s.a", goroot, goos, goarch, pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// unixOS is the set of GOOS values matched by the "unix" build tag.
|
// unixOS is the set of GOOS values matched by the "unix" build tag.
|
||||||
|
Loading…
Reference in New Issue
Block a user