summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.9/0002-cmd-go-fix-CC-and-CXX-environment-variable-construct.patch
blob: a4e42261c3020f7307bca4a71c7084da81acaec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From a7170d32a13aead608abd18996f6dab2e2a631b5 Mon Sep 17 00:00:00 2001
From: Matt Madison <matt@madison.systems>
Date: Wed, 13 Sep 2017 08:06:37 -0700
Subject: [PATCH 2/7] cmd/go: fix CC and CXX environment variable construction

For OE cross-builds, CC and CXX have multiple words, and
we need their complete definitions when setting up the
environment during Go builds.

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Matt Madison <matt@madison.systems>
---
 src/cmd/go/internal/envcmd/env.go |  4 ++--
 src/cmd/go/internal/work/build.go | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
index 43d4334..529d21d 100644
--- a/src/cmd/go/internal/envcmd/env.go
+++ b/src/cmd/go/internal/envcmd/env.go
@@ -74,10 +74,10 @@ func MkEnv() []cfg.EnvVar {
 	}
 
 	cmd := b.GccCmd(".")
-	env = append(env, cfg.EnvVar{Name: "CC", Value: cmd[0]})
+	env = append(env, cfg.EnvVar{Name: "CC", Value: strings.Join(b.GccCmdForReal(), " ")})
 	env = append(env, cfg.EnvVar{Name: "GOGCCFLAGS", Value: strings.Join(cmd[3:], " ")})
 	cmd = b.GxxCmd(".")
-	env = append(env, cfg.EnvVar{Name: "CXX", Value: cmd[0]})
+	env = append(env, cfg.EnvVar{Name: "CXX", Value: strings.Join(b.GxxCmdForReal(), " ")})
 
 	if cfg.BuildContext.CgoEnabled {
 		env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "1"})
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
index 7d667ff..85df0b3 100644
--- a/src/cmd/go/internal/work/build.go
+++ b/src/cmd/go/internal/work/build.go
@@ -3127,12 +3127,24 @@ func (b *Builder) GccCmd(objdir string) []string {
 	return b.ccompilerCmd("CC", cfg.DefaultCC, objdir)
 }
 
+// gccCmd returns a gcc command line prefix
+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
+func (b *Builder) GccCmdForReal() []string {
+	return envList("CC", cfg.DefaultCC)
+}
+
 // gxxCmd returns a g++ command line prefix
 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
 func (b *Builder) GxxCmd(objdir string) []string {
 	return b.ccompilerCmd("CXX", cfg.DefaultCXX, objdir)
 }
 
+// gxxCmd returns a g++ command line prefix
+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
+func (b *Builder) GxxCmdForReal() []string {
+	return envList("CXX", cfg.DefaultCXX)
+}
+
 // gfortranCmd returns a gfortran command line prefix.
 func (b *Builder) gfortranCmd(objdir string) []string {
 	return b.ccompilerCmd("FC", "gfortran", objdir)
-- 
2.7.4