2012-02-03 18:16:42 -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
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
2012-02-03 18:16:42 -05:00
|
|
|
|
|
|
|
|
/*
|
2014-09-08 00:06:45 -04:00
|
|
|
* Helpers for building runtime.
|
2012-02-03 18:16:42 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// mkzversion writes zversion.go:
|
|
|
|
|
//
|
|
|
|
|
// package runtime
|
|
|
|
|
// const defaultGoroot = <goroot>
|
|
|
|
|
// const theVersion = <version>
|
|
|
|
|
//
|
2015-01-07 11:38:00 -05:00
|
|
|
func mkzversion(dir, file string) {
|
|
|
|
|
out := fmt.Sprintf(
|
|
|
|
|
"// auto generated by go tool dist\n"+
|
|
|
|
|
"\n"+
|
|
|
|
|
"package runtime\n"+
|
|
|
|
|
"\n"+
|
|
|
|
|
"const defaultGoroot = `%s`\n"+
|
|
|
|
|
"const theVersion = `%s`\n"+
|
2015-01-18 16:04:47 -08:00
|
|
|
"\n"+
|
2015-01-07 11:38:00 -05:00
|
|
|
"var buildVersion = theVersion\n", goroot_final, goversion)
|
|
|
|
|
|
|
|
|
|
writefile(out, file, 0)
|
2012-02-03 18:16:42 -05:00
|
|
|
}
|
|
|
|
|
|
2013-09-16 20:26:10 -04:00
|
|
|
// mkzexperiment writes zaexperiment.h (sic):
|
|
|
|
|
//
|
|
|
|
|
// #define GOEXPERIMENT "experiment string"
|
|
|
|
|
//
|
2015-01-07 11:38:00 -05:00
|
|
|
func mkzexperiment(dir, file string) {
|
|
|
|
|
out := fmt.Sprintf(
|
|
|
|
|
"// auto generated by go tool dist\n"+
|
|
|
|
|
"\n"+
|
|
|
|
|
"#define GOEXPERIMENT \"%s\"\n", os.Getenv("GOEXPERIMENT"))
|
2013-09-16 20:26:10 -04:00
|
|
|
|
2015-01-07 11:38:00 -05:00
|
|
|
writefile(out, file, 0)
|
2013-09-16 20:26:10 -04:00
|
|
|
}
|
2015-01-21 12:09:20 -05:00
|
|
|
|
|
|
|
|
// mkzbootstrap writes cmd/internal/obj/zbootstrap.go:
|
|
|
|
|
//
|
|
|
|
|
// package obj
|
|
|
|
|
//
|
|
|
|
|
// const defaultGOROOT = <goroot>
|
|
|
|
|
// const defaultGOARM = <goarm>
|
|
|
|
|
// const defaultGOOS = <goos>
|
|
|
|
|
// const defaultGOARCH = <goarch>
|
|
|
|
|
// const version = <version>
|
|
|
|
|
// const goexperiment = <goexperiment>
|
|
|
|
|
//
|
|
|
|
|
func mkzbootstrap(file string) {
|
|
|
|
|
out := fmt.Sprintf(
|
|
|
|
|
"// auto generated by go tool dist\n"+
|
|
|
|
|
"\n"+
|
|
|
|
|
"package obj\n"+
|
|
|
|
|
"\n"+
|
|
|
|
|
"const defaultGOROOT = `%s`\n"+
|
|
|
|
|
"const defaultGOARM = `%s`\n"+
|
|
|
|
|
"const defaultGOOS = `%s`\n"+
|
|
|
|
|
"const defaultGOARCH = `%s`\n"+
|
|
|
|
|
"const version = `%s`\n"+
|
|
|
|
|
"const goexperiment = `%s`\n",
|
|
|
|
|
goroot_final, goarm, gohostos, gohostarch, goversion, os.Getenv("GOEXPERIMENT"))
|
|
|
|
|
|
|
|
|
|
writefile(out, file, 0)
|
|
|
|
|
}
|