Commit b66a2948 authored by Russ Cox's avatar Russ Cox

cmd/dist: set GOCACHE during make.bash/run.bash

Use a build cache separate from the default user cache,
one that will be wiped out during startup, so that make.bash
continues to start from a clean slate.

Change-Id: I38733991015c66efb89fc170c71701b1dd9de28d
Reviewed-on: https://go-review.googlesource.com/75291
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent 21e6612d
...@@ -226,6 +226,11 @@ func xinit() { ...@@ -226,6 +226,11 @@ func xinit() {
os.Setenv("GOROOT", goroot) os.Setenv("GOROOT", goroot)
os.Setenv("GOROOT_FINAL", goroot_final) os.Setenv("GOROOT_FINAL", goroot_final)
// Use a build cache separate from the default user one.
// Also one that will be wiped out during startup, so that
// make.bash really does start from a clean slate.
os.Setenv("GOCACHE", pathf("%s/pkg/obj/go-build", goroot))
// Make the environment more predictable. // Make the environment more predictable.
os.Setenv("LANG", "C") os.Setenv("LANG", "C")
os.Setenv("LANGUAGE", "en_US.UTF8") os.Setenv("LANGUAGE", "en_US.UTF8")
...@@ -428,14 +433,10 @@ func setup() { ...@@ -428,14 +433,10 @@ func setup() {
} }
// Create object directory. // Create object directory.
// We keep it in pkg/ so that all the generated binaries // We used to use it for C objects.
// are in one tree. If pkg/obj/libgc.a exists, it is a dreg from // Now we use it for the build cache, to separate dist's cache
// before we used subdirectories of obj. Delete all of obj // from any other cache the user might have.
// to clean up. p = pathf("%s/pkg/obj/go-build", goroot)
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 { if rebuildall {
xremoveall(p) xremoveall(p)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment