summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Quaresma <quaresma.jose@gmail.com>2024-02-28 18:30:05 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-03-03 16:28:17 +0000
commit5065025a66f96140ca895a140067fbde82879941 (patch)
tree1dd09446305cebcf178e241632365974cc7430f3
parentd33a0ef657663faa05448454fad8a004879fe624 (diff)
downloadopenembedded-core-5065025a66f96140ca895a140067fbde82879941.tar.gz
go: rework patch to avoid identation
It's more hard to read but easy to rebase, no functional changes Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/go/go/0005-cmd-dist-separate-host-and-target-builds.patch136
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>
Date: Wed, 23 Oct 2019 21:18:12 +0430
Subject: [PATCH 5/9] cmd/dist: separate host and target builds
-Upstream-Status: Inappropriate [OE specific]
-
Change the dist tool to allow for OE-style cross-
and cross-canadian builds:
@@ -33,13 +31,20 @@ Adapted to Go 1.13 from patches originally submitted to
the meta/recipes-devtools/go tree by
Matt Madison <matt@madison.systems>.
+Rework the patch to avoid identation, it's more hard to read
+but easy to rebase.
+Jose Quaresma <jose.quaresma@foundries.io>
+
+Upstream-Status: Inappropriate [OE specific]
+
Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com>
+Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
- src/cmd/dist/build.go | 152 +++++++++++++++++++++++++++++++-----------
- 1 file changed, 113 insertions(+), 39 deletions(-)
+ src/cmd/dist/build.go | 76 ++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 75 insertions(+), 1 deletion(-)
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
-index 5d31718..1c7f308 100644
+index 5d3171856a..d0ba54c072 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -44,6 +44,7 @@ var (
@@ -119,17 +124,14 @@ index 5d31718..1c7f308 100644
xprintf("\n")
}
-- gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
-- setNoOpt()
-- goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
+ // For split host/target cross/cross-canadian builds, we don't
+ // want to be setting these flags until after we have compiled
+ // the toolchain that runs on the build host.
+ if !crossBuild {
-+ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
-+ setNoOpt()
-+ goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
-+ }
+ gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now
+ setNoOpt()
+ goldflags = os.Getenv("GO_LDFLAGS") // we were using $BOOT_GO_LDFLAGS until now
++}
goBootstrap := pathf("%s/go_bootstrap", tooldir)
cmdGo := pathf("%s/go", gorootBin)
if debug {
@@ -137,25 +139,27 @@ index 5d31718..1c7f308 100644
xprintf("\n")
}
xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n")
-- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
-+ if crossBuild {
++ if !crossBuild {
+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
++} else {
+ os.Setenv("CC", defaultcc[""])
-+ } else {
-+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
+ }
// Now that cmd/go is in charge of the build process, enable GOEXPERIMENT.
os.Setenv("GOEXPERIMENT", goexperiment)
goInstall(goBootstrap, toolchain...)
-@@ -1421,46 +1454,84 @@ func cmdbootstrap() {
+@@ -1421,6 +1454,7 @@ func cmdbootstrap() {
copyfile(pathf("%s/compile3", tooldir), pathf("%s/compile", tooldir), writeExec)
}
-- if goos == oldgoos && goarch == oldgoarch {
-- // Common case - not setting up for cross-compilation.
-- timelog("build", "toolchain")
-- if vflag > 0 {
-- xprintf("\n")
-+ if crossBuild {
++ if !crossBuild {
+ if goos == oldgoos && goarch == oldgoarch {
+ // Common case - not setting up for cross-compilation.
+ timelog("build", "toolchain")
+@@ -1462,6 +1496,42 @@ func cmdbootstrap() {
+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
+ }
++} else {
+ gogcflags = os.Getenv("GO_GCFLAGS")
+ goldflags = os.Getenv("GO_LDFLAGS")
+ tool_files, _ := filepath.Glob(pathf("%s/*", tooldir))
@@ -189,94 +193,24 @@ index 5d31718..1c7f308 100644
+ goInstall(goBootstrap, toBuild...)
+ checkNotStale(goBootstrap, toBuild...)
+ // Skip cmdGo staleness checks here, since we can't run the target's cmdGo binary
- }
-- xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
- } else {
-- // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
-- // Finish GOHOSTOS/GOHOSTARCH installation and then
-- // run GOOS/GOARCH installation.
-- timelog("build", "host toolchain")
-- if vflag > 0 {
-- xprintf("\n")
-+
-+ if goos == oldgoos && goarch == oldgoarch {
-+ // Common case - not setting up for cross-compilation.
-+ timelog("build", "toolchain")
-+ if vflag > 0 {
-+ xprintf("\n")
-+ }
-+ xprintf("Building packages and commands for %s/%s.\n", goos, goarch)
-+ } else {
-+ // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH.
-+ // Finish GOHOSTOS/GOHOSTARCH installation and then
-+ // run GOOS/GOARCH installation.
-+ timelog("build", "host toolchain")
-+ if vflag > 0 {
-+ xprintf("\n")
-+ }
-+ xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
-+ goInstall(goBootstrap, "std", "cmd")
-+ checkNotStale(goBootstrap, "std", "cmd")
-+ checkNotStale(cmdGo, "std", "cmd")
-+
-+ timelog("build", "target toolchain")
-+ if vflag > 0 {
-+ xprintf("\n")
-+ }
-+ goos = oldgoos
-+ goarch = oldgoarch
-+ os.Setenv("GOOS", goos)
-+ os.Setenv("GOARCH", goarch)
-+ os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
-+ xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
- }
-- xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
- goInstall(goBootstrap, "std", "cmd")
- checkNotStale(goBootstrap, "std", "cmd")
- checkNotStale(cmdGo, "std", "cmd")
-
-- timelog("build", "target toolchain")
-- if vflag > 0 {
-- xprintf("\n")
-+ if debug {
-+ run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
-+ run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
-+ checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
-+ copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
- }
-- goos = oldgoos
-- goarch = oldgoarch
-- os.Setenv("GOOS", goos)
-- os.Setenv("GOARCH", goarch)
-- os.Setenv("CC", compilerEnvLookup(defaultcc, goos, goarch))
-- xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
-- }
-- targets := []string{"std", "cmd"}
-- goInstall(goBootstrap, targets...)
-- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
-- checkNotStale(goBootstrap, targets...)
-- checkNotStale(cmdGo, targets...)
-- if debug {
-- run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
-- checkNotStale(goBootstrap, append(toolchain, "runtime/internal/sys")...)
-- copyfile(pathf("%s/compile4", tooldir), pathf("%s/compile", tooldir), writeExec)
- }
++ }
++ }
// Check that there are no new files in $GOROOT/bin other than
-@@ -1477,8 +1548,11 @@ func cmdbootstrap() {
+ // go and gofmt and $GOOS_$GOARCH (target bin when cross-compiling).
+@@ -1477,8 +1547,12 @@ func cmdbootstrap() {
}
}
-- // Remove go_bootstrap now that we're done.
-- xremove(pathf("%s/go_bootstrap", tooldir))
+ // Except that for split host/target cross-builds, we need to
+ // keep it.
+ if !crossBuild {
-+ xremove(pathf("%s/go_bootstrap", tooldir))
-+ }
+ // Remove go_bootstrap now that we're done.
+ xremove(pathf("%s/go_bootstrap", tooldir))
++}
if goos == "android" {
// Make sure the exec wrapper will sync a fresh $GOROOT to the device.
--
-2.30.2
+2.43.0