fmt.Fprintf(timeLogFile, "%s %+.1fs %s %s\n", t.Format(time.UnixDate), t.Sub(timeLogStart).Seconds(), op, name)
}
+var toolchain = []string{"cmd/asm", "cmd/cgo", "cmd/compile", "cmd/link"}
+
// The bootstrap command runs a build from scratch,
// stopping at having installed the go_bootstrap command.
//
// chosen $CC_FOR_TARGET in this case.
os.Setenv("CC", defaultcctarget)
}
- toolchain := []string{"cmd/asm", "cmd/cgo", "cmd/compile", "cmd/link", "cmd/buildid"}
- goInstall(toolchain...)
+ goInstall(goBootstrap, toolchain...)
if debug {
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
xprintf("\n")
}
xprintf("Building Go toolchain3 using go_bootstrap and Go toolchain2.\n")
- goInstall(append([]string{"-a"}, toolchain...)...)
+ goInstall(goBootstrap, append([]string{"-a"}, toolchain...)...)
if debug {
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
xprintf("\n")
}
xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
- goInstall("std", "cmd")
+ goInstall(goBootstrap, "std", "cmd")
checkNotStale(goBootstrap, "std", "cmd")
checkNotStale(cmdGo, "std", "cmd")
os.Setenv("CC", defaultcctarget)
xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
}
- goInstall("std", "cmd")
+ goInstall(goBootstrap, "std", "cmd")
checkNotStale(goBootstrap, "std", "cmd")
checkNotStale(cmdGo, "std", "cmd")
if debug {
}
}
-func goInstall(args ...string) {
- installCmd := []string{pathf("%s/go_bootstrap", tooldir), "install", "-gcflags=" + gogcflags, "-ldflags=" + goldflags}
+func goInstall(goBinary string, args ...string) {
+ installCmd := []string{goBinary, "install", "-gcflags=" + gogcflags, "-ldflags=" + goldflags}
if vflag > 0 {
installCmd = append(installCmd, "-v")
}
if t.rebuild {
t.out("Building packages and commands.")
- cmd := exec.Command("go", "install", "-a", "-v", "std", "cmd")
- cmd.Stdout = os.Stdout
- cmd.Stderr = os.Stderr
- if err := cmd.Run(); err != nil {
- log.Fatalf("building packages and commands: %v", err)
- }
+ // Rebuilding is a shortened bootstrap.
+ // See cmdbootstrap for a description of the overall process.
+ goInstall("go", toolchain...)
+ goInstall("go", toolchain...)
+ goInstall("go", "std", "cmd")
+ checkNotStale("go", "std", "cmd")
}
if t.iOS() {