summaryrefslogtreecommitdiffstats
path: root/recipes-containers/kubernetes
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-01-09 17:20:50 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-01-09 17:21:12 +0000
commitb4c43fd51fa8fe02e0c72005bd31e281a199788f (patch)
tree0e9d512cd1711404f33c1a20647c3b681be06aaf /recipes-containers/kubernetes
parente54873b8b1c86973f7ce67683546dfa6c43eda85 (diff)
downloadmeta-virtualization-b4c43fd51fa8fe02e0c72005bd31e281a199788f.tar.gz
Revert "go: add back 1.12 version to avoid compilation failure"
This reverts commit 06dad20a32c81b6a8b6e93c99cda6f1133abddc6.
Diffstat (limited to 'recipes-containers/kubernetes')
-rw-r--r--recipes-containers/kubernetes/go-1.12.inc24
-rw-r--r--recipes-containers/kubernetes/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch31
-rw-r--r--recipes-containers/kubernetes/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch163
-rw-r--r--recipes-containers/kubernetes/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch218
-rw-r--r--recipes-containers/kubernetes/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch48
-rw-r--r--recipes-containers/kubernetes/go-1.12/0004-ld-add-soname-to-shareable-objects.patch45
-rw-r--r--recipes-containers/kubernetes/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch37
-rw-r--r--recipes-containers/kubernetes/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch282
-rw-r--r--recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch106
-rw-r--r--recipes-containers/kubernetes/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch37
-rw-r--r--recipes-containers/kubernetes/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch112
-rw-r--r--recipes-containers/kubernetes/go-common.inc32
-rw-r--r--recipes-containers/kubernetes/go-cross-canadian.inc66
-rw-r--r--recipes-containers/kubernetes/go-cross-canadian_1.12.bb2
-rw-r--r--recipes-containers/kubernetes/go-cross.inc62
-rw-r--r--recipes-containers/kubernetes/go-cross_1.12.bb2
-rw-r--r--recipes-containers/kubernetes/go-crosssdk.inc50
-rw-r--r--recipes-containers/kubernetes/go-crosssdk_1.12.bb2
-rw-r--r--recipes-containers/kubernetes/go-native.inc55
-rw-r--r--recipes-containers/kubernetes/go-native_1.12.bb2
-rw-r--r--recipes-containers/kubernetes/go-runtime.inc96
-rw-r--r--recipes-containers/kubernetes/go-runtime_1.12.bb2
-rw-r--r--recipes-containers/kubernetes/go-target.inc54
-rw-r--r--recipes-containers/kubernetes/go_1.12.bb14
24 files changed, 0 insertions, 1542 deletions
diff --git a/recipes-containers/kubernetes/go-1.12.inc b/recipes-containers/kubernetes/go-1.12.inc
deleted file mode 100644
index ed14b175..00000000
--- a/recipes-containers/kubernetes/go-1.12.inc
+++ /dev/null
@@ -1,24 +0,0 @@
1require go-common.inc
2
3GO_BASEVERSION = "1.12"
4GO_MINOR = ".9"
5PV .= "${GO_MINOR}"
6FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
7
8LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
9
10SRC_URI += "\
11 file://0001-allow-CC-and-CXX-to-have-multiple-words.patch \
12 file://0002-cmd-go-make-content-based-hash-generation-less-pedan.patch \
13 file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \
14 file://0004-ld-add-soname-to-shareable-objects.patch \
15 file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \
16 file://0006-cmd-dist-separate-host-and-target-builds.patch \
17 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
18 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
19 file://0001-release-branch.go1.12-security-net-textproto-don-t-n.patch \
20"
21SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
22
23SRC_URI[main.md5sum] = "6132109d4050da349eadc9f7b0304ef4"
24SRC_URI[main.sha256sum] = "ab0e56ed9c4732a653ed22e232652709afbf573e710f56a07f7fdeca578d62fc"
diff --git a/recipes-containers/kubernetes/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch b/recipes-containers/kubernetes/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch
deleted file mode 100644
index 4442858c..00000000
--- a/recipes-containers/kubernetes/go-1.12/0001-allow-CC-and-CXX-to-have-multiple-words.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 7cc519aa5f84cf8fc7ac8c10fc69aa8040330ea0 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Mon, 19 Feb 2018 08:49:33 -0800
4Subject: [PATCH] allow CC and CXX to have multiple words
5
6Upstream-Status: Inappropriate [OE specific]
7
8Signed-off-by: Matt Madison <matt@madison.systems>
9
10---
11 src/cmd/go/internal/envcmd/env.go | 4 ++--
12 1 file changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
15index afadbad..cedbfbf 100644
16--- a/src/cmd/go/internal/envcmd/env.go
17+++ b/src/cmd/go/internal/envcmd/env.go
18@@ -85,11 +85,11 @@ func MkEnv() []cfg.EnvVar {
19
20 cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
21 if env := strings.Fields(os.Getenv("CC")); len(env) > 0 {
22- cc = env[0]
23+ cc = strings.Join(env, " ")
24 }
25 cxx := cfg.DefaultCXX(cfg.Goos, cfg.Goarch)
26 if env := strings.Fields(os.Getenv("CXX")); len(env) > 0 {
27- cxx = env[0]
28+ cxx = strings.Join(env, " ")
29 }
30 env = append(env, cfg.EnvVar{Name: "CC", Value: cc})
31 env = append(env, cfg.EnvVar{Name: "CXX", Value: cxx})
diff --git a/recipes-containers/kubernetes/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch b/recipes-containers/kubernetes/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch
deleted file mode 100644
index 7b39dbd7..00000000
--- a/recipes-containers/kubernetes/go-1.12/0001-release-branch.go1.12-security-net-textproto-don-t-n.patch
+++ /dev/null
@@ -1,163 +0,0 @@
1From 265b691ac440bfb711d8de323346f7d72e620efe Mon Sep 17 00:00:00 2001
2From: Filippo Valsorda <filippo@golang.org>
3Date: Thu, 12 Sep 2019 12:37:36 -0400
4Subject: [PATCH] [release-branch.go1.12-security] net/textproto: don't
5 normalize headers with spaces before the colon
6
7RFC 7230 is clear about headers with a space before the colon, like
8
9X-Answer : 42
10
11being invalid, but we've been accepting and normalizing them for compatibility
12purposes since CL 5690059 in 2012.
13
14On the client side, this is harmless and indeed most browsers behave the same
15to this day. On the server side, this becomes a security issue when the
16behavior doesn't match that of a reverse proxy sitting in front of the server.
17
18For example, if a WAF accepts them without normalizing them, it might be
19possible to bypass its filters, because the Go server would interpret the
20header differently. Worse, if the reverse proxy coalesces requests onto a
21single HTTP/1.1 connection to a Go server, the understanding of the request
22boundaries can get out of sync between them, allowing an attacker to tack an
23arbitrary method and path onto a request by other clients, including
24authentication headers unknown to the attacker.
25
26This was recently presented at multiple security conferences:
27https://portswigger.net/blog/http-desync-attacks-request-smuggling-reborn
28
29net/http servers already reject header keys with invalid characters.
30Simply stop normalizing extra spaces in net/textproto, let it return them
31unchanged like it does for other invalid headers, and let net/http enforce
32RFC 7230, which is HTTP specific. This loses us normalization on the client
33side, but there's no right answer on the client side anyway, and hiding the
34issue sounds worse than letting the application decide.
35
36Fixes CVE-2019-16276
37
38Change-Id: I6d272de827e0870da85d93df770d6a0e161bbcf1
39Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/549719
40Reviewed-by: Brad Fitzpatrick <bradfitz@google.com>
41(cherry picked from commit 1280b868e82bf173ea3e988be3092d160ee66082)
42Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/558776
43Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
44
45CVE: CVE-2019-16276
46
47Upstream-Status: Backport [https://github.com/golang/go/commit/6e6f4aaf70c8b1cc81e65a26332aa9409de03ad8]
48
49Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
50---
51 src/net/http/serve_test.go | 4 ++++
52 src/net/http/transport_test.go | 27 +++++++++++++++++++++++++++
53 src/net/textproto/reader.go | 10 ++--------
54 src/net/textproto/reader_test.go | 13 ++++++-------
55 4 files changed, 39 insertions(+), 15 deletions(-)
56
57diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go
58index 6eb0088a96..89bfdfbb82 100644
59--- a/src/net/http/serve_test.go
60+++ b/src/net/http/serve_test.go
61@@ -4748,6 +4748,10 @@ func TestServerValidatesHeaders(t *testing.T) {
62 {"foo\xffbar: foo\r\n", 400}, // binary in header
63 {"foo\x00bar: foo\r\n", 400}, // binary in header
64 {"Foo: " + strings.Repeat("x", 1<<21) + "\r\n", 431}, // header too large
65+ // Spaces between the header key and colon are not allowed.
66+ // See RFC 7230, Section 3.2.4.
67+ {"Foo : bar\r\n", 400},
68+ {"Foo\t: bar\r\n", 400},
69
70 {"foo: foo foo\r\n", 200}, // LWS space is okay
71 {"foo: foo\tfoo\r\n", 200}, // LWS tab is okay
72diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go
73index 5c329543e2..5e5438a708 100644
74--- a/src/net/http/transport_test.go
75+++ b/src/net/http/transport_test.go
76@@ -5133,3 +5133,30 @@ func TestTransportIgnores408(t *testing.T) {
77 }
78 t.Fatalf("timeout after %v waiting for Transport connections to die off", time.Since(t0))
79 }
80+
81+func TestInvalidHeaderResponse(t *testing.T) {
82+ setParallel(t)
83+ defer afterTest(t)
84+ cst := newClientServerTest(t, h1Mode, HandlerFunc(func(w ResponseWriter, r *Request) {
85+ conn, buf, _ := w.(Hijacker).Hijack()
86+ buf.Write([]byte("HTTP/1.1 200 OK\r\n" +
87+ "Date: Wed, 30 Aug 2017 19:09:27 GMT\r\n" +
88+ "Content-Type: text/html; charset=utf-8\r\n" +
89+ "Content-Length: 0\r\n" +
90+ "Foo : bar\r\n\r\n"))
91+ buf.Flush()
92+ conn.Close()
93+ }))
94+ defer cst.close()
95+ res, err := cst.c.Get(cst.ts.URL)
96+ if err != nil {
97+ t.Fatal(err)
98+ }
99+ defer res.Body.Close()
100+ if v := res.Header.Get("Foo"); v != "" {
101+ t.Errorf(`unexpected "Foo" header: %q`, v)
102+ }
103+ if v := res.Header.Get("Foo "); v != "bar" {
104+ t.Errorf(`bad "Foo " header value: %q, want %q`, v, "bar")
105+ }
106+}
107diff --git a/src/net/textproto/reader.go b/src/net/textproto/reader.go
108index 2c4f25d5ae..1a5e364cf7 100644
109--- a/src/net/textproto/reader.go
110+++ b/src/net/textproto/reader.go
111@@ -493,18 +493,12 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) {
112 return m, err
113 }
114
115- // Key ends at first colon; should not have trailing spaces
116- // but they appear in the wild, violating specs, so we remove
117- // them if present.
118+ // Key ends at first colon.
119 i := bytes.IndexByte(kv, ':')
120 if i < 0 {
121 return m, ProtocolError("malformed MIME header line: " + string(kv))
122 }
123- endKey := i
124- for endKey > 0 && kv[endKey-1] == ' ' {
125- endKey--
126- }
127- key := canonicalMIMEHeaderKey(kv[:endKey])
128+ key := canonicalMIMEHeaderKey(kv[:i])
129
130 // As per RFC 7230 field-name is a token, tokens consist of one or more chars.
131 // We could return a ProtocolError here, but better to be liberal in what we
132diff --git a/src/net/textproto/reader_test.go b/src/net/textproto/reader_test.go
133index f85fbdc36d..b92fdcd3c7 100644
134--- a/src/net/textproto/reader_test.go
135+++ b/src/net/textproto/reader_test.go
136@@ -188,11 +188,10 @@ func TestLargeReadMIMEHeader(t *testing.T) {
137 }
138 }
139
140-// Test that we read slightly-bogus MIME headers seen in the wild,
141-// with spaces before colons, and spaces in keys.
142+// TestReadMIMEHeaderNonCompliant checks that we don't normalize headers
143+// with spaces before colons, and accept spaces in keys.
144 func TestReadMIMEHeaderNonCompliant(t *testing.T) {
145- // Invalid HTTP response header as sent by an Axis security
146- // camera: (this is handled by IE, Firefox, Chrome, curl, etc.)
147+ // These invalid headers will be rejected by net/http according to RFC 7230.
148 r := reader("Foo: bar\r\n" +
149 "Content-Language: en\r\n" +
150 "SID : 0\r\n" +
151@@ -202,9 +201,9 @@ func TestReadMIMEHeaderNonCompliant(t *testing.T) {
152 want := MIMEHeader{
153 "Foo": {"bar"},
154 "Content-Language": {"en"},
155- "Sid": {"0"},
156- "Audio Mode": {"None"},
157- "Privilege": {"127"},
158+ "SID ": {"0"},
159+ "Audio Mode ": {"None"},
160+ "Privilege ": {"127"},
161 }
162 if !reflect.DeepEqual(m, want) || err != nil {
163 t.Fatalf("ReadMIMEHeader =\n%v, %v; want:\n%v", m, err, want)
diff --git a/recipes-containers/kubernetes/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch b/recipes-containers/kubernetes/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
deleted file mode 100644
index 66b85618..00000000
--- a/recipes-containers/kubernetes/go-1.12/0002-cmd-go-make-content-based-hash-generation-less-pedan.patch
+++ /dev/null
@@ -1,218 +0,0 @@
1From 47db69e20ed66fb62b01affd83d829654b829893 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Mon, 19 Feb 2018 08:50:59 -0800
4Subject: [PATCH] cmd/go: make content-based hash generation less pedantic
5
6Go 1.10's build tool now uses content-based hashes to
7determine when something should be built or re-built.
8This same mechanism is used to maintain a built-artifact
9cache for speeding up builds.
10
11However, the hashes it generates include information that
12doesn't work well with OE, nor with using a shared runtime
13library.
14
15First, it embeds path names to source files, unless
16building within GOROOT. This prevents the building
17of a package in GOPATH for later staging into GOROOT.
18
19This patch adds support for the environment variable
20GOPATH_OMIT_IN_ACTIONID. If present, path name
21embedding is disabled.
22
23Second, if cgo is enabled, the build ID for cgo-related
24packages will include the current value of the environment
25variables for invoking the compiler (CC, CXX, FC) and
26any CGO_xxFLAGS variables. Only if the settings used
27during a compilation exactly match, character for character,
28the values used for compiling runtime/cgo or any other
29cgo-enabled package being imported, will the tool
30decide that the imported package is up-to-date.
31
32This is done to help ensure correctness, but is overly
33simplistic and effectively prevents the reuse of built
34artifacts that use cgo (or shared runtime, which includes
35runtime/cgo).
36
37This patch filters out all compiler flags except those
38beginning with '-m'. The default behavior can be restored
39by setting the CGO_PEDANTIC environment variable.
40
41Upstream-Status: Inappropriate [OE specific]
42
43Signed-off-by: Matt Madison <matt@madison.systems>
44
45---
46 src/cmd/go/internal/envcmd/env.go | 2 +-
47 src/cmd/go/internal/work/exec.go | 63 ++++++++++++++++++++++---------
48 2 files changed, 46 insertions(+), 19 deletions(-)
49
50diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
51index cedbfbf..5763a0d 100644
52--- a/src/cmd/go/internal/envcmd/env.go
53+++ b/src/cmd/go/internal/envcmd/env.go
54@@ -128,7 +128,7 @@ func ExtraEnvVars() []cfg.EnvVar {
55 func ExtraEnvVarsCostly() []cfg.EnvVar {
56 var b work.Builder
57 b.Init()
58- cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{})
59+ cppflags, cflags, cxxflags, fflags, ldflags, err := b.CFlags(&load.Package{}, false)
60 if err != nil {
61 // Should not happen - b.CFlags was given an empty package.
62 fmt.Fprintf(os.Stderr, "go: invalid cflags: %v\n", err)
63diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
64index 12e1527..e41bfac 100644
65--- a/src/cmd/go/internal/work/exec.go
66+++ b/src/cmd/go/internal/work/exec.go
67@@ -174,6 +174,8 @@ func (b *Builder) Do(root *Action) {
68 wg.Wait()
69 }
70
71+var omitGopath = os.Getenv("GOPATH_OMIT_IN_ACTIONID") != ""
72+
73 // buildActionID computes the action ID for a build action.
74 func (b *Builder) buildActionID(a *Action) cache.ActionID {
75 p := a.Package
76@@ -190,7 +192,7 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
77 // but it does not hide the exact value of $GOPATH.
78 // Include the full dir in that case.
79 // Assume b.WorkDir is being trimmed properly.
80- if !p.Goroot && !strings.HasPrefix(p.Dir, b.WorkDir) {
81+ if !p.Goroot && !omitGopath && !strings.HasPrefix(p.Dir, b.WorkDir) {
82 fmt.Fprintf(h, "dir %s\n", p.Dir)
83 }
84 fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
85@@ -201,13 +203,13 @@ func (b *Builder) buildActionID(a *Action) cache.ActionID {
86 }
87 if len(p.CgoFiles)+len(p.SwigFiles) > 0 {
88 fmt.Fprintf(h, "cgo %q\n", b.toolID("cgo"))
89- cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p)
90- fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(), cppflags, cflags, ldflags)
91+ cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true)
92+ fmt.Fprintf(h, "CC=%q %q %q %q\n", b.ccExe(true), cppflags, cflags, ldflags)
93 if len(p.CXXFiles)+len(p.SwigFiles) > 0 {
94- fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(), cxxflags)
95+ fmt.Fprintf(h, "CXX=%q %q\n", b.cxxExe(true), cxxflags)
96 }
97 if len(p.FFiles) > 0 {
98- fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(), fflags)
99+ fmt.Fprintf(h, "FC=%q %q\n", b.fcExe(true), fflags)
100 }
101 // TODO(rsc): Should we include the SWIG version or Fortran/GCC/G++/Objective-C compiler versions?
102 }
103@@ -2096,33 +2098,33 @@ var (
104 // gccCmd returns a gcc command line prefix
105 // defaultCC is defined in zdefaultcc.go, written by cmd/dist.
106 func (b *Builder) GccCmd(incdir, workdir string) []string {
107- return b.compilerCmd(b.ccExe(), incdir, workdir)
108+ return b.compilerCmd(b.ccExe(false), incdir, workdir)
109 }
110
111 // gxxCmd returns a g++ command line prefix
112 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
113 func (b *Builder) GxxCmd(incdir, workdir string) []string {
114- return b.compilerCmd(b.cxxExe(), incdir, workdir)
115+ return b.compilerCmd(b.cxxExe(false), incdir, workdir)
116 }
117
118 // gfortranCmd returns a gfortran command line prefix.
119 func (b *Builder) gfortranCmd(incdir, workdir string) []string {
120- return b.compilerCmd(b.fcExe(), incdir, workdir)
121+ return b.compilerCmd(b.fcExe(false), incdir, workdir)
122 }
123
124 // ccExe returns the CC compiler setting without all the extra flags we add implicitly.
125-func (b *Builder) ccExe() []string {
126- return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch))
127+func (b *Builder) ccExe(filtered bool) []string {
128+ return b.compilerExe(origCC, cfg.DefaultCC(cfg.Goos, cfg.Goarch), filtered)
129 }
130
131 // cxxExe returns the CXX compiler setting without all the extra flags we add implicitly.
132-func (b *Builder) cxxExe() []string {
133- return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch))
134+func (b *Builder) cxxExe(filtered bool) []string {
135+ return b.compilerExe(origCXX, cfg.DefaultCXX(cfg.Goos, cfg.Goarch), filtered)
136 }
137
138 // fcExe returns the FC compiler setting without all the extra flags we add implicitly.
139-func (b *Builder) fcExe() []string {
140- return b.compilerExe(os.Getenv("FC"), "gfortran")
141+func (b *Builder) fcExe(filtered bool) []string {
142+ return b.compilerExe(os.Getenv("FC"), "gfortran", filtered)
143 }
144
145 // compilerExe returns the compiler to use given an
146@@ -2131,11 +2133,14 @@ func (b *Builder) fcExe() []string {
147 // of the compiler but can have additional arguments if they
148 // were present in the environment value.
149 // For example if CC="gcc -DGOPHER" then the result is ["gcc", "-DGOPHER"].
150-func (b *Builder) compilerExe(envValue string, def string) []string {
151+func (b *Builder) compilerExe(envValue string, def string, filtered bool) []string {
152 compiler := strings.Fields(envValue)
153 if len(compiler) == 0 {
154 compiler = []string{def}
155 }
156+ if filtered {
157+ return append(compiler[0:1], filterCompilerFlags(compiler[1:])...)
158+ }
159 return compiler
160 }
161
162@@ -2285,8 +2290,23 @@ func envList(key, def string) []string {
163 return strings.Fields(v)
164 }
165
166+var filterFlags = os.Getenv("CGO_PEDANTIC") == ""
167+
168+func filterCompilerFlags(flags []string) []string {
169+ var newflags []string
170+ if !filterFlags {
171+ return flags
172+ }
173+ for _, flag := range flags {
174+ if strings.HasPrefix(flag, "-m") {
175+ newflags = append(newflags, flag)
176+ }
177+ }
178+ return newflags
179+}
180+
181 // CFlags returns the flags to use when invoking the C, C++ or Fortran compilers, or cgo.
182-func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
183+func (b *Builder) CFlags(p *load.Package, filtered bool) (cppflags, cflags, cxxflags, fflags, ldflags []string, err error) {
184 defaults := "-g -O2"
185
186 if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil {
187@@ -2304,6 +2324,13 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l
188 if ldflags, err = buildFlags("LDFLAGS", defaults, p.CgoLDFLAGS, checkLinkerFlags); err != nil {
189 return
190 }
191+ if filtered {
192+ cppflags = filterCompilerFlags(cppflags)
193+ cflags = filterCompilerFlags(cflags)
194+ cxxflags = filterCompilerFlags(cxxflags)
195+ fflags = filterCompilerFlags(fflags)
196+ ldflags = filterCompilerFlags(ldflags)
197+ }
198
199 return
200 }
201@@ -2319,7 +2346,7 @@ var cgoRe = regexp.MustCompile(`[/\\:]`)
202
203 func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) {
204 p := a.Package
205- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p)
206+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoFFLAGS, cgoLDFLAGS, err := b.CFlags(p, false)
207 if err != nil {
208 return nil, nil, err
209 }
210@@ -2679,7 +2706,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) {
211
212 // Run SWIG on one SWIG input file.
213 func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) {
214- cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p)
215+ cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _, _, err := b.CFlags(p, false)
216 if err != nil {
217 return "", "", err
218 }
diff --git a/recipes-containers/kubernetes/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch b/recipes-containers/kubernetes/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
deleted file mode 100644
index b6ca40ed..00000000
--- a/recipes-containers/kubernetes/go-1.12/0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch
+++ /dev/null
@@ -1,48 +0,0 @@
1From 5c32c38bf19b24f0aadd78012d17ff5caa82151e Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 05:24:20 -0800
4Subject: [PATCH] allow GOTOOLDIR to be overridden in the environment
5
6to allow for split host/target build roots
7
8Upstream-Status: Inappropriate [OE specific]
9
10Signed-off-by: Matt Madison <matt@madison.systems>
11
12---
13 src/cmd/dist/build.go | 4 +++-
14 src/cmd/go/internal/cfg/cfg.go | 7 +++++--
15 2 files changed, 8 insertions(+), 3 deletions(-)
16
17Index: go/src/cmd/dist/build.go
18===================================================================
19--- go.orig/src/cmd/dist/build.go
20+++ go/src/cmd/dist/build.go
21@@ -228,7 +228,9 @@ func xinit() {
22 workdir = xworkdir()
23 xatexit(rmworkdir)
24
25- tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
26+ if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
27+ tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
28+ }
29 }
30
31 // compilerEnv returns a map from "goos/goarch" to the
32Index: go/src/cmd/go/internal/cfg/cfg.go
33===================================================================
34--- go.orig/src/cmd/go/internal/cfg/cfg.go
35+++ go/src/cmd/go/internal/cfg/cfg.go
36@@ -116,7 +116,11 @@ func init() {
37 // variables. This matches the initialization of ToolDir in
38 // go/build, except for using GOROOT rather than
39 // runtime.GOROOT.
40- build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
41+ if s := os.Getenv("GOTOOLDIR"); s != "" {
42+ build.ToolDir = filepath.Clean(s)
43+ } else {
44+ build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
45+ }
46 }
47 }
48
diff --git a/recipes-containers/kubernetes/go-1.12/0004-ld-add-soname-to-shareable-objects.patch b/recipes-containers/kubernetes/go-1.12/0004-ld-add-soname-to-shareable-objects.patch
deleted file mode 100644
index 004a33a0..00000000
--- a/recipes-containers/kubernetes/go-1.12/0004-ld-add-soname-to-shareable-objects.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From 55eb8c95a89f32aec16b7764e78e8cf75169dc81 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 06:26:10 -0800
4Subject: [PATCH] ld: add soname to shareable objects
5
6so that OE's shared library dependency handling
7can find them.
8
9Upstream-Status: Inappropriate [OE specific]
10
11Signed-off-by: Matt Madison <matt@madison.systems>
12
13---
14 src/cmd/link/internal/ld/lib.go | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
18index 220aab3..703925f 100644
19--- a/src/cmd/link/internal/ld/lib.go
20+++ b/src/cmd/link/internal/ld/lib.go
21@@ -1135,6 +1135,7 @@ func (ctxt *Link) hostlink() {
22 argv = append(argv, "-Wl,-z,relro")
23 }
24 argv = append(argv, "-shared")
25+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
26 if ctxt.HeadType != objabi.Hwindows {
27 // Pass -z nodelete to mark the shared library as
28 // non-closeable: a dlclose will do nothing.
29@@ -1146,6 +1147,8 @@ func (ctxt *Link) hostlink() {
30 argv = append(argv, "-Wl,-z,relro")
31 }
32 argv = append(argv, "-shared")
33+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
34+
35 case BuildModePlugin:
36 if ctxt.HeadType == objabi.Hdarwin {
37 argv = append(argv, "-dynamiclib")
38@@ -1154,6 +1157,7 @@ func (ctxt *Link) hostlink() {
39 argv = append(argv, "-Wl,-z,relro")
40 }
41 argv = append(argv, "-shared")
42+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
43 }
44 }
45
diff --git a/recipes-containers/kubernetes/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch b/recipes-containers/kubernetes/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
deleted file mode 100644
index ace8de9e..00000000
--- a/recipes-containers/kubernetes/go-1.12/0005-make.bash-override-CC-when-building-dist-and-go_boot.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 1bf15aa8fb773604b2524cfdab493fa4d8fa9285 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 06:32:45 -0800
4Subject: [PATCH] make.bash: override CC when building dist and go_bootstrap
5
6for handling OE cross-canadian builds.
7
8Upstream-Status: Inappropriate [OE specific]
9
10Signed-off-by: Matt Madison <matt@madison.systems>
11
12---
13 src/make.bash | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/src/make.bash b/src/make.bash
17index 78882d9..25943d0 100755
18--- a/src/make.bash
19+++ b/src/make.bash
20@@ -163,7 +163,7 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
21 exit 1
22 fi
23 rm -f cmd/dist/dist
24-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
25+CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
26
27 # -e doesn't propagate out of eval, so check success by hand.
28 eval $(./cmd/dist/dist env -p || echo FAIL=true)
29@@ -194,7 +194,7 @@ fi
30 # Run dist bootstrap to complete make.bash.
31 # Bootstrap installs a proper cmd/dist, built with the new toolchain.
32 # Throw ours, built with Go 1.4, away after bootstrap.
33-./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
34+CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@"
35 rm -f ./cmd/dist/dist
36
37 # DO NOT ADD ANY NEW CODE HERE.
diff --git a/recipes-containers/kubernetes/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch b/recipes-containers/kubernetes/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch
deleted file mode 100644
index 0c0d5da8..00000000
--- a/recipes-containers/kubernetes/go-1.12/0006-cmd-dist-separate-host-and-target-builds.patch
+++ /dev/null
@@ -1,282 +0,0 @@
1From fe0fcaf43ef3aab81541dad2a71b46254dc4cf6a Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sat, 17 Feb 2018 10:03:48 -0800
4Subject: [PATCH] cmd/dist: separate host and target builds
5
6Change the dist tool to allow for OE-style cross-
7and cross-canadian builds:
8
9 - command flags --host-only and --target only are added;
10 if one is present, the other changes mentioned below
11 take effect, and arguments may also be specified on
12 the command line to enumerate the package(s) to be
13 built.
14
15 - for OE cross builds, go_bootstrap is always built for
16 the current build host, and is moved, along with the supporting
17 toolchain (asm, compile, etc.) to a separate 'native_native'
18 directory under GOROOT/pkg/tool.
19
20 - go_bootstrap is not automatically removed after the build,
21 so it can be reused later (e.g., building both static and
22 shared runtime).
23
24Note that for --host-only builds, it would be nice to specify
25just the "cmd" package to build only the go commands/tools,
26the staleness checks in the dist tool will fail if the "std"
27library has not also been built. So host-only builds have to
28build everything anyway.
29
30Upstream-Status: Inappropriate [OE specific]
31
32Signed-off-by: Matt Madison <matt@madison.systems>
33
34more dist cleanup
35
36---
37 src/cmd/dist/build.go | 153 ++++++++++++++++++++++++++++++------------
38 1 file changed, 111 insertions(+), 42 deletions(-)
39
40Index: go/src/cmd/dist/build.go
41===================================================================
42--- go.orig/src/cmd/dist/build.go
43+++ go/src/cmd/dist/build.go
44@@ -39,6 +39,7 @@ var (
45 goldflags string
46 workdir string
47 tooldir string
48+ build_tooldir string
49 oldgoos string
50 oldgoarch string
51 exe string
52@@ -50,6 +51,7 @@ var (
53
54 rebuildall bool
55 defaultclang bool
56+ crossBuild bool
57
58 vflag int // verbosity
59 )
60@@ -231,6 +233,8 @@ func xinit() {
61 if tooldir = os.Getenv("GOTOOLDIR"); tooldir == "" {
62 tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
63 }
64+ build_tooldir = pathf("%s/pkg/tool/native_native", goroot)
65+
66 }
67
68 // compilerEnv returns a map from "goos/goarch" to the
69@@ -260,7 +264,6 @@ func compilerEnv(envName, def string) ma
70 if gohostos != goos || gohostarch != goarch {
71 m[gohostos+"/"+gohostarch] = m[""]
72 }
73- m[""] = env
74 }
75
76 for _, goos := range okgoos {
77@@ -487,8 +490,10 @@ func setup() {
78 // We keep it in pkg/, just like the object directory above.
79 if rebuildall {
80 xremoveall(tooldir)
81+ xremoveall(build_tooldir)
82 }
83 xmkdirall(tooldir)
84+ xmkdirall(build_tooldir)
85
86 // Remove tool binaries from before the tool/gohostos_gohostarch
87 xremoveall(pathf("%s/bin/tool", goroot))
88@@ -1155,11 +1160,29 @@ func cmdbootstrap() {
89
90 var noBanner bool
91 var debug bool
92+ var hostOnly bool
93+ var targetOnly bool
94+ var toBuild = []string { "std", "cmd" }
95+
96 flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
97 flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
98 flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
99+ flag.BoolVar(&hostOnly, "host-only", hostOnly, "build only host binaries, not target")
100+ flag.BoolVar(&targetOnly, "target-only", targetOnly, "build only target binaries, not host")
101
102- xflagparse(0)
103+ xflagparse(-1)
104+
105+ if (hostOnly && targetOnly) {
106+ fatalf("specify only one of --host-only or --target-only\n")
107+ }
108+ crossBuild = hostOnly || targetOnly
109+ if flag.NArg() > 0 {
110+ if crossBuild {
111+ toBuild = flag.Args()
112+ } else {
113+ fatalf("package names not permitted without --host-only or --target-only\n")
114+ }
115+ }
116
117 if debug {
118 // cmd/buildid is used in debug mode.
119@@ -1207,8 +1230,13 @@ func cmdbootstrap() {
120 xprintf("\n")
121 }
122
123- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
124- goldflags = os.Getenv("GO_LDFLAGS")
125+ // For split host/target cross/cross-canadian builds, we don't
126+ // want to be setting these flags until after we have compiled
127+ // the toolchain that runs on the build host.
128+ if ! crossBuild {
129+ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
130+ goldflags = os.Getenv("GO_LDFLAGS")
131+ }
132 goBootstrap := pathf("%s/go_bootstrap", tooldir)
133 cmdGo := pathf("%s/go", gobin)
134 if debug {
135@@ -1237,7 +1265,11 @@ func cmdbootstrap() {
136 xprintf("\n")
137 }
138 xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
139- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
140+ if crossBuild {
141+ os.Setenv("CC", defaultcc[""])
142+ } else {
143+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
144+ }
145 goInstall(goBootstrap, append([]string{"-i"}, toolchain...)...)
146 if debug {
147 run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
148@@ -1274,50 +1306,84 @@ func cmdbootstrap() {
149 }
150 checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
151
152- if goos == oldgoos && goarch == oldgoarch {
153- // Common case - not setting up for cross-compilation.
154- timelog("build", "toolchain")
155- if vflag > 0 {
156- xprintf("\n")
157+ if crossBuild {
158+ gogcflags = os.Getenv("GO_GCFLAGS")
159+ goldflags = os.Getenv("GO_LDFLAGS")
160+ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir))
161+ for _, f := range tool_files {
162+ copyfile(pathf("%s/%s", build_tooldir, filepath.Base(f)), f, writeExec)
163+ xremove(f)
164+ }
165+ os.Setenv("GOTOOLDIR", build_tooldir)
166+ goBootstrap = pathf("%s/go_bootstrap", build_tooldir)
167+ if hostOnly {
168+ timelog("build", "host toolchain")
169+ if vflag > 0 {
170+ xprintf("\n")
171+ }
172+ xprintf("Building %s for host, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
173+ goInstall(goBootstrap, toBuild...)
174+ checkNotStale(goBootstrap, toBuild...)
175+ // Skip cmdGo staleness checks here, since we can't necessarily run the cmdGo binary
176+
177+ timelog("build", "target toolchain")
178+ if vflag > 0 {
179+ xprintf("\n")
180+ }
181+ } else if targetOnly {
182+ goos = oldgoos
183+ goarch = oldgoarch
184+ os.Setenv("GOOS", goos)
185+ os.Setenv("GOARCH", goarch)
186+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
187+ xprintf("Building %s for target, %s/%s.\n", strings.Join(toBuild, ","), goos, goarch)
188+ goInstall(goBootstrap, toBuild...)
189+ checkNotStale(goBootstrap, toBuild...)
190+ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary
191 }
192- xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
193 } else {
194- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
195- // Finish GOHOSTOS/GOHOSTARCH installation and then
196- // run GOOS/GOARCH installation.
197- timelog("build", "host toolchain")
198- if vflag > 0 {
199- xprintf("\n")
200+
201+ if goos == oldgoos && goarch == oldgoarch {
202+ // Common case - not setting up for cross-compilation.
203+ timelog("build", "toolchain")
204+ if vflag > 0 {
205+ xprintf("\n")
206+ }
207+ xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
208+ } else {
209+ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
210+ // Finish GOHOSTOS/GOHOSTARCH installation and then
211+ // run GOOS/GOARCH installation.
212+ timelog("build", "host toolchain")
213+ if vflag > 0 {
214+ xprintf("\n")
215+ }
216+ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
217+ goInstall(goBootstrap, "std", "cmd")
218+ checkNotStale(goBootstrap, "std", "cmd")
219+ checkNotStale(cmdGo, "std", "cmd")
220+
221+ timelog("build", "target toolchain")
222+ if vflag > 0 {
223+ xprintf("\n")
224+ }
225+ goos = oldgoos
226+ goarch = oldgoarch
227+ os.Setenv("GOOS", goos)
228+ os.Setenv("GOARCH", goarch)
229+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
230+ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
231 }
232- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
233 goInstall(goBootstrap, "std", "cmd")
234 checkNotStale(goBootstrap, "std", "cmd")
235 checkNotStale(cmdGo, "std", "cmd")
236
237- timelog("build", "target toolchain")
238- if vflag > 0 {
239- xprintf("\n")
240- }
241- goos = oldgoos
242- goarch = oldgoarch
243- os.Setenv("GOOS", goos)
244- os.Setenv("GOARCH", goarch)
245- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
246- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
247- }
248- targets := []string{"std", "cmd"}
249- if goos == "js" && goarch == "wasm" {
250- // Skip the cmd tools for js/wasm. They're not usable.
251- targets = targets[:1]
252- }
253- goInstall(goBootstrap, targets...)
254- checkNotStale(goBootstrap, targets...)
255- checkNotStale(cmdGo, targets...)
256- if debug {
257- run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
258- run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
259- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
260- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
261+ if debug {
262+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
263+ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
264+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
265+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
266+ }
267 }
268
269 // Check that there are no new files in $GOROOT/bin other than
270@@ -1335,7 +1401,11 @@ func cmdbootstrap() {
271 }
272
273 // Remove go_bootstrap now that we're done.
274- xremove(pathf("%s/go_bootstrap", tooldir))
275+ // Except that for split host/target cross-builds, we need to
276+ // keep it.
277+ if ! crossBuild {
278+ xremove(pathf("%s/go_bootstrap", tooldir))
279+ }
280
281 // Print trailing banner unless instructed otherwise.
282 if !noBanner {
diff --git a/recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch b/recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
deleted file mode 100644
index 29ef947a..00000000
--- a/recipes-containers/kubernetes/go-1.12/0007-cmd-go-make-GOROOT-precious-by-default.patch
+++ /dev/null
@@ -1,106 +0,0 @@
1From 7cc60b3887be2d5674b9f5d422d022976cf205e5 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Fri, 2 Mar 2018 06:00:20 -0800
4Subject: [PATCH] cmd/go: make GOROOT precious by default
5
6The go build tool normally rebuilds whatever it detects is
7stale. This can be a problem when GOROOT is intended to
8be read-only and the go runtime has been built as a shared
9library, since we don't want every application to be rebuilding
10the shared runtime - particularly in cross-build/packaging
11setups, since that would lead to 'abi mismatch' runtime errors.
12
13This patch prevents the install and linkshared actions from
14installing to GOROOT unless overridden with the GOROOT_OVERRIDE
15environment variable.
16
17Upstream-Status: Inappropriate [OE specific]
18
19Signed-off-by: Matt Madison <matt@madison.systems>
20
21---
22 src/cmd/go/internal/work/action.go | 3 +++
23 src/cmd/go/internal/work/build.go | 5 +++++
24 src/cmd/go/internal/work/exec.go | 25 +++++++++++++++++++++++++
25 3 files changed, 33 insertions(+)
26
27Index: go/src/cmd/go/internal/work/action.go
28===================================================================
29--- go.orig/src/cmd/go/internal/work/action.go
30+++ go/src/cmd/go/internal/work/action.go
31@@ -600,6 +600,9 @@ func (b *Builder) addTransitiveLinkDeps(
32 if p1 == nil || p1.Shlib == "" || haveShlib[filepath.Base(p1.Shlib)] {
33 continue
34 }
35+ if goRootPrecious && (p1.Standard || p1.Goroot) {
36+ continue
37+ }
38 haveShlib[filepath.Base(p1.Shlib)] = true
39 // TODO(rsc): The use of ModeInstall here is suspect, but if we only do ModeBuild,
40 // we'll end up building an overall library or executable that depends at runtime
41Index: go/src/cmd/go/internal/work/build.go
42===================================================================
43--- go.orig/src/cmd/go/internal/work/build.go
44+++ go/src/cmd/go/internal/work/build.go
45@@ -147,6 +147,7 @@ See also: go install, go get, go clean.
46 }
47
48 const concurrentGCBackendCompilationEnabledByDefault = true
49+var goRootPrecious bool = true
50
51 func init() {
52 // break init cycle
53@@ -160,6 +161,10 @@ func init() {
54
55 AddBuildFlags(CmdBuild)
56 AddBuildFlags(CmdInstall)
57+
58+ if x := os.Getenv("GOROOT_OVERRIDE"); x != "" {
59+ goRootPrecious = false
60+ }
61 }
62
63 // Note that flags consulted by other parts of the code
64Index: go/src/cmd/go/internal/work/exec.go
65===================================================================
66--- go.orig/src/cmd/go/internal/work/exec.go
67+++ go/src/cmd/go/internal/work/exec.go
68@@ -436,6 +436,23 @@ func (b *Builder) build(a *Action) (err
69 return fmt.Errorf("missing or invalid binary-only package; expected file %q", a.Package.Target)
70 }
71
72+ if goRootPrecious && (a.Package.Standard || a.Package.Goroot) {
73+ _, err := os.Stat(a.Package.Target)
74+ if err == nil {
75+ a.built = a.Package.Target
76+ a.Target = a.Package.Target
77+ a.buildID = b.fileHash(a.Package.Target)
78+ a.Package.Stale = false
79+ a.Package.StaleReason = "GOROOT-resident package"
80+ return nil
81+ }
82+ a.Package.Stale = true
83+ a.Package.StaleReason = "missing or invalid GOROOT-resident package"
84+ if b.IsCmdList {
85+ return nil
86+ }
87+ }
88+
89 if err := b.Mkdir(a.Objdir); err != nil {
90 return err
91 }
92@@ -1438,6 +1455,14 @@ func BuildInstallFunc(b *Builder, a *Act
93 return nil
94 }
95
96+ if goRootPrecious && a.Package != nil {
97+ p := a.Package
98+ if p.Standard || p.Goroot {
99+ err := fmt.Errorf("attempting to install package %s into read-only GOROOT", p.ImportPath)
100+ return err
101+ }
102+ }
103+
104 if err := b.Mkdir(a.Objdir); err != nil {
105 return err
106 }
diff --git a/recipes-containers/kubernetes/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch b/recipes-containers/kubernetes/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch
deleted file mode 100644
index 225cf439..00000000
--- a/recipes-containers/kubernetes/go-1.12/0008-use-GOBUILDMODE-to-set-buildmode.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 0e0c247f0caec23528889ff09d98348cba9028f1 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 26 Oct 2018 15:02:32 +0800
4Subject: [PATCH] use GOBUILDMODE to set buildmode
5
6While building go itself, the go build system does not support
7to set `-buildmode=pie' from environment.
8
9Add GOBUILDMODE to support it which make PIE executables the default
10build mode, as PIE executables are required as of Yocto
11
12Refers: https://groups.google.com/forum/#!topic/golang-dev/gRCe5URKewI
13Upstream-Status: Denied [upstream choose antoher solution: `17a256b
14cmd/go: -buildmode=pie for android/arm']
15
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17---
18 src/cmd/go/internal/work/build.go | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21Index: go/src/cmd/go/internal/work/build.go
22===================================================================
23--- go.orig/src/cmd/go/internal/work/build.go
24+++ go/src/cmd/go/internal/work/build.go
25@@ -223,7 +223,11 @@ func AddBuildFlags(cmd *base.Command) {
26
27 cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "")
28 cmd.Flag.Var(buildCompiler{}, "compiler", "")
29- cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
30+ if bm := os.Getenv("GOBUILDMODE"); bm != "" {
31+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", bm, "")
32+ } else {
33+ cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
34+ }
35 cmd.Flag.Var(&load.BuildGcflags, "gcflags", "")
36 cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "")
37 cmd.Flag.StringVar(&cfg.BuildMod, "mod", "", "")
diff --git a/recipes-containers/kubernetes/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch b/recipes-containers/kubernetes/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
deleted file mode 100644
index 840cf4bb..00000000
--- a/recipes-containers/kubernetes/go-1.12/0009-ld-replace-glibc-dynamic-linker-with-musl.patch
+++ /dev/null
@@ -1,112 +0,0 @@
1From 35ea4be34e94912b00837e0f7c7385f2e98fe769 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Sun, 18 Feb 2018 08:24:05 -0800
4Subject: [PATCH] ld: replace glibc dynamic linker with musl
5
6Rework of patch by Khem Raj <raj.khem@gmail.com>
7for go 1.10. Should be applied conditionally on
8musl being the system C library.
9
10Upstream-Status: Inappropriate [Real fix should be portable across libcs]
11
12Signed-off-by: Matt Madison <matt@madison.systems>
13
14---
15 src/cmd/link/internal/amd64/obj.go | 2 +-
16 src/cmd/link/internal/arm/obj.go | 2 +-
17 src/cmd/link/internal/arm64/obj.go | 2 +-
18 src/cmd/link/internal/mips/obj.go | 2 +-
19 src/cmd/link/internal/mips64/obj.go | 2 +-
20 src/cmd/link/internal/ppc64/obj.go | 2 +-
21 src/cmd/link/internal/s390x/obj.go | 2 +-
22 src/cmd/link/internal/x86/obj.go | 2 +-
23 8 files changed, 8 insertions(+), 8 deletions(-)
24
25--- a/src/cmd/link/internal/amd64/obj.go
26+++ b/src/cmd/link/internal/amd64/obj.go
27@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
28 PEreloc1: pereloc1,
29 TLSIEtoLE: tlsIEtoLE,
30
31- Linuxdynld: "/lib64/ld-linux-x86-64.so.2",
32+ Linuxdynld: "/lib64/ld-musl-x86-64.so.1",
33 Freebsddynld: "/libexec/ld-elf.so.1",
34 Openbsddynld: "/usr/libexec/ld.so",
35 Netbsddynld: "/libexec/ld.elf_so",
36--- a/src/cmd/link/internal/arm/obj.go
37+++ b/src/cmd/link/internal/arm/obj.go
38@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
39 Machoreloc1: machoreloc1,
40 PEreloc1: pereloc1,
41
42- Linuxdynld: "/lib/ld-linux.so.3", // 2 for OABI, 3 for EABI
43+ Linuxdynld: "/lib/ld-musl-armhf.so.1",
44 Freebsddynld: "/usr/libexec/ld-elf.so.1",
45 Openbsddynld: "/usr/libexec/ld.so",
46 Netbsddynld: "/libexec/ld.elf_so",
47--- a/src/cmd/link/internal/arm64/obj.go
48+++ b/src/cmd/link/internal/arm64/obj.go
49@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
50 Gentext: gentext,
51 Machoreloc1: machoreloc1,
52
53- Linuxdynld: "/lib/ld-linux-aarch64.so.1",
54+ Linuxdynld: "/lib/ld-musl-aarch64.so.1",
55
56 Freebsddynld: "XXX",
57 Openbsddynld: "XXX",
58--- a/src/cmd/link/internal/mips/obj.go
59+++ b/src/cmd/link/internal/mips/obj.go
60@@ -60,7 +60,7 @@ func Init() (*sys.Arch, ld.Arch) {
61 Gentext: gentext,
62 Machoreloc1: machoreloc1,
63
64- Linuxdynld: "/lib/ld.so.1",
65+ Linuxdynld: "/lib/ld-musl-mipsle.so.1",
66
67 Freebsddynld: "XXX",
68 Openbsddynld: "XXX",
69--- a/src/cmd/link/internal/mips64/obj.go
70+++ b/src/cmd/link/internal/mips64/obj.go
71@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
72 Gentext: gentext,
73 Machoreloc1: machoreloc1,
74
75- Linuxdynld: "/lib64/ld64.so.1",
76+ Linuxdynld: "/lib64/ld-musl-mips64le.so.1",
77 Freebsddynld: "XXX",
78 Openbsddynld: "XXX",
79 Netbsddynld: "XXX",
80--- a/src/cmd/link/internal/ppc64/obj.go
81+++ b/src/cmd/link/internal/ppc64/obj.go
82@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
83 Machoreloc1: machoreloc1,
84
85 // TODO(austin): ABI v1 uses /usr/lib/ld.so.1,
86- Linuxdynld: "/lib64/ld64.so.1",
87+ Linuxdynld: "/lib64/ld-musl-powerpc64le.so.1",
88
89 Freebsddynld: "XXX",
90 Openbsddynld: "XXX",
91--- a/src/cmd/link/internal/s390x/obj.go
92+++ b/src/cmd/link/internal/s390x/obj.go
93@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
94 Gentext: gentext,
95 Machoreloc1: machoreloc1,
96
97- Linuxdynld: "/lib64/ld64.so.1",
98+ Linuxdynld: "/lib64/ld-musl-s390x.so.1",
99
100 // not relevant for s390x
101 Freebsddynld: "XXX",
102--- a/src/cmd/link/internal/x86/obj.go
103+++ b/src/cmd/link/internal/x86/obj.go
104@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
105 Machoreloc1: machoreloc1,
106 PEreloc1: pereloc1,
107
108- Linuxdynld: "/lib/ld-linux.so.2",
109+ Linuxdynld: "/lib/ld-musl-i386.so.1",
110 Freebsddynld: "/usr/libexec/ld-elf.so.1",
111 Openbsddynld: "/usr/libexec/ld.so",
112 Netbsddynld: "/usr/libexec/ld.elf_so",
diff --git a/recipes-containers/kubernetes/go-common.inc b/recipes-containers/kubernetes/go-common.inc
deleted file mode 100644
index 93a3d3b5..00000000
--- a/recipes-containers/kubernetes/go-common.inc
+++ /dev/null
@@ -1,32 +0,0 @@
1SUMMARY = "Go programming language compiler"
2DESCRIPTION = " The Go programming language is an open source project to make \
3 programmers more productive. Go is expressive, concise, clean, and\
4 efficient. Its concurrency mechanisms make it easy to write programs\
5 that get the most out of multicore and networked machines, while its\
6 novel type system enables flexible and modular program construction.\
7 Go compiles quickly to machine code yet has the convenience of\
8 garbage collection and the power of run-time reflection. It's a\
9 fast, statically typed, compiled language that feels like a\
10 dynamically typed, interpreted language."
11
12HOMEPAGE = " http://golang.org/"
13LICENSE = "BSD-3-Clause"
14
15inherit goarch
16
17SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz;name=main"
18S = "${WORKDIR}/go"
19B = "${S}"
20UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.src\.tar"
21
22INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
23SSTATE_SCAN_CMD = "true"
24
25export GOROOT_OVERRIDE = "1"
26export GOTMPDIR ?= "${WORKDIR}/go-tmp"
27GOTMPDIR[vardepvalue] = ""
28export CGO_ENABLED = "1"
29
30do_compile_prepend() {
31 BUILD_CC=${BUILD_CC}
32}
diff --git a/recipes-containers/kubernetes/go-cross-canadian.inc b/recipes-containers/kubernetes/go-cross-canadian.inc
deleted file mode 100644
index 945d0f9d..00000000
--- a/recipes-containers/kubernetes/go-cross-canadian.inc
+++ /dev/null
@@ -1,66 +0,0 @@
1inherit cross-canadian
2
3DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \
4 virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-libc \
5 virtual/nativesdk-${HOST_PREFIX}compilerlibs"
6PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
7
8# it uses gcc on build machine during go-cross-canadian bootstrap, but
9# the gcc version may be old and not support option '-fmacro-prefix-map'
10# which is one of default values of DEBUG_PREFIX_MAP
11DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
12 -fdebug-prefix-map=${STAGING_DIR_HOST}= \
13 -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
14 "
15
16export GOHOSTOS = "${BUILD_GOOS}"
17export GOHOSTARCH = "${BUILD_GOARCH}"
18export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
19export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
20export GOROOT_FINAL = "${libdir}/go"
21export CGO_CFLAGS = "${CFLAGS}"
22export CGO_LDFLAGS = "${LDFLAGS}"
23export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"'
24
25do_configure[noexec] = "1"
26
27do_compile() {
28 export CC_FOR_${HOST_GOOS}_${HOST_GOARCH}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
29 export CXX_FOR_${HOST_GOOS}_${HOST_GOARCH}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
30 cd src
31 ./make.bash --host-only --no-banner
32 cd ${B}
33}
34do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
35do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
36
37
38make_wrapper() {
39 rm -f ${D}${bindir}/$2
40 cat <<END >${D}${bindir}/$2
41#!/bin/sh
42here=\`dirname \$0\`
43native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\`
44export GOARCH="${TARGET_GOARCH}"
45export GOOS="${TARGET_GOOS}"
46test -n "\$GOARM" || export GOARM="${TARGET_GOARM}"
47test -n "\$GO386" || export GO386="${TARGET_GO386}"
48test -n "\$GOMIPS" || export GOMIPS="${TARGET_GOMIPS}"
49export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}"
50test -n "\$GOROOT" || export GOROOT="\$OECORE_TARGET_SYSROOT/${target_libdir}/go"
51\$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@"
52END
53 chmod +x ${D}${bindir}/$2
54}
55
56do_install() {
57 install -d ${D}${libdir}/go/pkg/tool
58 cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/
59 install -d ${D}${bindir} ${D}${libdir}/go/bin
60 for f in ${B}/${GO_BUILD_BINDIR}/*
61 do
62 base=`basename $f`
63 install -m755 $f ${D}${libdir}/go/bin
64 make_wrapper $base ${TARGET_PREFIX}$base
65 done
66}
diff --git a/recipes-containers/kubernetes/go-cross-canadian_1.12.bb b/recipes-containers/kubernetes/go-cross-canadian_1.12.bb
deleted file mode 100644
index 7ac9449e..00000000
--- a/recipes-containers/kubernetes/go-cross-canadian_1.12.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require go-cross-canadian.inc
2require go-${PV}.inc
diff --git a/recipes-containers/kubernetes/go-cross.inc b/recipes-containers/kubernetes/go-cross.inc
deleted file mode 100644
index 3d344a74..00000000
--- a/recipes-containers/kubernetes/go-cross.inc
+++ /dev/null
@@ -1,62 +0,0 @@
1inherit cross
2
3PROVIDES = "virtual/${TUNE_PKGARCH}-go"
4DEPENDS = "go-native"
5
6PN = "go-cross-${TUNE_PKGARCH}"
7
8export GOHOSTOS = "${BUILD_GOOS}"
9export GOHOSTARCH = "${BUILD_GOARCH}"
10export GOOS = "${TARGET_GOOS}"
11export GOARCH = "${TARGET_GOARCH}"
12export GOARM = "${TARGET_GOARM}"
13export GO386 = "${TARGET_GO386}"
14export GOMIPS = "${TARGET_GOMIPS}"
15export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
16export GOROOT_FINAL = "${libdir}/go"
17export GOCACHE = "${B}/.cache"
18CC = "${@d.getVar('BUILD_CC').strip()}"
19
20do_configure[noexec] = "1"
21
22do_compile() {
23 export CC_FOR_${GOOS}_${GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
24 export CXX_FOR_${GOOS}_${GOARCh}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
25 cd src
26 ./make.bash --host-only --no-banner
27 cd ${B}
28}
29do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
30do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
31
32make_wrapper() {
33 rm -f ${D}${bindir}/$2
34 cat <<END >${D}${bindir}/$2
35#!/bin/bash
36here=\`dirname \$0\`
37export GOARCH="${TARGET_GOARCH}"
38export GOOS="${TARGET_GOOS}"
39export GOARM="\${GOARM:-${TARGET_GOARM}}"
40export GO386="\${GO386:-${TARGET_GO386}}"
41export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}"
42\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
43END
44 chmod +x ${D}${bindir}/$2
45}
46
47do_install() {
48 install -d ${D}${libdir}/go
49 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
50 install -d ${D}${libdir}/go/src
51 (cd ${S}/src; for d in *; do \
52 [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
53 done)
54 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
55 install -d ${D}${bindir} ${D}${libdir}/go/bin
56 for f in ${B}/bin/*
57 do
58 base=`basename $f`
59 install -m755 $f ${D}${libdir}/go/bin
60 make_wrapper $base ${TARGET_PREFIX}$base
61 done
62}
diff --git a/recipes-containers/kubernetes/go-cross_1.12.bb b/recipes-containers/kubernetes/go-cross_1.12.bb
deleted file mode 100644
index 80b5a03f..00000000
--- a/recipes-containers/kubernetes/go-cross_1.12.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require go-cross.inc
2require go-${PV}.inc
diff --git a/recipes-containers/kubernetes/go-crosssdk.inc b/recipes-containers/kubernetes/go-crosssdk.inc
deleted file mode 100644
index 94f6fb8e..00000000
--- a/recipes-containers/kubernetes/go-crosssdk.inc
+++ /dev/null
@@ -1,50 +0,0 @@
1inherit crosssdk
2
3DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
4PN = "go-crosssdk-${SDK_SYS}"
5PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk"
6
7export GOHOSTOS = "${BUILD_GOOS}"
8export GOHOSTARCH = "${BUILD_GOARCH}"
9export GOOS = "${TARGET_GOOS}"
10export GOARCH = "${TARGET_GOARCH}"
11export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
12export GOROOT_FINAL = "${libdir}/go"
13
14do_configure[noexec] = "1"
15
16do_compile() {
17 export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
18 export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
19 cd src
20 ./make.bash --host-only --no-banner
21 cd ${B}
22}
23do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
24do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
25
26make_wrapper() {
27 rm -f ${D}${bindir}/$2
28 cat <<END >${D}${bindir}/$2
29#!/bin/bash
30here=\`dirname \$0\`
31export GOARCH="${TARGET_GOARCH}"
32export GOOS="${TARGET_GOOS}"
33\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
34END
35 chmod +x ${D}${bindir}/$2
36}
37
38do_install() {
39 install -d ${D}${libdir}/go
40 install -d ${D}${libdir}/go/bin
41 install -d ${D}${libdir}/go/pkg/tool
42 install -d ${D}${bindir}
43 cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/
44 for f in ${B}/bin/*
45 do
46 base=`basename $f`
47 install -m755 $f ${D}${libdir}/go/bin
48 make_wrapper $base ${TARGET_PREFIX}$base
49 done
50}
diff --git a/recipes-containers/kubernetes/go-crosssdk_1.12.bb b/recipes-containers/kubernetes/go-crosssdk_1.12.bb
deleted file mode 100644
index 1857c8a5..00000000
--- a/recipes-containers/kubernetes/go-crosssdk_1.12.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require go-crosssdk.inc
2require go-${PV}.inc
diff --git a/recipes-containers/kubernetes/go-native.inc b/recipes-containers/kubernetes/go-native.inc
deleted file mode 100644
index 20770874..00000000
--- a/recipes-containers/kubernetes/go-native.inc
+++ /dev/null
@@ -1,55 +0,0 @@
1inherit native
2
3SRC_URI_append = " https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4"
4SRC_URI[bootstrap.md5sum] = "dbf727a4b0e365bf88d97cbfde590016"
5SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52"
6
7export GOOS = "${BUILD_GOOS}"
8export GOARCH = "${BUILD_GOARCH}"
9CC = "${@d.getVar('BUILD_CC').strip()}"
10
11GOMAKEARGS ?= "--no-banner"
12
13do_configure() {
14 cd ${WORKDIR}/go1.4/go/src
15 CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash
16}
17
18do_compile() {
19 export GOROOT_FINAL="${libdir_native}/go"
20 export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go"
21
22 cd src
23 ./make.bash ${GOMAKEARGS}
24 cd ${B}
25}
26do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin"
27do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin"
28
29make_wrapper() {
30 rm -f ${D}${bindir}/$2$3
31 cat <<END >${D}${bindir}/$2$3
32#!/bin/bash
33here=\`dirname \$0\`
34export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
35\$here/../lib/go/bin/$1 "\$@"
36END
37 chmod +x ${D}${bindir}/$2
38}
39
40do_install() {
41 install -d ${D}${libdir}/go
42 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
43 install -d ${D}${libdir}/go/src
44 (cd ${S}/src; for d in *; do \
45 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
46 done)
47 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
48 install -d ${D}${bindir} ${D}${libdir}/go/bin
49 for f in ${B}/bin/*
50 do
51 base=`basename $f`
52 install -m755 $f ${D}${libdir}/go/bin
53 make_wrapper $base $base
54 done
55}
diff --git a/recipes-containers/kubernetes/go-native_1.12.bb b/recipes-containers/kubernetes/go-native_1.12.bb
deleted file mode 100644
index bbf3c0dd..00000000
--- a/recipes-containers/kubernetes/go-native_1.12.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require ${PN}.inc
2require go-${PV}.inc
diff --git a/recipes-containers/kubernetes/go-runtime.inc b/recipes-containers/kubernetes/go-runtime.inc
deleted file mode 100644
index 9731e164..00000000
--- a/recipes-containers/kubernetes/go-runtime.inc
+++ /dev/null
@@ -1,96 +0,0 @@
1DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
2DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
3PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
4
5export GOHOSTOS = "${BUILD_GOOS}"
6export GOHOSTARCH = "${BUILD_GOARCH}"
7export GOOS = "${TARGET_GOOS}"
8export GOARCH = "${TARGET_GOARCH}"
9export GOARM = "${TARGET_GOARM}"
10export GO386 = "${TARGET_GO386}"
11export GOMIPS = "${TARGET_GOMIPS}"
12export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
13export GOROOT_FINAL = "${libdir}/go"
14export CGO_CFLAGS = "${CFLAGS}"
15export CGO_CPPFLAGS = "${CPPFLAGS}"
16export CGO_CXXFLAGS = "${CXXFLAGS}"
17export CGO_LDFLAGS = "${LDFLAGS}"
18export GOCACHE = "${B}/.cache"
19
20GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
21GO_SHLIB_LDFLAGS ?= '-ldflags="--linkmode=external -extldflags '${GO_EXTLDFLAGS}'"'
22
23do_configure() {
24 :
25}
26
27do_configure_libc-musl() {
28 rm -f ${S}/src/runtime/race/*.syso
29}
30
31do_compile() {
32 export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}"
33 export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}"
34
35 cd src
36 ./make.bash --target-only --no-banner std
37 if [ -n "${GO_DYNLINK}" ]; then
38 export GOTOOLDIR="${B}/pkg/tool/native_native"
39 CC="$CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}" GOARCH="${TARGET_GOARCH}" GOOS="${TARGET_GOOS}" GOROOT=${B} \
40 $GOTOOLDIR/go_bootstrap install -linkshared -buildmode=shared ${GO_SHLIB_LDFLAGS} std
41 fi
42 cd ${B}
43}
44do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
45do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
46
47do_install() {
48 install -d ${D}${libdir}/go/src
49 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
50 if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
51 rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
52 rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
53 fi
54 rm -rf ${D}${libdir}/go/pkg/tool
55 rm -rf ${D}${libdir}/go/pkg/obj
56 rm -rf ${D}${libdir}/go/pkg/bootstrap
57 find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
58 cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
59 done
60 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
61 rm -f ${D}${libdir}/go/src/cmd/dist/dist
62 rm -f ${D}${libdir}/go/src/cmd/cgo/zdefaultcc.go
63 rm -f ${D}${libdir}/go/src/cmd/go/internal/cfg/zdefaultcc.go
64
65}
66
67ALLOW_EMPTY_${PN} = "1"
68FILES_${PN} = "${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*${SOLIBSDEV}"
69FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include \
70 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.shlibname \
71 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.shlibname \
72 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.shlibname \
73 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.shlibname \
74 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.shlibname \
75 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.shlibname \
76 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.shlibname \
77 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*.a \
78 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*.a \
79 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*.a \
80 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*.a \
81 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*.a \
82 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*.a \
83 ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink/*/*/*/*/*/*/*.a \
84"
85FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE}"
86
87# Go sources include some scripts and pre-built binaries for
88# multiple architectures. The static .a files for dynamically-linked
89# runtime are also required in -dev.
90INSANE_SKIP_${PN}-dev = "staticdev file-rdeps arch"
91
92INHIBIT_PACKAGE_STRIP = "1"
93INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
94INHIBIT_SYSROOT_STRIP = "1"
95
96BBCLASSEXTEND = "nativesdk"
diff --git a/recipes-containers/kubernetes/go-runtime_1.12.bb b/recipes-containers/kubernetes/go-runtime_1.12.bb
deleted file mode 100644
index 43b68b4e..00000000
--- a/recipes-containers/kubernetes/go-runtime_1.12.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require go-${PV}.inc
2require go-runtime.inc
diff --git a/recipes-containers/kubernetes/go-target.inc b/recipes-containers/kubernetes/go-target.inc
deleted file mode 100644
index 91efd3e9..00000000
--- a/recipes-containers/kubernetes/go-target.inc
+++ /dev/null
@@ -1,54 +0,0 @@
1DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
2DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
3
4export GOHOSTOS = "${BUILD_GOOS}"
5export GOHOSTARCH = "${BUILD_GOARCH}"
6export GOOS = "${TARGET_GOOS}"
7export GOARCH = "${TARGET_GOARCH}"
8export GOARM = "${TARGET_GOARM}"
9export GO386 = "${TARGET_GO386}"
10export GOMIPS = "${TARGET_GOMIPS}"
11export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
12export GOROOT_FINAL = "${libdir}/go"
13export GOCACHE = "${B}/.cache"
14GO_LDFLAGS = ""
15GO_LDFLAGS_class-nativesdk = "-linkmode external"
16export GO_LDFLAGS
17
18CC_append_class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}"
19
20do_configure[noexec] = "1"
21
22do_compile() {
23 export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}"
24 export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}"
25
26 cd src
27 ./make.bash --target-only --no-banner
28 cd ${B}
29}
30do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
31do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
32
33do_install() {
34 install -d ${D}${libdir}/go/pkg/tool
35 cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
36 install -d ${D}${libdir}/go/src
37 cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
38 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
39 install -d ${D}${libdir}/go/bin
40 install -d ${D}${bindir}
41 for f in ${B}/${GO_BUILD_BINDIR}/*; do
42 name=`basename $f`
43 install -m 0755 $f ${D}${libdir}/go/bin/
44 ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/
45 done
46}
47
48PACKAGES = "${PN} ${PN}-dev"
49FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
50FILES_${PN}-dev = "${libdir}/go"
51RDEPENDS_${PN}-dev = "perl bash"
52INSANE_SKIP_${PN} = "ldflags"
53
54BBCLASSEXTEND = "nativesdk"
diff --git a/recipes-containers/kubernetes/go_1.12.bb b/recipes-containers/kubernetes/go_1.12.bb
deleted file mode 100644
index 42cdb043..00000000
--- a/recipes-containers/kubernetes/go_1.12.bb
+++ /dev/null
@@ -1,14 +0,0 @@
1require go-${PV}.inc
2require go-target.inc
3
4export GOBUILDMODE=""
5
6# Add pie to GOBUILDMODE to satisfy "textrel" QA checking, but mips
7# doesn't support -buildmode=pie, so skip the QA checking for mips and its
8# variants.
9python() {
10 if 'mips' in d.getVar('TARGET_ARCH'):
11 d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
12 else:
13 d.setVar('GOBUILDMODE', 'pie')
14}