summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZongchun Yu <zongchun.yu@nxp.com>2016-04-05 17:54:28 +0800
committerBruce Ashfield <bruce.ashfield@windriver.com>2016-04-19 15:51:10 -0400
commit12c601cd2df52ad123b337647eeb990f46422a25 (patch)
tree9fd33cda1e85643fe6baa408ccb67bd0b4c166b4
parent841dc6f3a2a77bda2a1cd2bb7bcd6f3e709699db (diff)
downloadmeta-virtualization-12c601cd2df52ad123b337647eeb990f46422a25.tar.gz
go-cross: uprev to 1.5.2
* Add go-native as build bootstrap for go-cross. * Upgrade go-cross to v1.5.2 Signed-off-by: Zongchun Yu <zongchun.yu@nxp.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--classes/go-osarchmap.bbclass38
-rw-r--r--recipes-devtools/go-cross/files/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch30
-rw-r--r--recipes-devtools/go-cross/files/bsd_svid_source.patch37
-rw-r--r--recipes-devtools/go-cross/files/ccache.patch147
-rw-r--r--recipes-devtools/go-cross/go-1.4.inc14
-rw-r--r--recipes-devtools/go-cross/go-1.4/016-armhf-elf-header.patch21
-rw-r--r--recipes-devtools/go-cross/go-1.4/syslog.patch57
-rw-r--r--recipes-devtools/go-cross/go-1.5.inc19
-rw-r--r--recipes-devtools/go-cross/go-1.5/armhf-elf-header.patch19
-rw-r--r--recipes-devtools/go-cross/go-1.5/fix-cc-handling.patch46
-rw-r--r--recipes-devtools/go-cross/go-1.5/fix-target-cc-for-build.patch13
-rw-r--r--recipes-devtools/go-cross/go-1.5/gotooldir.patch26
-rw-r--r--recipes-devtools/go-cross/go-1.5/split-host-and-target-build.patch58
-rw-r--r--recipes-devtools/go-cross/go-1.5/syslog.patch57
-rw-r--r--recipes-devtools/go-cross/go-common.inc20
-rw-r--r--recipes-devtools/go-cross/go-cross-1.3_1.3.bb72
-rw-r--r--recipes-devtools/go-cross/go-cross.inc45
-rw-r--r--recipes-devtools/go-cross/go-cross_1.5.bb2
-rw-r--r--recipes-devtools/go-cross/go-native.inc50
-rw-r--r--recipes-devtools/go-cross/go-native_1.4.bb2
20 files changed, 487 insertions, 286 deletions
diff --git a/classes/go-osarchmap.bbclass b/classes/go-osarchmap.bbclass
new file mode 100644
index 00000000..4e00c7bf
--- /dev/null
+++ b/classes/go-osarchmap.bbclass
@@ -0,0 +1,38 @@
1BUILD_GOOS = "${@go_map_os(d.getVar('BUILD_OS', True), d)}"
2BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH', True), d)}"
3BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}"
4HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS', True), d)}"
5HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH', True), d)}"
6HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH', True), d.getVar('TUNE_FEATURES', True), d)}"
7HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}"
8TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS', True), d)}"
9TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH', True), d)}"
10TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH', True), d.getVar('TUNE_FEATURES', True), d)}"
11TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
12GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE',True) == d.getVar('HOST_GOTUPLE',True)]}"
13
14def go_map_arch(a, d):
15 import re
16 if re.match('i.86', a):
17 return '386'
18 elif a == 'x86_64':
19 return 'amd64'
20 elif re.match('arm.*', a):
21 return 'arm'
22 elif re.match('aarch64.*', a):
23 return 'arm64'
24 elif re.match('p(pc|owerpc)(|64)', a):
25 return 'powerpc'
26 else:
27 bb.error("cannot map '%s' to a Go architecture" % a)
28
29def go_map_arm(a, f, d):
30 import re
31 if re.match('arm.*', a) and re.match('arm.*7.*', f):
32 return '7'
33 return ''
34
35def go_map_os(o, d):
36 if o.startswith('linux'):
37 return 'linux'
38 return o
diff --git a/recipes-devtools/go-cross/files/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch b/recipes-devtools/go-cross/files/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
deleted file mode 100644
index 4cfa9d1b..00000000
--- a/recipes-devtools/go-cross/files/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 855145d5c03c4b4faf60736c38d7a299c682af4a Mon Sep 17 00:00:00 2001
2From: Shenghou Ma <minux@golang.org>
3Date: Sat, 7 Feb 2015 14:06:02 -0500
4Subject: [PATCH] cmd/ld: set alignment for the .rel.plt section on 32-bit
5 architectures
6
7Fixes #9802.
8
9Change-Id: I22c52a37bdb23a14cc4615c9519431bb14ca81ca
10Reviewed-on: https://go-review.googlesource.com/4170
11Reviewed-by: Ian Lance Taylor <iant@golang.org>
12---
13 src/cmd/ld/elf.c | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c
17index 12ced98..97ed4bd 100644
18--- a/src/cmd/ld/elf.c
19+++ b/src/cmd/ld/elf.c
20@@ -1363,6 +1363,7 @@ asmbelf(vlong symo)
21 sh->type = SHT_REL;
22 sh->flags = SHF_ALLOC;
23 sh->entsize = ELF32RELSIZE;
24+ sh->addralign = 4;
25 sh->link = elfshname(".dynsym")->shnum;
26 shsym(sh, linklookup(ctxt, ".rel.plt", 0));
27
28--
291.9.1
30
diff --git a/recipes-devtools/go-cross/files/bsd_svid_source.patch b/recipes-devtools/go-cross/files/bsd_svid_source.patch
deleted file mode 100644
index 21e1d4cb..00000000
--- a/recipes-devtools/go-cross/files/bsd_svid_source.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1golang-cross: do_compile fails cc1: all warnings being treated as errors
2
3glibc 2.20 deprecates _BSD_SOURCE and _SVID_SOURCE and emits an error
4message. From patch 16632:
5 libc [PATCH] BZ #16632: Disable _SVID_SOURCE/_BSD_SOURCE warning
6 if _DEFAULT_SOURCE is defined
7
8Since we also need to support glibc before 2.20, from the release notes
9for glibc 2.20, the recommended fix is to define _DEFAULT_SOURCE
10
11(fixed upstream)
12https://groups.google.com/forum/#!topic/golang-codereviews/S4TARFCxu2k
13
14Signed-off-by: Amy Fong <amy.fong@windriver.com>
15---
16 include/u.h | 10 ++++++++++
17 1 file changed, 10 insertions(+)
18
19--- a/include/u.h
20+++ b/include/u.h
21@@ -38,6 +38,16 @@
22 # define __MAKECONTEXT_V2_SOURCE 1
23 # endif
24 #endif
25+/**
26+ * in glibc >= 2.20, _BSD_SOURCE and _SVID_SOURCE causes warning
27+ * messages if _DEFAULT_SOURCE is not defined.
28+ *
29+ * From glibc 2.20 release notes, since this application needs _BSD_SOURCE
30+ * and/or _SVID_SOURCE and we must support glibc < 2.19 and
31+ * glibc >= 2.20, then define all 3 (_DEFAULT_SOURCE, _BSD_SOURCE,
32+ * and _SVID_SOURCE) unconditionally
33+ */
34+#define _DEFAULT_SOURCE 1
35 #define _BSD_SOURCE 1
36 #define _NETBSD_SOURCE 1 /* NetBSD */
37 #define _SVID_SOURCE 1
diff --git a/recipes-devtools/go-cross/files/ccache.patch b/recipes-devtools/go-cross/files/ccache.patch
deleted file mode 100644
index b7a64bf7..00000000
--- a/recipes-devtools/go-cross/files/ccache.patch
+++ /dev/null
@@ -1,147 +0,0 @@
1golang doesn't work with ccache. In the current state, a lot of parsing
2happens where it'll grab the first string in CC or LD and uses that for
3its builds. When ccache is enabled, it results in trying to do builds
4with just ccache.
5
6The brokeness is seen when building with apps that uses cgo, like docker.
7To enable ccache to work, some string comparisons and changes to parsing
8had to be made.
9
10Signed-off-by: Amy Fong <amy.fong@windriver.com>
11
12Index: go/src/cmd/cgo/gcc.go
13===================================================================
14--- go.orig/src/cmd/cgo/gcc.go 2014-06-18 17:26:26.000000000 -0700
15+++ go/src/cmd/cgo/gcc.go 2015-06-18 13:19:08.908877160 -0700
16@@ -712,6 +712,12 @@
17 func (p *Package) gccBaseCmd() []string {
18 // Use $CC if set, since that's what the build uses.
19 if ret := strings.Fields(os.Getenv("CC")); len(ret) > 0 {
20+ if strings.Contains(ret[0], "ccache") {
21+ base_cc := ret[0] + " " + ret[1]
22+ os.Setenv("CCACHE_CC", ret[1])
23+ ret[1] = base_cc
24+ return ret[1:]
25+ }
26 return ret
27 }
28 // Try $GCC if set, since that's what we used to use.
29Index: go/src/pkg/os/exec/lp_unix.go
30===================================================================
31--- go.orig/src/pkg/os/exec/lp_unix.go 2014-06-18 17:26:25.000000000 -0700
32+++ go/src/pkg/os/exec/lp_unix.go 2015-06-18 13:19:29.464876331 -0700
33@@ -35,8 +35,14 @@
34 // (only bypass the path if file begins with / or ./ or ../)
35 // but that would not match all the Unix shells.
36
37- if strings.Contains(file, "/") {
38- err := findExecutable(file)
39+ tmp := file
40+ if strings.Contains(file, " ") {
41+ exec_part := strings.Split(file, " ")[0]
42+ tmp = exec_part
43+ }
44+
45+ if strings.Contains(tmp, "/") {
46+ err := findExecutable(tmp)
47 if err == nil {
48 return file, nil
49 }
50@@ -51,7 +57,7 @@
51 // Unix shell semantics: path element "" means "."
52 dir = "."
53 }
54- path := dir + "/" + file
55+ path := dir + "/" + tmp
56 if err := findExecutable(path); err == nil {
57 return path, nil
58 }
59Index: go/src/cmd/go/build.go
60===================================================================
61--- go.orig/src/cmd/go/build.go 2014-06-18 17:26:26.000000000 -0700
62+++ go/src/cmd/go/build.go 2015-06-18 13:20:08.724874749 -0700
63@@ -2005,8 +2005,15 @@
64 // strings returned are "gcc", "-I", objdir (and cuts them off).
65
66 compiler := envList(envvar, defcmd)
67- a := []string{compiler[0], "-I", objdir}
68- a = append(a, compiler[1:]...)
69+
70+ a := []string{compiler[0]}
71+ if strings.Contains(compiler[0], "ccache") {
72+ a = append(a, compiler[1], "-I", objdir)
73+ a = append(a, compiler[2:]...)
74+ } else {
75+ a = append(a, "-I", objdir)
76+ a = append(a, compiler[1:]...)
77+ }
78
79 // Definitely want -fPIC but on Windows gcc complains
80 // "-fPIC ignored for target (all code is position independent)"
81Index: go/src/cmd/ld/lib.c
82===================================================================
83--- go.orig/src/cmd/ld/lib.c 2014-06-18 17:26:27.000000000 -0700
84+++ go/src/cmd/ld/lib.c 2015-06-18 13:18:39.564878343 -0700
85@@ -552,7 +552,7 @@
86 void
87 hostlink(void)
88 {
89- char *p, **argv;
90+ char *p, *q, **argv;
91 int c, i, w, n, argc, len;
92 Hostobj *h;
93 Biobuf *f;
94@@ -577,6 +577,19 @@
95 if(extld == nil)
96 extld = "gcc";
97 argv[argc++] = extld;
98+
99+ p = extldflags;
100+ if (strstr(argv[0], "ccache") != NULL) {
101+ while(p != nil) {
102+ while(*p == ' ')
103+ *p++ = '\0';
104+ if(*p == '\0')
105+ break;
106+ argv[argc++] = p;
107+ p = strchr(p + 1, ' ');
108+ break;
109+ }
110+ }
111 switch(thechar){
112 case '8':
113 argv[argc++] = "-m32";
114@@ -629,12 +642,12 @@
115 errorexit();
116 }
117 Bseek(f, h->off, 0);
118- p = smprint("%s/%06d.o", tmpdir, i);
119- argv[argc++] = p;
120- w = create(p, 1, 0775);
121+ q = smprint("%s/%06d.o", tmpdir, i);
122+ argv[argc++] = q;
123+ w = create(q, 1, 0775);
124 if(w < 0) {
125 ctxt->cursym = S;
126- diag("cannot create %s: %r", p);
127+ diag("cannot create %s: %r", q);
128 errorexit();
129 }
130 len = h->len;
131@@ -646,7 +659,7 @@
132 }
133 if(close(w) < 0) {
134 ctxt->cursym = S;
135- diag("cannot write %s: %r", p);
136+ diag("cannot write %s: %r", q);
137 errorexit();
138 }
139 Bterm(f);
140@@ -656,7 +669,6 @@
141 for(i=0; i<nldflag; i++)
142 argv[argc++] = ldflag[i];
143
144- p = extldflags;
145 while(p != nil) {
146 while(*p == ' ')
147 *p++ = '\0';
diff --git a/recipes-devtools/go-cross/go-1.4.inc b/recipes-devtools/go-cross/go-1.4.inc
new file mode 100644
index 00000000..0ffbcd0a
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.4.inc
@@ -0,0 +1,14 @@
1require go-common.inc
2
3PV = "1.4.2"
4GO_BASEVERSION = "1.4"
5FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
6
7SRC_URI += "\
8 file://016-armhf-elf-header.patch \
9 file://syslog.patch \
10"
11
12LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
13SRC_URI[md5sum] = "907f85c8fa765d31f7f955836fec4049"
14SRC_URI[sha256sum] = "299a6fd8f8adfdce15bc06bde926e7b252ae8e24dd5b16b7d8791ed79e7b5e9b"
diff --git a/recipes-devtools/go-cross/go-1.4/016-armhf-elf-header.patch b/recipes-devtools/go-cross/go-1.4/016-armhf-elf-header.patch
new file mode 100644
index 00000000..1ae53a38
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.4/016-armhf-elf-header.patch
@@ -0,0 +1,21 @@
1Description: Use correct ELF header for armhf binaries.
2Author: Adam Conrad <adconrad@ubuntu.com>
3Last-Update: 2013-07-08
4
5Index: go/src/cmd/ld/elf.c
6===================================================================
7--- go.orig/src/cmd/ld/elf.c 2015-02-20 10:49:58.763451586 -0800
8+++ go/src/cmd/ld/elf.c 2015-02-20 10:49:27.895478521 -0800
9@@ -57,7 +57,11 @@
10 case '5':
11 // we use EABI on both linux/arm and freebsd/arm.
12 if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)
13- hdr.flags = 0x5000002; // has entry point, Version5 EABI
14+#ifdef __ARM_PCS_VFP
15+ hdr.flags = 0x5000402; // has entry point, Version5 EABI, hard-float ABI
16+#else
17+ hdr.flags = 0x5000202; // has entry point, Version5 EABI, soft-float ABI
18+#endif
19 // fallthrough
20 default:
21 hdr.phoff = ELF32HDRSIZE; /* Must be be ELF32HDRSIZE: first PHdr must follow ELF header */
diff --git a/recipes-devtools/go-cross/go-1.4/syslog.patch b/recipes-devtools/go-cross/go-1.4/syslog.patch
new file mode 100644
index 00000000..ce82a4f2
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.4/syslog.patch
@@ -0,0 +1,57 @@
1diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
2--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
3+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
4@@ -33,6 +33,9 @@
5 const severityMask = 0x07
6 const facilityMask = 0xf8
7
8+var writeTimeout = 1 * time.Second
9+var connectTimeout = 1 * time.Second
10+
11 const (
12 // Severity.
13
14@@ -100,6 +103,7 @@
15 type serverConn interface {
16 writeString(p Priority, hostname, tag, s, nl string) error
17 close() error
18+ setWriteDeadline(t time.Time) error
19 }
20
21 type netConn struct {
22@@ -273,7 +277,11 @@
23 nl = "\n"
24 }
25
26- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
27+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
28+ if err != nil {
29+ return 0, err
30+ }
31+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32 if err != nil {
33 return 0, err
34 }
35@@ -305,6 +313,10 @@
36 return n.conn.Close()
37 }
38
39+func (n *netConn) setWriteDeadline(t time.Time) error {
40+ return n.conn.SetWriteDeadline(t)
41+}
42+
43 // NewLogger creates a log.Logger whose output is written to
44 // the system log service with the specified priority. The logFlag
45 // argument is the flag set passed through to log.New to create
46diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
47--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
48+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
49@@ -19,7 +19,7 @@
50 logPaths := []string{"/dev/log", "/var/run/syslog"}
51 for _, network := range logTypes {
52 for _, path := range logPaths {
53- conn, err := net.Dial(network, path)
54+ conn, err := net.DialTimeout(network, path, connectTimeout)
55 if err != nil {
56 continue
57 } else {
diff --git a/recipes-devtools/go-cross/go-1.5.inc b/recipes-devtools/go-cross/go-1.5.inc
new file mode 100644
index 00000000..bb91ed8a
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.5.inc
@@ -0,0 +1,19 @@
1require go-common.inc
2
3PV = "1.5.2"
4GO_BASEVERSION = "1.5"
5FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
6
7
8SRC_URI += "\
9 file://armhf-elf-header.patch \
10 file://syslog.patch \
11 file://fix-target-cc-for-build.patch \
12 file://fix-cc-handling.patch \
13 file://split-host-and-target-build.patch \
14 file://gotooldir.patch \
15"
16
17LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
18SRC_URI[md5sum] = "38fed22e7b80672291e7cba7fb9c3475"
19SRC_URI[sha256sum] = "f3ddd624c00461641ce3d3a8d8e3c622392384ca7699e901b370a4eac5987a74"
diff --git a/recipes-devtools/go-cross/go-1.5/armhf-elf-header.patch b/recipes-devtools/go-cross/go-1.5/armhf-elf-header.patch
new file mode 100644
index 00000000..f56869b2
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.5/armhf-elf-header.patch
@@ -0,0 +1,19 @@
1Index: go/src/cmd/link/internal/ld/elf.go
2===================================================================
3--- go.orig/src/cmd/link/internal/ld/elf.go 2015-07-29 13:05:25.952533140 -0700
4+++ go/src/cmd/link/internal/ld/elf.go 2015-07-29 13:14:53.413112995 -0700
5@@ -780,7 +780,13 @@
6 // 32-bit architectures
7 case '5':
8 // we use EABI on both linux/arm and freebsd/arm.
9- if HEADTYPE == obj.Hlinux || HEADTYPE == obj.Hfreebsd {
10+ if HEADTYPE == obj.Hlinux {
11+ if Ctxt.Goarm == 7 {
12+ ehdr.flags = 0x5000402 // has entry point, Version5 EABI, hard float
13+ } else {
14+ ehdr.flags = 0x5000202 // has entry point, Version5 EABI, soft float
15+ }
16+ } else if HEADTYPE == obj.Hfreebsd {
17 ehdr.flags = 0x5000002 // has entry point, Version5 EABI
18 }
19 fallthrough
diff --git a/recipes-devtools/go-cross/go-1.5/fix-cc-handling.patch b/recipes-devtools/go-cross/go-1.5/fix-cc-handling.patch
new file mode 100644
index 00000000..85770a93
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.5/fix-cc-handling.patch
@@ -0,0 +1,46 @@
1Index: go/src/cmd/go/build.go
2===================================================================
3--- go.orig/src/cmd/go/build.go 2015-07-29 14:48:40.323185807 -0700
4+++ go/src/cmd/go/build.go 2015-07-30 07:37:40.529818586 -0700
5@@ -2805,12 +2805,24 @@
6 return b.ccompilerCmd("CC", defaultCC, objdir)
7 }
8
9+// gccCmd returns a gcc command line prefix
10+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
11+func (b *builder) gccCmdForReal() []string {
12+ return envList("CC", defaultCC)
13+}
14+
15 // gxxCmd returns a g++ command line prefix
16 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
17 func (b *builder) gxxCmd(objdir string) []string {
18 return b.ccompilerCmd("CXX", defaultCXX, objdir)
19 }
20
21+// gxxCmd returns a g++ command line prefix
22+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
23+func (b *builder) gxxCmdForReal() []string {
24+ return envList("CXX", defaultCXX)
25+}
26+
27 // ccompilerCmd returns a command line prefix for the given environment
28 // variable and using the default command when the variable is empty.
29 func (b *builder) ccompilerCmd(envvar, defcmd, objdir string) []string {
30Index: go/src/cmd/go/env.go
31===================================================================
32--- go.orig/src/cmd/go/env.go 2015-07-29 14:48:40.323185807 -0700
33+++ go/src/cmd/go/env.go 2015-07-30 07:40:54.461655721 -0700
34@@ -52,10 +52,9 @@
35
36 if goos != "plan9" {
37 cmd := b.gccCmd(".")
38- env = append(env, envVar{"CC", cmd[0]})
39+ env = append(env, envVar{"CC", strings.Join(b.gccCmdForReal(), " ")})
40 env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
41- cmd = b.gxxCmd(".")
42- env = append(env, envVar{"CXX", cmd[0]})
43+ env = append(env, envVar{"CXX", strings.Join(b.gxxCmdForReal(), " ")})
44 }
45
46 if buildContext.CgoEnabled {
diff --git a/recipes-devtools/go-cross/go-1.5/fix-target-cc-for-build.patch b/recipes-devtools/go-cross/go-1.5/fix-target-cc-for-build.patch
new file mode 100644
index 00000000..adfeb6b5
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.5/fix-target-cc-for-build.patch
@@ -0,0 +1,13 @@
1Index: go/src/make.bash
2===================================================================
3--- go.orig/src/make.bash 2015-07-29 13:28:11.334031696 -0700
4+++ go/src/make.bash 2015-07-29 13:36:55.814465630 -0700
5@@ -158,7 +158,7 @@
6 fi
7
8 echo "##### Building packages and commands for $GOOS/$GOARCH."
9-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
10+CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
11 echo
12
13 rm -f "$GOTOOLDIR"/go_bootstrap
diff --git a/recipes-devtools/go-cross/go-1.5/gotooldir.patch b/recipes-devtools/go-cross/go-1.5/gotooldir.patch
new file mode 100644
index 00000000..473a3280
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.5/gotooldir.patch
@@ -0,0 +1,26 @@
1Index: go/src/go/build/build.go
2===================================================================
3--- go.orig/src/go/build/build.go
4+++ go/src/go/build/build.go
5@@ -1388,7 +1388,7 @@ func init() {
6 }
7
8 // ToolDir is the directory containing build tools.
9-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
10+var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH))
11
12 // IsLocalImport reports whether the import path is
13 // a local import path, like ".", "..", "./foo", or "../foo".
14Index: go/src/cmd/go/build.go
15===================================================================
16--- go.orig/src/cmd/go/build.go
17+++ go/src/cmd/go/build.go
18@@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err
19 }
20
21 cgoExe := tool("cgo")
22- if a.cgo != nil && a.cgo.target != "" {
23+ if a.cgo != nil && a.cgo.target != "" && os.Getenv("GOTOOLDIR") == "" {
24 cgoExe = a.cgo.target
25 }
26 outGo, outObj, err := b.cgo(a.p, cgoExe, obj, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, cxxfiles, a.p.MFiles)
diff --git a/recipes-devtools/go-cross/go-1.5/split-host-and-target-build.patch b/recipes-devtools/go-cross/go-1.5/split-host-and-target-build.patch
new file mode 100644
index 00000000..85fb240a
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.5/split-host-and-target-build.patch
@@ -0,0 +1,58 @@
1Index: go/src/make.bash
2===================================================================
3--- go.orig/src/make.bash
4+++ go/src/make.bash
5@@ -143,12 +143,23 @@ if [ "$1" = "--no-clean" ]; then
6 buildall=""
7 shift
8 fi
9-./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
10-# Delay move of dist tool to now, because bootstrap may clear tool directory.
11-mv cmd/dist/dist "$GOTOOLDIR"/dist
12-echo
13
14-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
15+do_host_build="yes"
16+do_target_build="yes"
17+if [ "$1" = "--target-only" ]; then
18+ do_host_build="no"
19+ shift
20+elif [ "$1" = "--host-only" ]; then
21+ do_target_build="no"
22+ shift
23+fi
24+
25+if [ "$do_host_build" = "yes" ]; then
26+ ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
27+ # Delay move of dist tool to now, because bootstrap may clear tool directory.
28+ mv cmd/dist/dist "$GOTOOLDIR"/dist
29+ echo
30+
31 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
32 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
33 # use the host compiler, CC, from `cmd/dist/dist env` instead.
34@@ -157,11 +168,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
35 echo
36 fi
37
38-echo "##### Building packages and commands for $GOOS/$GOARCH."
39-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
40-echo
41+if [ "$do_target_build" = "yes" ]; then
42+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}"
43+ echo "##### Building packages and commands for $GOOS/$GOARCH."
44+ if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a "$do_host_build" = "yes" ]; then
45+ rm -rf ./host-tools
46+ mkdir ./host-tools
47+ mv "$GOTOOLDIR"/* ./host-tools
48+ GOTOOLDIR="$PWD/host-tools"
49+ fi
50+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL}
51+ echo
52
53-rm -f "$GOTOOLDIR"/go_bootstrap
54+ rm -f "$GOTOOLDIR"/go_bootstrap
55+fi
56
57 if [ "$1" != "--no-banner" ]; then
58 "$GOTOOLDIR"/dist banner
diff --git a/recipes-devtools/go-cross/go-1.5/syslog.patch b/recipes-devtools/go-cross/go-1.5/syslog.patch
new file mode 100644
index 00000000..ce82a4f2
--- /dev/null
+++ b/recipes-devtools/go-cross/go-1.5/syslog.patch
@@ -0,0 +1,57 @@
1diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
2--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
3+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
4@@ -33,6 +33,9 @@
5 const severityMask = 0x07
6 const facilityMask = 0xf8
7
8+var writeTimeout = 1 * time.Second
9+var connectTimeout = 1 * time.Second
10+
11 const (
12 // Severity.
13
14@@ -100,6 +103,7 @@
15 type serverConn interface {
16 writeString(p Priority, hostname, tag, s, nl string) error
17 close() error
18+ setWriteDeadline(t time.Time) error
19 }
20
21 type netConn struct {
22@@ -273,7 +277,11 @@
23 nl = "\n"
24 }
25
26- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
27+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
28+ if err != nil {
29+ return 0, err
30+ }
31+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32 if err != nil {
33 return 0, err
34 }
35@@ -305,6 +313,10 @@
36 return n.conn.Close()
37 }
38
39+func (n *netConn) setWriteDeadline(t time.Time) error {
40+ return n.conn.SetWriteDeadline(t)
41+}
42+
43 // NewLogger creates a log.Logger whose output is written to
44 // the system log service with the specified priority. The logFlag
45 // argument is the flag set passed through to log.New to create
46diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
47--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
48+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
49@@ -19,7 +19,7 @@
50 logPaths := []string{"/dev/log", "/var/run/syslog"}
51 for _, network := range logTypes {
52 for _, path := range logPaths {
53- conn, err := net.Dial(network, path)
54+ conn, err := net.DialTimeout(network, path, connectTimeout)
55 if err != nil {
56 continue
57 } else {
diff --git a/recipes-devtools/go-cross/go-common.inc b/recipes-devtools/go-cross/go-common.inc
new file mode 100644
index 00000000..f9587ea9
--- /dev/null
+++ b/recipes-devtools/go-cross/go-common.inc
@@ -0,0 +1,20 @@
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."
11HOMEPAGE = " http://golang.org/"
12LICENSE = "BSD-3-Clause"
13
14inherit go-osarchmap
15
16SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz"
17S = "${WORKDIR}/go"
18B = "${S}"
19
20INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/recipes-devtools/go-cross/go-cross-1.3_1.3.bb b/recipes-devtools/go-cross/go-cross-1.3_1.3.bb
deleted file mode 100644
index dd57e561..00000000
--- a/recipes-devtools/go-cross/go-cross-1.3_1.3.bb
+++ /dev/null
@@ -1,72 +0,0 @@
1DESCRIPTION = "\
2 Go is an open source programming language that makes it easy to build simple, \
3 reliable, and efficient software. \
4 "
5HOMEPAGE = "https://golang.org/"
6LICENSE = "BSD-3-Clause"
7
8DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc"
9
10SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz"
11
12S = "${WORKDIR}/go/"
13
14inherit cross
15
16LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
17SRC_URI[md5sum] = "4b66d7249554181c314f139ea78920b1"
18SRC_URI[sha256sum] = "eb983e6c5b2b9838f482c5442b1ac1856f610f2b21f3c123b3fedb48ffc35382"
19
20SRC_URI += "\
21 file://bsd_svid_source.patch \
22 file://ccache.patch \
23 file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \
24 "
25
26do_compile() {
27 ## Setting `$GOBIN` doesn't do any good, looks like it ends up copying binaries there.
28 export GOROOT_FINAL="${SYSROOT}${libdir}/go-1.3"
29
30 export GOHOSTOS="linux"
31 export GOOS="linux"
32
33 export GOARCH="${TARGET_ARCH}"
34 # golang only support 386, amd64 and arm architecture.
35 if [ "${TARGET_ARCH}" = "x86_64" ]; then
36 export GOARCH="amd64"
37 elif [ "${TARGET_ARCH}" = "i586" ]; then
38 export GOARCH="386"
39 fi
40 if [ "${TARGET_ARCH}" = "arm" ]
41 then
42 if [ `echo ${TUNE_PKGARCH} | cut -c 1-7` = "cortexa" ]
43 then
44 echo GOARM 7
45 export GOARM="7"
46 fi
47 fi
48
49 export CGO_ENABLED="1"
50 ## TODO: consider setting GO_EXTLINK_ENABLED
51
52 export CC="${BUILD_CC}"
53 export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
54 export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
55 export GO_CCFLAGS="${HOST_CFLAGS}"
56 export GO_LDFLAGS="${HOST_LDFLAGS}"
57
58 cd src && ./make.bash
59}
60
61do_install() {
62 ## It should be okay to ignore `${WORKDIR}/go/bin/linux_arm`...
63 ## Also `gofmt` is not needed right now.
64 install -d "${D}${bindir}/go-1.3"
65 install -m 0755 "${WORKDIR}/go/bin/go" "${D}${bindir}/go-1.3/"
66 install -d "${D}${libdir}/go-1.3"
67
68 ## TODO: use `install` instead of `cp`
69 for dir in include lib pkg src test
70 do cp -a "${WORKDIR}/go/${dir}" "${D}${libdir}/go-1.3/"
71 done
72}
diff --git a/recipes-devtools/go-cross/go-cross.inc b/recipes-devtools/go-cross/go-cross.inc
new file mode 100644
index 00000000..eea1b2ce
--- /dev/null
+++ b/recipes-devtools/go-cross/go-cross.inc
@@ -0,0 +1,45 @@
1inherit cross
2
3DEPENDS += "go-native"
4
5export GOHOSTOS = "${BUILD_GOOS}"
6export GOHOSTARCH = "${BUILD_GOARCH}"
7export GOOS = "${TARGET_GOOS}"
8export GOARCH = "${TARGET_GOARCH}"
9export GOARM = "${TARGET_GOARM}"
10export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
11export GOROOT_FINAL = "${libdir}/go"
12export CGO_ENABLED = "1"
13export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
14export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
15CC = "${@d.getVar('BUILD_CC', True).strip()}"
16
17do_configure[noexec] = "1"
18
19do_compile() {
20 export GOBIN="${B}/bin"
21 rm -rf ${GOBIN} ${B}/pkg
22 mkdir ${GOBIN}
23 cd src
24 ./make.bash --host-only
25}
26
27do_install() {
28 install -d ${D}${libdir}/go
29 cp -a ${B}/pkg ${D}${libdir}/go/
30 install -d ${D}${libdir}/go/src
31 (cd ${S}/src; for d in *; do \
32 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
33 done)
34 install -d ${D}${bindir}
35 for f in ${B}/bin/*
36 do
37 install -m755 $f ${D}${bindir}
38 done
39}
40
41do_package[noexec] = "1"
42do_packagedata[noexec] = "1"
43do_package_write_ipk[noexec] = "1"
44do_package_write_deb[noexec] = "1"
45do_package_write_rpm[noexec] = "1"
diff --git a/recipes-devtools/go-cross/go-cross_1.5.bb b/recipes-devtools/go-cross/go-cross_1.5.bb
new file mode 100644
index 00000000..80b5a03f
--- /dev/null
+++ b/recipes-devtools/go-cross/go-cross_1.5.bb
@@ -0,0 +1,2 @@
1require go-cross.inc
2require go-${PV}.inc
diff --git a/recipes-devtools/go-cross/go-native.inc b/recipes-devtools/go-cross/go-native.inc
new file mode 100644
index 00000000..ae3dc830
--- /dev/null
+++ b/recipes-devtools/go-cross/go-native.inc
@@ -0,0 +1,50 @@
1inherit native
2
3export GOOS = "${BUILD_GOOS}"
4export GOARCH = "${BUILD_GOARCH}"
5export GOROOT_FINAL = "${STAGING_LIBDIR_NATIVE}/go"
6export CGO_ENABLED = "1"
7
8do_configure[noexec] = "1"
9
10do_compile() {
11 export GOBIN="${B}/bin"
12 rm -rf ${GOBIN}
13 mkdir ${GOBIN}
14 cd src
15 ./make.bash --host-only
16}
17
18
19make_wrapper() {
20 rm -f ${D}${bindir}/$2
21 cat <<END >${D}${bindir}/$2
22#!/bin/bash
23here=\`dirname \$0\`
24export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
25\$here/../lib/go/bin/$1 "\$@"
26END
27 chmod +x ${D}${bindir}/$2
28}
29
30do_install() {
31 install -d ${D}${libdir}/go
32 cp -a ${B}/pkg ${D}${libdir}/go/
33 install -d ${D}${libdir}/go/src
34 (cd ${S}/src; for d in *; do \
35 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
36 done)
37 install -d ${D}${bindir} ${D}${libdir}/go/bin
38 for f in ${B}/bin/*
39 do
40 base=`basename $f`
41 install -m755 $f ${D}${libdir}/go/bin
42 make_wrapper $base $base
43 done
44}
45
46do_package[noexec] = "1"
47do_packagedata[noexec] = "1"
48do_package_write_ipk[noexec] = "1"
49do_package_write_deb[noexec] = "1"
50do_package_write_rpm[noexec] = "1"
diff --git a/recipes-devtools/go-cross/go-native_1.4.bb b/recipes-devtools/go-cross/go-native_1.4.bb
new file mode 100644
index 00000000..cf186e78
--- /dev/null
+++ b/recipes-devtools/go-cross/go-native_1.4.bb
@@ -0,0 +1,2 @@
1require go-native.inc
2require go-${PV}.inc