From b41aaa851f0074682fcd4bf07c891fbdf0fdf70c Mon Sep 17 00:00:00 2001
From: Alex Kube <alexander.j.kube@gmail.com>
Date: Sat, 22 Feb 2025 03:14:37 -0800
Subject: [PATCH 04/11] make.bash: override CC when building dist and
 go_bootstrap

for handling OE cross-canadian builds.

Adapted to Go 1.13 from patches originally submitted to
the meta/recipes-devtools/go tree by
Matt Madison <matt@madison.systems>.

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>

Rebase to 1.23.4
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 src/make.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/make.bash b/src/make.bash
index b67ae1529f..b59cdabd09 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -153,7 +153,7 @@ fi
 export GOROOT_BOOTSTRAP
 
 bootstrapenv() {
-	GOROOT="$GOROOT_BOOTSTRAP" GO111MODULE=off GOENV=off GOOS= GOARCH= GOEXPERIMENT= GOFLAGS= "$@"
+	CC="${BUILD_CC:-${CC}}" GOROOT="$GOROOT_BOOTSTRAP" GO111MODULE=off GOENV=off GOOS= GOARCH= GOEXPERIMENT= GOFLAGS= "$@"
 }
 
 export GOROOT="$(cd .. && pwd)"
@@ -216,7 +216,7 @@ fi
 # Run dist bootstrap to complete make.bash.
 # Bootstrap installs a proper cmd/dist, built with the new toolchain.
 # Throw ours, built with the bootstrap toolchain, away after bootstrap.
-./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@"
+CC="${BUILD_CC:-${CC}}" ./cmd/dist/dist bootstrap -a $vflag $GO_DISTFLAGS "$@"
 rm -f ./cmd/dist/dist
 
 # DO NOT ADD ANY NEW CODE HERE.
-- 
2.25.1

