diff options
author | Jose Quaresma <quaresma.jose@gmail.com> | 2024-02-28 18:30:05 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-03-03 16:28:20 +0000 |
commit | 9c730d3bcccbcb3595eef4ca0b7637b066d7b601 (patch) | |
tree | 2a796e5330580497d726a0b76d20782571034c1a /meta/recipes-devtools/go | |
parent | ef88dee4f77ca95ec79e62d08fc0a01e83528e11 (diff) | |
download | poky-9c730d3bcccbcb3595eef4ca0b7637b066d7b601.tar.gz |
go: rework patch to avoid identation
It's more hard to read but easy to rebase, no functional changes
(From OE-Core rev: 5065025a66f96140ca895a140067fbde82879941)
Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go')
-rw-r--r-- | meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch | 136 |
1 files changed, 35 insertions, 101 deletions
diff --git a/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch index 29598449da..aa2df58995 100644 --- a/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch +++ b/meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch | |||
@@ -3,8 +3,6 @@ From: Alex Kube <alexander.j.kube@gmail.com> | |||
3 | Date: Wed, 23 Oct 2019 21:18:12 +0430 | 3 | Date: Wed, 23 Oct 2019 21:18:12 +0430 |
4 | Subject: [PATCH 5/9] cmd/dist: separate host and target builds | 4 | Subject: [PATCH 5/9] cmd/dist: separate host and target builds |
5 | 5 | ||
6 | Upstream-Status: Inappropriate [OE specific] | ||
7 | |||
8 | Change the dist tool to allow for OE-style cross- | 6 | Change the dist tool to allow for OE-style cross- |
9 | and cross-canadian builds: | 7 | and cross-canadian builds: |
10 | 8 | ||
@@ -33,13 +31,20 @@ Adapted to Go 1.13 from patches originally submitted to | |||
33 | the meta/recipes-devtools/go tree by | 31 | the meta/recipes-devtools/go tree by |
34 | Matt Madison <matt@madison.systems>. | 32 | Matt Madison <matt@madison.systems>. |
35 | 33 | ||
34 | Rework the patch to avoid identation, it's more hard to read | ||
35 | but easy to rebase. | ||
36 | Jose Quaresma <jose.quaresma@foundries.io> | ||
37 | |||
38 | Upstream-Status: Inappropriate [OE specific] | ||
39 | |||
36 | Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com> | 40 | Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com> |
41 | Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io> | ||
37 | --- | 42 | --- |
38 | src/cmd/dist/build.go | 152 +++++++++++++++++++++++++++++++----------- | 43 | src/cmd/dist/build.go | 76 ++++++++++++++++++++++++++++++++++++++++++- |
39 | 1 file changed, 113 insertions(+), 39 deletions(-) | 44 | 1 file changed, 75 insertions(+), 1 deletion(-) |
40 | 45 | ||
41 | diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go | 46 | diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go |
42 | index 5d31718..1c7f308 100644 | 47 | index 5d3171856a..d0ba54c072 100644 |
43 | --- a/src/cmd/dist/build.go | 48 | --- a/src/cmd/dist/build.go |
44 | +++ b/src/cmd/dist/build.go | 49 | +++ b/src/cmd/dist/build.go |
45 | @@ -44,6 +44,7 @@ var ( | 50 | @@ -44,6 +44,7 @@ var ( |
@@ -119,17 +124,14 @@ index 5d31718..1c7f308 100644 | |||
119 | xprintf("\n") | 124 | xprintf("\n") |
120 | } | 125 | } |
121 | 126 | ||
122 | - gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now | ||
123 | - setNoOpt() | ||
124 | - goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now | ||
125 | + // For split host/target cross/cross-canadian builds, we don't | 127 | + // For split host/target cross/cross-canadian builds, we don't |
126 | + // want to be setting these flags until after we have compiled | 128 | + // want to be setting these flags until after we have compiled |
127 | + // the toolchain that runs on the build host. | 129 | + // the toolchain that runs on the build host. |
128 | + if !crossBuild { | 130 | + if !crossBuild { |
129 | + gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now | 131 | gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now |
130 | + setNoOpt() | 132 | setNoOpt() |
131 | + goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now | 133 | goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now |
132 | + } | 134 | +} |
133 | goBootstrap := pathf("%s/go_bootstrap", tooldir) | 135 | goBootstrap := pathf("%s/go_bootstrap", tooldir) |
134 | cmdGo := pathf("%s/go", gorootBin) | 136 | cmdGo := pathf("%s/go", gorootBin) |
135 | if debug { | 137 | if debug { |
@@ -137,25 +139,27 @@ index 5d31718..1c7f308 100644 | |||
137 | xprintf("\n") | 139 | xprintf("\n") |
138 | } | 140 | } |
139 | xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") | 141 | xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") |
140 | - os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) | 142 | + if !crossBuild { |
141 | + if crossBuild { | 143 | os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) |
144 | +} else { | ||
142 | + os.Setenv("CC", defaultcc[""]) | 145 | + os.Setenv("CC", defaultcc[""]) |
143 | + } else { | ||
144 | + os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) | ||
145 | + } | 146 | + } |
146 | // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT. | 147 | // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT. |
147 | os.Setenv("GOEXPERIMENT", goexperiment) | 148 | os.Setenv("GOEXPERIMENT", goexperiment) |
148 | goInstall(goBootstrap, toolchain...) | 149 | goInstall(goBootstrap, toolchain...) |
149 | @@ -1421,46 +1454,84 @@ func cmdbootstrap() { | 150 | @@ -1421,6 +1454,7 @@ func cmdbootstrap() { |
150 | copyfile(pathf("%s/compile3", tooldir), pathf("%s/compile", tooldir), writeExec) | 151 | copyfile(pathf("%s/compile3", tooldir), pathf("%s/compile", tooldir), writeExec) |
151 | } | 152 | } |
152 | 153 | ||
153 | - if goos == oldgoos && goarch == oldgoarch { | 154 | + if !crossBuild { |
154 | - // Common case - not setting up for cross-compilation. | 155 | if goos == oldgoos && goarch == oldgoarch { |
155 | - timelog("build", "toolchain") | 156 | // Common case - not setting up for cross-compilation. |
156 | - if vflag > 0 { | 157 | timelog("build", "toolchain") |
157 | - xprintf("\n") | 158 | @@ -1462,6 +1496,42 @@ func cmdbootstrap() { |
158 | + if crossBuild { | 159 | checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) |
160 | copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec) | ||
161 | } | ||
162 | +} else { | ||
159 | + gogcflags = os.Getenv("GO_GCFLAGS") | 163 | + gogcflags = os.Getenv("GO_GCFLAGS") |
160 | + goldflags = os.Getenv("GO_LDFLAGS") | 164 | + goldflags = os.Getenv("GO_LDFLAGS") |
161 | + tool_files, _ := filepath.Glob(pathf("%s/*", tooldir)) | 165 | + tool_files, _ := filepath.Glob(pathf("%s/*", tooldir)) |
@@ -189,94 +193,24 @@ index 5d31718..1c7f308 100644 | |||
189 | + goInstall(goBootstrap, toBuild...) | 193 | + goInstall(goBootstrap, toBuild...) |
190 | + checkNotStale(goBootstrap, toBuild...) | 194 | + checkNotStale(goBootstrap, toBuild...) |
191 | + // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary | 195 | + // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary |
192 | } | 196 | + } |
193 | - xprintf("Building packages and commands for %s/%s.\n", goos, goarch) | 197 | + } |
194 | } else { | ||
195 | - // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH. | ||
196 | - // Finish GOHOSTOS/GOHOSTARCH installation and then | ||
197 | - // run GOOS/GOARCH installation. | ||
198 | - timelog("build", "host toolchain") | ||
199 | - if vflag > 0 { | ||
200 | - xprintf("\n") | ||
201 | + | ||
202 | + if goos == oldgoos && goarch == oldgoarch { | ||
203 | + // Common case - not setting up for cross-compilation. | ||
204 | + timelog("build", "toolchain") | ||
205 | + if vflag > 0 { | ||
206 | + xprintf("\n") | ||
207 | + } | ||
208 | + xprintf("Building packages and commands for %s/%s.\n", goos, goarch) | ||
209 | + } else { | ||
210 | + // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH. | ||
211 | + // Finish GOHOSTOS/GOHOSTARCH installation and then | ||
212 | + // run GOOS/GOARCH installation. | ||
213 | + timelog("build", "host toolchain") | ||
214 | + if vflag > 0 { | ||
215 | + xprintf("\n") | ||
216 | + } | ||
217 | + xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch) | ||
218 | + goInstall(goBootstrap, "std", "cmd") | ||
219 | + checkNotStale(goBootstrap, "std", "cmd") | ||
220 | + checkNotStale(cmdGo, "std", "cmd") | ||
221 | + | ||
222 | + timelog("build", "target toolchain") | ||
223 | + if vflag > 0 { | ||
224 | + xprintf("\n") | ||
225 | + } | ||
226 | + goos = oldgoos | ||
227 | + goarch = oldgoarch | ||
228 | + os.Setenv("GOOS", goos) | ||
229 | + os.Setenv("GOARCH", goarch) | ||
230 | + os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) | ||
231 | + xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch) | ||
232 | } | ||
233 | - xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch) | ||
234 | goInstall(goBootstrap, "std", "cmd") | ||
235 | checkNotStale(goBootstrap, "std", "cmd") | ||
236 | checkNotStale(cmdGo, "std", "cmd") | ||
237 | |||
238 | - timelog("build", "target toolchain") | ||
239 | - if vflag > 0 { | ||
240 | - xprintf("\n") | ||
241 | + if debug { | ||
242 | + run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") | ||
243 | + run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch)) | ||
244 | + checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) | ||
245 | + copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec) | ||
246 | } | ||
247 | - goos = oldgoos | ||
248 | - goarch = oldgoarch | ||
249 | - os.Setenv("GOOS", goos) | ||
250 | - os.Setenv("GOARCH", goarch) | ||
251 | - os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch)) | ||
252 | - xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch) | ||
253 | - } | ||
254 | - targets := []string{"std", "cmd"} | ||
255 | - goInstall(goBootstrap, targets...) | ||
256 | - checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) | ||
257 | - checkNotStale(goBootstrap, targets...) | ||
258 | - checkNotStale(cmdGo, targets...) | ||
259 | - if debug { | ||
260 | - run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") | ||
261 | - checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...) | ||
262 | - copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec) | ||
263 | } | ||
264 | 198 | ||
265 | // Check that there are no new files in $GOROOT/bin other than | 199 | // Check that there are no new files in $GOROOT/bin other than |
266 | @@ -1477,8 +1548,11 @@ func cmdbootstrap() { | 200 | // go and gofmt and $GOOS_$GOARCH (target bin when cross-compiling). |
201 | @@ -1477,8 +1547,12 @@ func cmdbootstrap() { | ||
267 | } | 202 | } |
268 | } | 203 | } |
269 | 204 | ||
270 | - // Remove go_bootstrap now that we're done. | ||
271 | - xremove(pathf("%s/go_bootstrap", tooldir)) | ||
272 | + // Except that for split host/target cross-builds, we need to | 205 | + // Except that for split host/target cross-builds, we need to |
273 | + // keep it. | 206 | + // keep it. |
274 | + if !crossBuild { | 207 | + if !crossBuild { |
275 | + xremove(pathf("%s/go_bootstrap", tooldir)) | 208 | // Remove go_bootstrap now that we're done. |
276 | + } | 209 | xremove(pathf("%s/go_bootstrap", tooldir)) |
210 | +} | ||
277 | 211 | ||
278 | if goos == "android" { | 212 | if goos == "android" { |
279 | // Make sure the exec wrapper will sync a fresh $GOROOT to the device. | 213 | // Make sure the exec wrapper will sync a fresh $GOROOT to the device. |
280 | -- | 214 | -- |
281 | 2.30.2 | 215 | 2.43.0 |
282 | 216 | ||