2012-02-03 16:16:42 -07: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 09:38:00 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
2012-02-03 16:16:42 -07:00
|
|
|
|
|
|
|
/*
|
2014-09-07 22:06:45 -06:00
|
|
|
* Helpers for building runtime.
|
2012-02-03 16:16:42 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
// mkzversion writes zversion.go:
|
|
|
|
//
|
|
|
|
// package runtime
|
|
|
|
// const defaultGoroot = <goroot>
|
|
|
|
// const theVersion = <version>
|
|
|
|
//
|
2015-01-07 09:38:00 -07: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-16 17:22:58 -07:00
|
|
|
"const goexperiment = `%s`\n"+
|
2015-02-10 21:51:25 -07:00
|
|
|
"var buildVersion = theVersion\n", goroot_final, findgoversion(), os.Getenv("GOEXPERIMENT"))
|
2013-09-16 18:26:10 -06:00
|
|
|
|
2015-01-07 09:38:00 -07:00
|
|
|
writefile(out, file, 0)
|
2013-09-16 18:26:10 -06:00
|
|
|
}
|
2015-01-21 10:09:20 -07:00
|
|
|
|
|
|
|
// mkzbootstrap writes cmd/internal/obj/zbootstrap.go:
|
|
|
|
//
|
|
|
|
// package obj
|
|
|
|
//
|
|
|
|
// const defaultGOROOT = <goroot>
|
2015-02-06 03:57:42 -07:00
|
|
|
// const defaultGO386 = <go386>
|
2015-01-21 10:09:20 -07:00
|
|
|
// 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"+
|
2015-02-06 03:57:42 -07:00
|
|
|
"const defaultGO386 = `%s`\n"+
|
2015-01-21 10:09:20 -07:00
|
|
|
"const defaultGOARM = `%s`\n"+
|
|
|
|
"const defaultGOOS = `%s`\n"+
|
|
|
|
"const defaultGOARCH = `%s`\n"+
|
|
|
|
"const version = `%s`\n"+
|
|
|
|
"const goexperiment = `%s`\n",
|
2015-02-06 03:57:42 -07:00
|
|
|
goroot_final, go386, goarm, gohostos, gohostarch, findgoversion(), os.Getenv("GOEXPERIMENT"))
|
2015-01-21 10:09:20 -07:00
|
|
|
|
|
|
|
writefile(out, file, 0)
|
|
|
|
}
|