]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/dist/buildruntime.go
[dev.cc] liblink, cmd/internal/obj: fix printing of TYPE_REGREG and TYPE_REGREG2
[gostls13.git] / src / cmd / dist / buildruntime.go
1 // Copyright 2012 The Go Authors.  All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package main
6
7 import (
8         "fmt"
9         "os"
10 )
11
12 /*
13  * Helpers for building runtime.
14  */
15
16 // mkzversion writes zversion.go:
17 //
18 //      package runtime
19 //      const defaultGoroot = <goroot>
20 //      const theVersion = <version>
21 //
22 func mkzversion(dir, file string) {
23         out := fmt.Sprintf(
24                 "// auto generated by go tool dist\n"+
25                         "\n"+
26                         "package runtime\n"+
27                         "\n"+
28                         "const defaultGoroot = `%s`\n"+
29                         "const theVersion = `%s`\n"+
30                         "const goexperiment = `%s`\n"+
31                         "var buildVersion = theVersion\n", goroot_final, goversion, os.Getenv("GOEXPERIMENT"))
32
33         writefile(out, file, 0)
34 }
35
36 // mkzbootstrap writes cmd/internal/obj/zbootstrap.go:
37 //
38 //      package obj
39 //
40 //      const defaultGOROOT = <goroot>
41 //      const defaultGOARM = <goarm>
42 //      const defaultGOOS = <goos>
43 //      const defaultGOARCH = <goarch>
44 //      const version = <version>
45 //      const goexperiment = <goexperiment>
46 //
47 func mkzbootstrap(file string) {
48         out := fmt.Sprintf(
49                 "// auto generated by go tool dist\n"+
50                         "\n"+
51                         "package obj\n"+
52                         "\n"+
53                         "const defaultGOROOT = `%s`\n"+
54                         "const defaultGOARM = `%s`\n"+
55                         "const defaultGOOS = `%s`\n"+
56                         "const defaultGOARCH = `%s`\n"+
57                         "const version = `%s`\n"+
58                         "const goexperiment = `%s`\n",
59                 goroot_final, goarm, gohostos, gohostarch, goversion, os.Getenv("GOEXPERIMENT"))
60
61         writefile(out, file, 0)
62 }