summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go')
-rw-r--r--meta/recipes-devtools/go/go-1.4.inc16
-rw-r--r--meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch33
-rw-r--r--meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch24
-rw-r--r--meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch225
-rw-r--r--meta/recipes-devtools/go/go-1.4/syslog.patch62
-rw-r--r--meta/recipes-devtools/go/go-1.6.inc19
-rw-r--r--meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch23
-rw-r--r--meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch50
-rw-r--r--meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch17
-rw-r--r--meta/recipes-devtools/go/go-1.6/gotooldir.patch30
-rw-r--r--meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch63
-rw-r--r--meta/recipes-devtools/go/go-1.6/syslog.patch62
-rw-r--r--meta/recipes-devtools/go/go-1.7.inc19
-rw-r--r--meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch23
-rw-r--r--meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch50
-rw-r--r--meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch17
-rw-r--r--meta/recipes-devtools/go/go-1.7/gotooldir.patch30
-rw-r--r--meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch62
-rw-r--r--meta/recipes-devtools/go/go-1.7/syslog.patch62
-rw-r--r--meta/recipes-devtools/go/go-1.8.inc19
-rw-r--r--meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch23
-rw-r--r--meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch50
-rw-r--r--meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch17
-rw-r--r--meta/recipes-devtools/go/go-1.8/gotooldir.patch30
-rw-r--r--meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch62
-rw-r--r--meta/recipes-devtools/go/go-1.8/syslog.patch62
-rw-r--r--meta/recipes-devtools/go/go-common.inc22
-rw-r--r--meta/recipes-devtools/go/go-cross.inc17
-rw-r--r--meta/recipes-devtools/go/go-cross_1.7.bb5
-rw-r--r--meta/recipes-devtools/go/go-cross_1.8.bb5
-rw-r--r--meta/recipes-devtools/go/go-native.inc54
-rw-r--r--meta/recipes-devtools/go/go-native_1.4.bb2
-rw-r--r--meta/recipes-devtools/go/go.inc87
-rw-r--r--meta/recipes-devtools/go/go_1.6.bb4
-rw-r--r--meta/recipes-devtools/go/go_1.7.bb2
-rw-r--r--meta/recipes-devtools/go/go_1.8.bb2
36 files changed, 1350 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.4.inc b/meta/recipes-devtools/go/go-1.4.inc
new file mode 100644
index 0000000000..2f500f32b9
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4.inc
@@ -0,0 +1,16 @@
1require go-common.inc
2
3PV = "1.4.3"
4GO_BASEVERSION = "1.4"
5FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
6
7SRC_URI += "\
8 file://016-armhf-elf-header.patch \
9 file://go-cross-backport-cmd-link-support-new-386-amd64-rel.patch \
10 file://syslog.patch \
11 file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \
12"
13
14LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
15SRC_URI[md5sum] = "dfb604511115dd402a77a553a5923a04"
16SRC_URI[sha256sum] = "9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959"
diff --git a/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch b/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
new file mode 100644
index 0000000000..f2adc200b1
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
@@ -0,0 +1,33 @@
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---
13Upstream-Status: Backport
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16 src/cmd/ld/elf.c | 1 +
17 1 file changed, 1 insertion(+)
18
19diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c
20index 12ced98..97ed4bd 100644
21--- a/src/cmd/ld/elf.c
22+++ b/src/cmd/ld/elf.c
23@@ -1363,6 +1363,7 @@ asmbelf(vlong symo)
24 sh->type = SHT_REL;
25 sh->flags = SHF_ALLOC;
26 sh->entsize = ELF32RELSIZE;
27+ sh->addralign = 4;
28 sh->link = elfshname(".dynsym")->shnum;
29 shsym(sh, linklookup(ctxt, ".rel.plt", 0));
30
31--
321.9.1
33
diff --git a/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
new file mode 100644
index 0000000000..e6e414e52f
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
@@ -0,0 +1,24 @@
1Description: Use correct ELF header for armhf binaries.
2Author: Adam Conrad <adconrad@ubuntu.com>
3Last-Update: 2013-07-08
4
5Upstream-Status: Pending
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Index: go/src/cmd/ld/elf.c
9===================================================================
10--- go.orig/src/cmd/ld/elf.c 2015-02-20 10:49:58.763451586 -0800
11+++ go/src/cmd/ld/elf.c 2015-02-20 10:49:27.895478521 -0800
12@@ -57,7 +57,11 @@
13 case '5':
14 // we use EABI on both linux/arm and freebsd/arm.
15 if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)
16- hdr.flags = 0x5000002; // has entry point, Version5 EABI
17+#ifdef __ARM_PCS_VFP
18+ hdr.flags = 0x5000402; // has entry point, Version5 EABI, hard-float ABI
19+#else
20+ hdr.flags = 0x5000202; // has entry point, Version5 EABI, soft-float ABI
21+#endif
22 // fallthrough
23 default:
24 hdr.phoff = ELF32HDRSIZE; /* Must be be ELF32HDRSIZE: first PHdr must follow ELF header */
diff --git a/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch b/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
new file mode 100644
index 0000000000..95ca9d3aa9
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
@@ -0,0 +1,225 @@
1From d6eefad445831c161fca130f9bdf7b3848aac23c Mon Sep 17 00:00:00 2001
2From: Paul Gortmaker <paul.gortmaker@windriver.com>
3Date: Tue, 29 Mar 2016 21:14:33 -0400
4Subject: [PATCH] go-cross: backport "cmd/link: support new 386/amd64
5 relocations"
6
7Newer binutils won't support building older go-1.4.3 as per:
8
9https://github.com/golang/go/issues/13114
10
11Upstream commit 914db9f060b1fd3eb1f74d48f3bd46a73d4ae9c7 (see subj)
12was identified as the fix and nominated for 1.4.4 but that release
13never happened. The paths in 1.4.3 aren't the same as go1.6beta1~662
14where this commit appeared, but the NetBSD folks indicated what a
151.4.3 backport would look like here: https://gnats.netbsd.org/50777
16
17This is based on that, but without the BSD wrapper infrastructure
18layer that makes things look like patches of patches.
19
20Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
21
22Upstream-Status: Backport [ Partial ]
23
24diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c
25index 18b5aa311981..2e9d339aef87 100644
26--- a/src/cmd/6l/asm.c
27+++ b/src/cmd/6l/asm.c
28@@ -118,6 +118,8 @@ adddynrel(LSym *s, Reloc *r)
29 return;
30
31 case 256 + R_X86_64_GOTPCREL:
32+ case 256 + R_X86_64_GOTPCRELX:
33+ case 256 + R_X86_64_REX_GOTPCRELX:
34 if(targ->type != SDYNIMPORT) {
35 // have symbol
36 if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
37diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c
38index 98c04240374f..cff29488e8af 100644
39--- a/src/cmd/8l/asm.c
40+++ b/src/cmd/8l/asm.c
41@@ -115,6 +115,7 @@ adddynrel(LSym *s, Reloc *r)
42 return;
43
44 case 256 + R_386_GOT32:
45+ case 256 + R_386_GOT32X:
46 if(targ->type != SDYNIMPORT) {
47 // have symbol
48 if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
49diff --git a/src/cmd/ld/elf.h b/src/cmd/ld/elf.h
50index e84d996f2596..bbf2cfaa3cc0 100644
51--- a/src/cmd/ld/elf.h
52+++ b/src/cmd/ld/elf.h
53@@ -478,32 +478,47 @@ typedef struct {
54 * Relocation types.
55 */
56
57-#define R_X86_64_NONE 0 /* No relocation. */
58-#define R_X86_64_64 1 /* Add 64 bit symbol value. */
59-#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */
60-#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */
61-#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */
62-#define R_X86_64_COPY 5 /* Copy data from shared object. */
63-#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */
64-#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */
65-#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */
66-#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */
67-#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */
68-#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */
69-#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */
70-#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */
71-#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */
72-#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */
73-#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
74-#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */
75-#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */
76-#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */
77-#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */
78-#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
79-#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
80-#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
81-
82-#define R_X86_64_COUNT 24 /* Count of defined relocation types. */
83+#define R_X86_64_NONE 0
84+#define R_X86_64_64 1
85+#define R_X86_64_PC32 2
86+#define R_X86_64_GOT32 3
87+#define R_X86_64_PLT32 4
88+#define R_X86_64_COPY 5
89+#define R_X86_64_GLOB_DAT 6
90+#define R_X86_64_JMP_SLOT 7
91+#define R_X86_64_RELATIVE 8
92+#define R_X86_64_GOTPCREL 9
93+#define R_X86_64_32 10
94+#define R_X86_64_32S 11
95+#define R_X86_64_16 12
96+#define R_X86_64_PC16 13
97+#define R_X86_64_8 14
98+#define R_X86_64_PC8 15
99+#define R_X86_64_DTPMOD64 16
100+#define R_X86_64_DTPOFF64 17
101+#define R_X86_64_TPOFF64 18
102+#define R_X86_64_TLSGD 19
103+#define R_X86_64_TLSLD 20
104+#define R_X86_64_DTPOFF32 21
105+#define R_X86_64_GOTTPOFF 22
106+#define R_X86_64_TPOFF32 23
107+#define R_X86_64_PC64 24
108+#define R_X86_64_GOTOFF64 25
109+#define R_X86_64_GOTPC32 26
110+#define R_X86_64_GOT64 27
111+#define R_X86_64_GOTPCREL64 28
112+#define R_X86_64_GOTPC64 29
113+#define R_X86_64_GOTPLT64 30
114+#define R_X86_64_PLTOFF64 31
115+#define R_X86_64_SIZE32 32
116+#define R_X86_64_SIZE64 33
117+#define R_X86_64_GOTPC32_TLSDEC 34
118+#define R_X86_64_TLSDESC_CALL 35
119+#define R_X86_64_TLSDESC 36
120+#define R_X86_64_IRELATIVE 37
121+#define R_X86_64_PC32_BND 40
122+#define R_X86_64_GOTPCRELX 41
123+#define R_X86_64_REX_GOTPCRELX 42
124
125
126 #define R_ALPHA_NONE 0 /* No reloc */
127@@ -581,39 +596,42 @@ typedef struct {
128 #define R_ARM_COUNT 38 /* Count of defined relocation types. */
129
130
131-#define R_386_NONE 0 /* No relocation. */
132-#define R_386_32 1 /* Add symbol value. */
133-#define R_386_PC32 2 /* Add PC-relative symbol value. */
134-#define R_386_GOT32 3 /* Add PC-relative GOT offset. */
135-#define R_386_PLT32 4 /* Add PC-relative PLT offset. */
136-#define R_386_COPY 5 /* Copy data from shared object. */
137-#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */
138-#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */
139-#define R_386_RELATIVE 8 /* Add load address of shared object. */
140-#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */
141-#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */
142-#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */
143-#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */
144-#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */
145-#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */
146-#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */
147-#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */
148-#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */
149-#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */
150-#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */
151-#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */
152-#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */
153-#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */
154-#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */
155-#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */
156-#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */
157-#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */
158-#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */
159-#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */
160-#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */
161-#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
162-
163-#define R_386_COUNT 38 /* Count of defined relocation types. */
164+#define R_386_NONE 0
165+#define R_386_32 1
166+#define R_386_PC32 2
167+#define R_386_GOT32 3
168+#define R_386_PLT32 4
169+#define R_386_COPY 5
170+#define R_386_GLOB_DAT 6
171+#define R_386_JMP_SLOT 7
172+#define R_386_RELATIVE 8
173+#define R_386_GOTOFF 9
174+#define R_386_GOTPC 10
175+#define R_386_TLS_TPOFF 14
176+#define R_386_TLS_IE 15
177+#define R_386_TLS_GOTIE 16
178+#define R_386_TLS_LE 17
179+#define R_386_TLS_GD 18
180+#define R_386_TLS_LDM 19
181+#define R_386_TLS_GD_32 24
182+#define R_386_TLS_GD_PUSH 25
183+#define R_386_TLS_GD_CALL 26
184+#define R_386_TLS_GD_POP 27
185+#define R_386_TLS_LDM_32 28
186+#define R_386_TLS_LDM_PUSH 29
187+#define R_386_TLS_LDM_CALL 30
188+#define R_386_TLS_LDM_POP 31
189+#define R_386_TLS_LDO_32 32
190+#define R_386_TLS_IE_32 33
191+#define R_386_TLS_LE_32 34
192+#define R_386_TLS_DTPMOD32 35
193+#define R_386_TLS_DTPOFF32 36
194+#define R_386_TLS_TPOFF32 37
195+#define R_386_TLS_GOTDESC 39
196+#define R_386_TLS_DESC_CALL 40
197+#define R_386_TLS_DESC 41
198+#define R_386_IRELATIVE 42
199+#define R_386_GOT32X 43
200
201 #define R_PPC_NONE 0 /* No relocation. */
202 #define R_PPC_ADDR32 1
203diff --git a/src/cmd/ld/ldelf.c b/src/cmd/ld/ldelf.c
204index dd5fa0d2a839..2e2fbd17377f 100644
205--- a/src/cmd/ld/ldelf.c
206+++ b/src/cmd/ld/ldelf.c
207@@ -888,12 +888,15 @@ reltype(char *pn, int elftype, uchar *siz)
208 case R('6', R_X86_64_PC32):
209 case R('6', R_X86_64_PLT32):
210 case R('6', R_X86_64_GOTPCREL):
211+ case R('6', R_X86_64_GOTPCRELX):
212+ case R('6', R_X86_64_REX_GOTPCRELX):
213 case R('8', R_386_32):
214 case R('8', R_386_PC32):
215 case R('8', R_386_GOT32):
216 case R('8', R_386_PLT32):
217 case R('8', R_386_GOTOFF):
218 case R('8', R_386_GOTPC):
219+ case R('8', R_386_GOT32X):
220 *siz = 4;
221 break;
222 case R('6', R_X86_64_64):
223--
2242.7.2
225
diff --git a/meta/recipes-devtools/go/go-1.4/syslog.patch b/meta/recipes-devtools/go/go-1.4/syslog.patch
new file mode 100644
index 0000000000..29be06f1bd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.4/syslog.patch
@@ -0,0 +1,62 @@
1Add timeouts to logger
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
7--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
8+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
9@@ -33,6 +33,9 @@
10 const severityMask = 0x07
11 const facilityMask = 0xf8
12
13+var writeTimeout = 1 * time.Second
14+var connectTimeout = 1 * time.Second
15+
16 const (
17 // Severity.
18
19@@ -100,6 +103,7 @@
20 type serverConn interface {
21 writeString(p Priority, hostname, tag, s, nl string) error
22 close() error
23+ setWriteDeadline(t time.Time) error
24 }
25
26 type netConn struct {
27@@ -273,7 +277,11 @@
28 nl = "\n"
29 }
30
31- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
33+ if err != nil {
34+ return 0, err
35+ }
36+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
37 if err != nil {
38 return 0, err
39 }
40@@ -305,6 +313,10 @@
41 return n.conn.Close()
42 }
43
44+func (n *netConn) setWriteDeadline(t time.Time) error {
45+ return n.conn.SetWriteDeadline(t)
46+}
47+
48 // NewLogger creates a log.Logger whose output is written to
49 // the system log service with the specified priority. The logFlag
50 // argument is the flag set passed through to log.New to create
51diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
52--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
53+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
54@@ -19,7 +19,7 @@
55 logPaths := []string{"/dev/log", "/var/run/syslog"}
56 for _, network := range logTypes {
57 for _, path := range logPaths {
58- conn, err := net.Dial(network, path)
59+ conn, err := net.DialTimeout(network, path, connectTimeout)
60 if err != nil {
61 continue
62 } else {
diff --git a/meta/recipes-devtools/go/go-1.6.inc b/meta/recipes-devtools/go/go-1.6.inc
new file mode 100644
index 0000000000..769c1d8f22
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6.inc
@@ -0,0 +1,19 @@
1require go-common.inc
2
3PV = "1.6.3"
4GO_BASEVERSION = "1.6"
5FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
6
7LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
8
9SRC_URI += "\
10 file://armhf-elf-header.patch \
11 file://syslog.patch \
12 file://fix-target-cc-for-build.patch \
13 file://fix-cc-handling.patch \
14 file://split-host-and-target-build.patch \
15 file://gotooldir.patch \
16"
17SRC_URI[md5sum] = "bf3fce6ccaadd310159c9e874220e2a2"
18SRC_URI[sha256sum] = "6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00"
19
diff --git a/meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
new file mode 100644
index 0000000000..1e3a16b319
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
@@ -0,0 +1,23 @@
1Encode arm EABI ( hard/soft ) calling convention in ELF header
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/link/internal/ld/elf.go
6===================================================================
7--- go.orig/src/cmd/link/internal/ld/elf.go
8+++ go/src/cmd/link/internal/ld/elf.go
9@@ -827,7 +827,13 @@
10 // 32-bit architectures
11 case '5':
12 // we use EABI on both linux/arm and freebsd/arm.
13- if HEADTYPE == obj.Hlinux || HEADTYPE == obj.Hfreebsd {
14+ if HEADTYPE == obj.Hlinux {
15+ if Ctxt.Goarm == 7 {
16+ ehdr.flags = 0x5000402 // has entry point, Version5 EABI, hard float
17+ } else {
18+ ehdr.flags = 0x5000202 // has entry point, Version5 EABI, soft float
19+ }
20+ } else if HEADTYPE == obj.Hfreebsd {
21 // We set a value here that makes no indication of which
22 // float ABI the object uses, because this is information
23 // used by the dynamic linker to compare executables and
diff --git a/meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch b/meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
new file mode 100644
index 0000000000..983323ace9
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
@@ -0,0 +1,50 @@
1Accept CC with multiple words in its name
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/go/build.go
6===================================================================
7--- go.orig/src/cmd/go/build.go 2015-07-29 14:48:40.323185807 -0700
8+++ go/src/cmd/go/build.go 2015-07-30 07:37:40.529818586 -0700
9@@ -2805,12 +2805,24 @@
10 return b.ccompilerCmd("CC", defaultCC, objdir)
11 }
12
13+// gccCmd returns a gcc command line prefix
14+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
15+func (b *builder) gccCmdForReal() []string {
16+ return envList("CC", defaultCC)
17+}
18+
19 // gxxCmd returns a g++ command line prefix
20 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
21 func (b *builder) gxxCmd(objdir string) []string {
22 return b.ccompilerCmd("CXX", defaultCXX, objdir)
23 }
24
25+// gxxCmd returns a g++ command line prefix
26+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
27+func (b *builder) gxxCmdForReal() []string {
28+ return envList("CXX", defaultCXX)
29+}
30+
31 // ccompilerCmd returns a command line prefix for the given environment
32 // variable and using the default command when the variable is empty.
33 func (b *builder) ccompilerCmd(envvar, defcmd, objdir string) []string {
34Index: go/src/cmd/go/env.go
35===================================================================
36--- go.orig/src/cmd/go/env.go 2015-07-29 14:48:40.323185807 -0700
37+++ go/src/cmd/go/env.go 2015-07-30 07:40:54.461655721 -0700
38@@ -52,10 +52,9 @@
39
40 if goos != "plan9" {
41 cmd := b.gccCmd(".")
42- env = append(env, envVar{"CC", cmd[0]})
43+ env = append(env, envVar{"CC", strings.Join(b.gccCmdForReal(), " ")})
44 env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
45- cmd = b.gxxCmd(".")
46- env = append(env, envVar{"CXX", cmd[0]})
47+ env = append(env, envVar{"CXX", strings.Join(b.gxxCmdForReal(), " ")})
48 }
49
50 if buildContext.CgoEnabled {
diff --git a/meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch b/meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
new file mode 100644
index 0000000000..2f6156ecd2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
@@ -0,0 +1,17 @@
1Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/make.bash
6===================================================================
7--- go.orig/src/make.bash 2015-07-29 13:28:11.334031696 -0700
8+++ go/src/make.bash 2015-07-29 13:36:55.814465630 -0700
9@@ -158,7 +158,7 @@
10 fi
11
12 echo "##### Building packages and commands for $GOOS/$GOARCH."
13-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
14+CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
15 echo
16
17 rm -f "$GOTOOLDIR"/go_bootstrap
diff --git a/meta/recipes-devtools/go/go-1.6/gotooldir.patch b/meta/recipes-devtools/go/go-1.6/gotooldir.patch
new file mode 100644
index 0000000000..94670259f2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/gotooldir.patch
@@ -0,0 +1,30 @@
1Define tooldir in relation to GOTOOLDIR env var
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/go/build/build.go
6===================================================================
7--- go.orig/src/go/build/build.go
8+++ go/src/go/build/build.go
9@@ -1388,7 +1388,7 @@ func init() {
10 }
11
12 // ToolDir is the directory containing build tools.
13-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
14+var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH))
15
16 // IsLocalImport reports whether the import path is
17 // a local import path, like ".", "..", "./foo", or "../foo".
18Index: go/src/cmd/go/build.go
19===================================================================
20--- go.orig/src/cmd/go/build.go
21+++ go/src/cmd/go/build.go
22@@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err
23 }
24
25 cgoExe := tool("cgo")
26- if a.cgo != nil && a.cgo.target != "" {
27+ if a.cgo != nil && a.cgo.target != "" && os.Getenv("GOTOOLDIR") == "" {
28 cgoExe = a.cgo.target
29 }
30 outGo, outObj, err := b.cgo(a.p, cgoExe, obj, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, cxxfiles, a.p.MFiles)
diff --git a/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch b/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
new file mode 100644
index 0000000000..afbae02b4e
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
@@ -0,0 +1,63 @@
1Add new option --target-only to build target components
2Separates the host and target pieces of build
3
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5Upstream-Status: Pending
6Index: go/src/make.bash
7===================================================================
8--- go.orig/src/make.bash
9+++ go/src/make.bash
10@@ -143,12 +143,23 @@ if [ "$1" = "--no-clean" ]; then
11 buildall=""
12 shift
13 fi
14-./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
15-# Delay move of dist tool to now, because bootstrap may clear tool directory.
16-mv cmd/dist/dist "$GOTOOLDIR"/dist
17-echo
18
19-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
20+do_host_build="yes"
21+do_target_build="yes"
22+if [ "$1" = "--target-only" ]; then
23+ do_host_build="no"
24+ shift
25+elif [ "$1" = "--host-only" ]; then
26+ do_target_build="no"
27+ shift
28+fi
29+
30+if [ "$do_host_build" = "yes" ]; then
31+ ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
32+ # Delay move of dist tool to now, because bootstrap may clear tool directory.
33+ mv cmd/dist/dist "$GOTOOLDIR"/dist
34+ echo
35+
36 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
37 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
38 # use the host compiler, CC, from `cmd/dist/dist env` instead.
39@@ -157,11 +168,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
40 echo
41 fi
42
43-echo "##### Building packages and commands for $GOOS/$GOARCH."
44-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
45-echo
46+if [ "$do_target_build" = "yes" ]; then
47+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}"
48+ echo "##### Building packages and commands for $GOOS/$GOARCH."
49+ if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a "$do_host_build" = "yes" ]; then
50+ rm -rf ./host-tools
51+ mkdir ./host-tools
52+ mv "$GOTOOLDIR"/* ./host-tools
53+ GOTOOLDIR="$PWD/host-tools"
54+ fi
55+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL}
56+ echo
57
58-rm -f "$GOTOOLDIR"/go_bootstrap
59+ rm -f "$GOTOOLDIR"/go_bootstrap
60+fi
61
62 if [ "$1" != "--no-banner" ]; then
63 "$GOTOOLDIR"/dist banner
diff --git a/meta/recipes-devtools/go/go-1.6/syslog.patch b/meta/recipes-devtools/go/go-1.6/syslog.patch
new file mode 100644
index 0000000000..29be06f1bd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/syslog.patch
@@ -0,0 +1,62 @@
1Add timeouts to logger
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
7--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
8+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
9@@ -33,6 +33,9 @@
10 const severityMask = 0x07
11 const facilityMask = 0xf8
12
13+var writeTimeout = 1 * time.Second
14+var connectTimeout = 1 * time.Second
15+
16 const (
17 // Severity.
18
19@@ -100,6 +103,7 @@
20 type serverConn interface {
21 writeString(p Priority, hostname, tag, s, nl string) error
22 close() error
23+ setWriteDeadline(t time.Time) error
24 }
25
26 type netConn struct {
27@@ -273,7 +277,11 @@
28 nl = "\n"
29 }
30
31- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
33+ if err != nil {
34+ return 0, err
35+ }
36+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
37 if err != nil {
38 return 0, err
39 }
40@@ -305,6 +313,10 @@
41 return n.conn.Close()
42 }
43
44+func (n *netConn) setWriteDeadline(t time.Time) error {
45+ return n.conn.SetWriteDeadline(t)
46+}
47+
48 // NewLogger creates a log.Logger whose output is written to
49 // the system log service with the specified priority. The logFlag
50 // argument is the flag set passed through to log.New to create
51diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
52--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
53+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
54@@ -19,7 +19,7 @@
55 logPaths := []string{"/dev/log", "/var/run/syslog"}
56 for _, network := range logTypes {
57 for _, path := range logPaths {
58- conn, err := net.Dial(network, path)
59+ conn, err := net.DialTimeout(network, path, connectTimeout)
60 if err != nil {
61 continue
62 } else {
diff --git a/meta/recipes-devtools/go/go-1.7.inc b/meta/recipes-devtools/go/go-1.7.inc
new file mode 100644
index 0000000000..5c3004e875
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.7.inc
@@ -0,0 +1,19 @@
1require go-common.inc
2
3PV = "1.7.4"
4GO_BASEVERSION = "1.7"
5FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
6
7LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
8
9SRC_URI += "\
10 file://armhf-elf-header.patch \
11 file://syslog.patch \
12 file://fix-target-cc-for-build.patch \
13 file://fix-cc-handling.patch \
14 file://split-host-and-target-build.patch \
15 file://gotooldir.patch \
16"
17SRC_URI[md5sum] = "49c1076428a5d3b5ad7ac65233fcca2f"
18SRC_URI[sha256sum] = "4c189111e9ba651a2bb3ee868aa881fab36b2f2da3409e80885ca758a6b614cc"
19
diff --git a/meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch
new file mode 100644
index 0000000000..1e3a16b319
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch
@@ -0,0 +1,23 @@
1Encode arm EABI ( hard/soft ) calling convention in ELF header
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/link/internal/ld/elf.go
6===================================================================
7--- go.orig/src/cmd/link/internal/ld/elf.go
8+++ go/src/cmd/link/internal/ld/elf.go
9@@ -827,7 +827,13 @@
10 // 32-bit architectures
11 case '5':
12 // we use EABI on both linux/arm and freebsd/arm.
13- if HEADTYPE == obj.Hlinux || HEADTYPE == obj.Hfreebsd {
14+ if HEADTYPE == obj.Hlinux {
15+ if Ctxt.Goarm == 7 {
16+ ehdr.flags = 0x5000402 // has entry point, Version5 EABI, hard float
17+ } else {
18+ ehdr.flags = 0x5000202 // has entry point, Version5 EABI, soft float
19+ }
20+ } else if HEADTYPE == obj.Hfreebsd {
21 // We set a value here that makes no indication of which
22 // float ABI the object uses, because this is information
23 // used by the dynamic linker to compare executables and
diff --git a/meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch b/meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch
new file mode 100644
index 0000000000..a67caf41a5
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch
@@ -0,0 +1,50 @@
1Accept CC with multiple words in its name
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/go/build.go
6===================================================================
7--- go.orig/src/cmd/go/build.go
8+++ go/src/cmd/go/build.go
9@@ -2991,12 +2991,24 @@ func (b *builder) gccCmd(objdir string)
10 return b.ccompilerCmd("CC", defaultCC, objdir)
11 }
12
13+// gccCmd returns a gcc command line prefix
14+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
15+func (b *builder) gccCmdForReal() []string {
16+ return envList("CC", defaultCC)
17+}
18+
19 // gxxCmd returns a g++ command line prefix
20 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
21 func (b *builder) gxxCmd(objdir string) []string {
22 return b.ccompilerCmd("CXX", defaultCXX, objdir)
23 }
24
25+// gxxCmd returns a g++ command line prefix
26+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
27+func (b *builder) gxxCmdForReal() []string {
28+ return envList("CXX", defaultCXX)
29+}
30+
31 // gfortranCmd returns a gfortran command line prefix.
32 func (b *builder) gfortranCmd(objdir string) []string {
33 return b.ccompilerCmd("FC", "gfortran", objdir)
34Index: go/src/cmd/go/env.go
35===================================================================
36--- go.orig/src/cmd/go/env.go
37+++ go/src/cmd/go/env.go
38@@ -51,10 +51,9 @@ func mkEnv() []envVar {
39
40 if goos != "plan9" {
41 cmd := b.gccCmd(".")
42- env = append(env, envVar{"CC", cmd[0]})
43+ env = append(env, envVar{"CC", strings.Join(b.gccCmdForReal(), " ")})
44 env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
45- cmd = b.gxxCmd(".")
46- env = append(env, envVar{"CXX", cmd[0]})
47+ env = append(env, envVar{"CXX", strings.Join(b.gxxCmdForReal(), " ")})
48 }
49
50 if buildContext.CgoEnabled {
diff --git a/meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch b/meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch
new file mode 100644
index 0000000000..2f6156ecd2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch
@@ -0,0 +1,17 @@
1Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/make.bash
6===================================================================
7--- go.orig/src/make.bash 2015-07-29 13:28:11.334031696 -0700
8+++ go/src/make.bash 2015-07-29 13:36:55.814465630 -0700
9@@ -158,7 +158,7 @@
10 fi
11
12 echo "##### Building packages and commands for $GOOS/$GOARCH."
13-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
14+CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
15 echo
16
17 rm -f "$GOTOOLDIR"/go_bootstrap
diff --git a/meta/recipes-devtools/go/go-1.7/gotooldir.patch b/meta/recipes-devtools/go/go-1.7/gotooldir.patch
new file mode 100644
index 0000000000..94670259f2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.7/gotooldir.patch
@@ -0,0 +1,30 @@
1Define tooldir in relation to GOTOOLDIR env var
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/go/build/build.go
6===================================================================
7--- go.orig/src/go/build/build.go
8+++ go/src/go/build/build.go
9@@ -1388,7 +1388,7 @@ func init() {
10 }
11
12 // ToolDir is the directory containing build tools.
13-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
14+var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH))
15
16 // IsLocalImport reports whether the import path is
17 // a local import path, like ".", "..", "./foo", or "../foo".
18Index: go/src/cmd/go/build.go
19===================================================================
20--- go.orig/src/cmd/go/build.go
21+++ go/src/cmd/go/build.go
22@@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err
23 }
24
25 cgoExe := tool("cgo")
26- if a.cgo != nil && a.cgo.target != "" {
27+ if a.cgo != nil && a.cgo.target != "" && os.Getenv("GOTOOLDIR") == "" {
28 cgoExe = a.cgo.target
29 }
30 outGo, outObj, err := b.cgo(a.p, cgoExe, obj, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, cxxfiles, a.p.MFiles)
diff --git a/meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch b/meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch
new file mode 100644
index 0000000000..b0dd95bbe7
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch
@@ -0,0 +1,62 @@
1Add new option --target-only to build target components
2Separates the host and target pieces of build
3
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5Upstream-Status: Pending
6Index: go/src/make.bash
7===================================================================
8--- go.orig/src/make.bash
9+++ go/src/make.bash
10@@ -154,13 +154,22 @@ if [ "$1" = "--no-clean" ]; then
11 buildall=""
12 shift
13 fi
14-./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
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-# Delay move of dist tool to now, because bootstrap may clear tool directory.
26-mv cmd/dist/dist "$GOTOOLDIR"/dist
27-echo
28+if [ "$do_host_build" = "yes" ]; then
29+ ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
30+ # Delay move of dist tool to now, because bootstrap may clear tool directory.
31+ mv cmd/dist/dist "$GOTOOLDIR"/dist
32+ echo
33
34-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
35 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
36 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
37 # use the host compiler, CC, from `cmd/dist/dist env` instead.
38@@ -169,11 +178,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
39 echo
40 fi
41
42-echo "##### Building packages and commands for $GOOS/$GOARCH."
43-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
44-echo
45+if [ "$do_target_build" = "yes" ]; then
46+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}"
47+ echo "##### Building packages and commands for $GOOS/$GOARCH."
48+ if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a "$do_host_build" = "yes" ]; then
49+ rm -rf ./host-tools
50+ mkdir ./host-tools
51+ mv "$GOTOOLDIR"/* ./host-tools
52+ GOTOOLDIR="$PWD/host-tools"
53+ fi
54+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL}
55+ echo
56
57-rm -f "$GOTOOLDIR"/go_bootstrap
58+ rm -f "$GOTOOLDIR"/go_bootstrap
59+fi
60
61 if [ "$1" != "--no-banner" ]; then
62 "$GOTOOLDIR"/dist banner
diff --git a/meta/recipes-devtools/go/go-1.7/syslog.patch b/meta/recipes-devtools/go/go-1.7/syslog.patch
new file mode 100644
index 0000000000..29be06f1bd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.7/syslog.patch
@@ -0,0 +1,62 @@
1Add timeouts to logger
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
7--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
8+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
9@@ -33,6 +33,9 @@
10 const severityMask = 0x07
11 const facilityMask = 0xf8
12
13+var writeTimeout = 1 * time.Second
14+var connectTimeout = 1 * time.Second
15+
16 const (
17 // Severity.
18
19@@ -100,6 +103,7 @@
20 type serverConn interface {
21 writeString(p Priority, hostname, tag, s, nl string) error
22 close() error
23+ setWriteDeadline(t time.Time) error
24 }
25
26 type netConn struct {
27@@ -273,7 +277,11 @@
28 nl = "\n"
29 }
30
31- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
33+ if err != nil {
34+ return 0, err
35+ }
36+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
37 if err != nil {
38 return 0, err
39 }
40@@ -305,6 +313,10 @@
41 return n.conn.Close()
42 }
43
44+func (n *netConn) setWriteDeadline(t time.Time) error {
45+ return n.conn.SetWriteDeadline(t)
46+}
47+
48 // NewLogger creates a log.Logger whose output is written to
49 // the system log service with the specified priority. The logFlag
50 // argument is the flag set passed through to log.New to create
51diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
52--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
53+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
54@@ -19,7 +19,7 @@
55 logPaths := []string{"/dev/log", "/var/run/syslog"}
56 for _, network := range logTypes {
57 for _, path := range logPaths {
58- conn, err := net.Dial(network, path)
59+ conn, err := net.DialTimeout(network, path, connectTimeout)
60 if err != nil {
61 continue
62 } else {
diff --git a/meta/recipes-devtools/go/go-1.8.inc b/meta/recipes-devtools/go/go-1.8.inc
new file mode 100644
index 0000000000..5c376a2eb6
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8.inc
@@ -0,0 +1,19 @@
1require go-common.inc
2
3GOMINOR = ""
4GO_BASEVERSION = "1.8"
5PV .= "${GOMINOR}"
6FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
7
8LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
9
10SRC_URI += "\
11 file://armhf-elf-header.patch \
12 file://syslog.patch \
13 file://fix-target-cc-for-build.patch \
14 file://fix-cc-handling.patch \
15 file://split-host-and-target-build.patch \
16 file://gotooldir.patch \
17"
18SRC_URI[md5sum] = "7743960c968760437b6e39093cfe6f67"
19SRC_URI[sha256sum] = "406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596"
diff --git a/meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch
new file mode 100644
index 0000000000..3508838e8b
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch
@@ -0,0 +1,23 @@
1Encode arm EABI ( hard/soft ) calling convention in ELF header
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/link/internal/ld/elf.go
6===================================================================
7--- go.orig/src/cmd/link/internal/ld/elf.go
8+++ go/src/cmd/link/internal/ld/elf.go
9@@ -950,7 +950,13 @@ func Elfinit(ctxt *Link) {
10 case sys.ARM, sys.MIPS:
11 if SysArch.Family == sys.ARM {
12 // we use EABI on linux/arm, freebsd/arm, netbsd/arm.
13- if Headtype == obj.Hlinux || Headtype == obj.Hfreebsd || Headtype == obj.Hnetbsd {
14+ if Headtype == obj.Hlinux {
15+ if obj.GOARM == 7 {
16+ ehdr.flags = 0x5000402 // has entry point, Version5 EABI, hard float
17+ } else {
18+ ehdr.flags = 0x5000202 // has entry point, Version5 EABI, soft float
19+ }
20+ } else if Headtype == obj.Hfreebsd || Headtype == obj.Hnetbsd {
21 // We set a value here that makes no indication of which
22 // float ABI the object uses, because this is information
23 // used by the dynamic linker to compare executables and
diff --git a/meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch b/meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch
new file mode 100644
index 0000000000..dc9b811b2a
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch
@@ -0,0 +1,50 @@
1Accept CC with multiple words in its name
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/go/build.go
6===================================================================
7--- go.orig/src/cmd/go/build.go
8+++ go/src/cmd/go/build.go
9@@ -3100,12 +3100,24 @@ func (b *builder) gccCmd(objdir string)
10 return b.ccompilerCmd("CC", defaultCC, objdir)
11 }
12
13+// gccCmd returns a gcc command line prefix
14+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
15+func (b *builder) gccCmdForReal() []string {
16+ return envList("CC", defaultCC)
17+}
18+
19 // gxxCmd returns a g++ command line prefix
20 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
21 func (b *builder) gxxCmd(objdir string) []string {
22 return b.ccompilerCmd("CXX", defaultCXX, objdir)
23 }
24
25+// gxxCmd returns a g++ command line prefix
26+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
27+func (b *builder) gxxCmdForReal() []string {
28+ return envList("CXX", defaultCXX)
29+}
30+
31 // gfortranCmd returns a gfortran command line prefix.
32 func (b *builder) gfortranCmd(objdir string) []string {
33 return b.ccompilerCmd("FC", "gfortran", objdir)
34Index: go/src/cmd/go/env.go
35===================================================================
36--- go.orig/src/cmd/go/env.go
37+++ go/src/cmd/go/env.go
38@@ -63,10 +63,9 @@ func mkEnv() []envVar {
39 }
40
41 cmd := b.gccCmd(".")
42- env = append(env, envVar{"CC", cmd[0]})
43+ env = append(env, envVar{"CC", strings.Join(b.gccCmdForReal(), " ")})
44 env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
45- cmd = b.gxxCmd(".")
46- env = append(env, envVar{"CXX", cmd[0]})
47+ env = append(env, envVar{"CXX", strings.Join(b.gxxCmdForReal(), " ")})
48
49 if buildContext.CgoEnabled {
50 env = append(env, envVar{"CGO_ENABLED", "1"})
diff --git a/meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch b/meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch
new file mode 100644
index 0000000000..2f6156ecd2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch
@@ -0,0 +1,17 @@
1Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/make.bash
6===================================================================
7--- go.orig/src/make.bash 2015-07-29 13:28:11.334031696 -0700
8+++ go/src/make.bash 2015-07-29 13:36:55.814465630 -0700
9@@ -158,7 +158,7 @@
10 fi
11
12 echo "##### Building packages and commands for $GOOS/$GOARCH."
13-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
14+CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
15 echo
16
17 rm -f "$GOTOOLDIR"/go_bootstrap
diff --git a/meta/recipes-devtools/go/go-1.8/gotooldir.patch b/meta/recipes-devtools/go/go-1.8/gotooldir.patch
new file mode 100644
index 0000000000..94670259f2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/gotooldir.patch
@@ -0,0 +1,30 @@
1Define tooldir in relation to GOTOOLDIR env var
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/go/build/build.go
6===================================================================
7--- go.orig/src/go/build/build.go
8+++ go/src/go/build/build.go
9@@ -1388,7 +1388,7 @@ func init() {
10 }
11
12 // ToolDir is the directory containing build tools.
13-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
14+var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH))
15
16 // IsLocalImport reports whether the import path is
17 // a local import path, like ".", "..", "./foo", or "../foo".
18Index: go/src/cmd/go/build.go
19===================================================================
20--- go.orig/src/cmd/go/build.go
21+++ go/src/cmd/go/build.go
22@@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err
23 }
24
25 cgoExe := tool("cgo")
26- if a.cgo != nil && a.cgo.target != "" {
27+ if a.cgo != nil && a.cgo.target != "" && os.Getenv("GOTOOLDIR") == "" {
28 cgoExe = a.cgo.target
29 }
30 outGo, outObj, err := b.cgo(a.p, cgoExe, obj, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, cxxfiles, a.p.MFiles)
diff --git a/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch b/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch
new file mode 100644
index 0000000000..b0dd95bbe7
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch
@@ -0,0 +1,62 @@
1Add new option --target-only to build target components
2Separates the host and target pieces of build
3
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5Upstream-Status: Pending
6Index: go/src/make.bash
7===================================================================
8--- go.orig/src/make.bash
9+++ go/src/make.bash
10@@ -154,13 +154,22 @@ if [ "$1" = "--no-clean" ]; then
11 buildall=""
12 shift
13 fi
14-./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
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-# Delay move of dist tool to now, because bootstrap may clear tool directory.
26-mv cmd/dist/dist "$GOTOOLDIR"/dist
27-echo
28+if [ "$do_host_build" = "yes" ]; then
29+ ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
30+ # Delay move of dist tool to now, because bootstrap may clear tool directory.
31+ mv cmd/dist/dist "$GOTOOLDIR"/dist
32+ echo
33
34-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
35 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
36 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
37 # use the host compiler, CC, from `cmd/dist/dist env` instead.
38@@ -169,11 +178,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
39 echo
40 fi
41
42-echo "##### Building packages and commands for $GOOS/$GOARCH."
43-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
44-echo
45+if [ "$do_target_build" = "yes" ]; then
46+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}"
47+ echo "##### Building packages and commands for $GOOS/$GOARCH."
48+ if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a "$do_host_build" = "yes" ]; then
49+ rm -rf ./host-tools
50+ mkdir ./host-tools
51+ mv "$GOTOOLDIR"/* ./host-tools
52+ GOTOOLDIR="$PWD/host-tools"
53+ fi
54+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL}
55+ echo
56
57-rm -f "$GOTOOLDIR"/go_bootstrap
58+ rm -f "$GOTOOLDIR"/go_bootstrap
59+fi
60
61 if [ "$1" != "--no-banner" ]; then
62 "$GOTOOLDIR"/dist banner
diff --git a/meta/recipes-devtools/go/go-1.8/syslog.patch b/meta/recipes-devtools/go/go-1.8/syslog.patch
new file mode 100644
index 0000000000..29be06f1bd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/syslog.patch
@@ -0,0 +1,62 @@
1Add timeouts to logger
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
7--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
8+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
9@@ -33,6 +33,9 @@
10 const severityMask = 0x07
11 const facilityMask = 0xf8
12
13+var writeTimeout = 1 * time.Second
14+var connectTimeout = 1 * time.Second
15+
16 const (
17 // Severity.
18
19@@ -100,6 +103,7 @@
20 type serverConn interface {
21 writeString(p Priority, hostname, tag, s, nl string) error
22 close() error
23+ setWriteDeadline(t time.Time) error
24 }
25
26 type netConn struct {
27@@ -273,7 +277,11 @@
28 nl = "\n"
29 }
30
31- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
33+ if err != nil {
34+ return 0, err
35+ }
36+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
37 if err != nil {
38 return 0, err
39 }
40@@ -305,6 +313,10 @@
41 return n.conn.Close()
42 }
43
44+func (n *netConn) setWriteDeadline(t time.Time) error {
45+ return n.conn.SetWriteDeadline(t)
46+}
47+
48 // NewLogger creates a log.Logger whose output is written to
49 // the system log service with the specified priority. The logFlag
50 // argument is the flag set passed through to log.New to create
51diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
52--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
53+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
54@@ -19,7 +19,7 @@
55 logPaths := []string{"/dev/log", "/var/run/syslog"}
56 for _, network := range logTypes {
57 for _, path := range logPaths {
58- conn, err := net.Dial(network, path)
59+ conn, err := net.DialTimeout(network, path, connectTimeout)
60 if err != nil {
61 continue
62 } else {
diff --git a/meta/recipes-devtools/go/go-common.inc b/meta/recipes-devtools/go/go-common.inc
new file mode 100644
index 0000000000..f74b8b7650
--- /dev/null
+++ b/meta/recipes-devtools/go/go-common.inc
@@ -0,0 +1,22 @@
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."
11
12HOMEPAGE = " http://golang.org/"
13LICENSE = "BSD-3-Clause"
14
15inherit goarch
16
17SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz"
18S = "${WORKDIR}/go"
19B = "${S}"
20
21INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
22SSTATE_SCAN_CMD = "true"
diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc
new file mode 100644
index 0000000000..054ce501bd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-cross.inc
@@ -0,0 +1,17 @@
1inherit cross
2
3DEPENDS += "gcc-cross-${TARGET_ARCH}"
4
5PN = "go-cross-${TARGET_ARCH}"
6
7FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:"
8
9GOROOT_FINAL = "${libdir}/go"
10export GOROOT_FINAL
11
12# Incompatible with musl, at least for now
13COMPATIBLE_HOST_libc-musl_class-target = "null"
14# x32 ABI is not supported on go compiler so far
15COMPATIBLE_HOST_linux-gnux32 = "null"
16# ppc32 is not supported in go compilers
17COMPATIBLE_HOST_powerpc = "null"
diff --git a/meta/recipes-devtools/go/go-cross_1.7.bb b/meta/recipes-devtools/go/go-cross_1.7.bb
new file mode 100644
index 0000000000..56ee084b10
--- /dev/null
+++ b/meta/recipes-devtools/go/go-cross_1.7.bb
@@ -0,0 +1,5 @@
1require go-cross.inc
2require go_${PV}.bb
3
4# Go binaries are not understood by the strip tool.
5INHIBIT_SYSROOT_STRIP = "1"
diff --git a/meta/recipes-devtools/go/go-cross_1.8.bb b/meta/recipes-devtools/go/go-cross_1.8.bb
new file mode 100644
index 0000000000..56ee084b10
--- /dev/null
+++ b/meta/recipes-devtools/go/go-cross_1.8.bb
@@ -0,0 +1,5 @@
1require go-cross.inc
2require go_${PV}.bb
3
4# Go binaries are not understood by the strip tool.
5INHIBIT_SYSROOT_STRIP = "1"
diff --git a/meta/recipes-devtools/go/go-native.inc b/meta/recipes-devtools/go/go-native.inc
new file mode 100644
index 0000000000..89bc63459d
--- /dev/null
+++ b/meta/recipes-devtools/go/go-native.inc
@@ -0,0 +1,54 @@
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
15 export TMPDIR=${WORKDIR}/build-tmp
16 mkdir -p ${WORKDIR}/build-tmp
17
18 cd src
19 CGO_ENABLED=0 ./make.bash --host-only
20}
21
22make_wrapper() {
23 rm -f ${D}${bindir}/$2
24 cat <<END >${D}${bindir}/$2
25#!/bin/bash
26here=\`dirname \$0\`
27export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
28\$here/../lib/go/bin/$1 "\$@"
29END
30 chmod +x ${D}${bindir}/$2
31}
32
33do_install() {
34 install -d ${D}${libdir}/go
35 cp -a ${B}/pkg ${D}${libdir}/go/
36 install -d ${D}${libdir}/go/src
37 (cd ${S}/src; for d in *; do \
38 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
39 done)
40
41 install -d ${D}${bindir} ${D}${libdir}/go/bin
42 for f in ${B}/bin/*
43 do
44 base=`basename $f`
45 install -m755 $f ${D}${libdir}/go/bin
46 make_wrapper $base $base
47 done
48}
49
50do_package[noexec] = "1"
51do_packagedata[noexec] = "1"
52do_package_write_ipk[noexec] = "1"
53do_package_write_deb[noexec] = "1"
54do_package_write_rpm[noexec] = "1"
diff --git a/meta/recipes-devtools/go/go-native_1.4.bb b/meta/recipes-devtools/go/go-native_1.4.bb
new file mode 100644
index 0000000000..bbf3c0dd73
--- /dev/null
+++ b/meta/recipes-devtools/go/go-native_1.4.bb
@@ -0,0 +1,2 @@
1require ${PN}.inc
2require go-${PV}.inc
diff --git a/meta/recipes-devtools/go/go.inc b/meta/recipes-devtools/go/go.inc
new file mode 100644
index 0000000000..0c315afe06
--- /dev/null
+++ b/meta/recipes-devtools/go/go.inc
@@ -0,0 +1,87 @@
1inherit goarch
2# libgcc is required for the target specific libraries to build properly
3DEPENDS += " go-native libgcc"
4# Prevent runstrip from running because you get errors when the host arch != target arch
5INHIBIT_PACKAGE_STRIP = "1"
6INHIBIT_SYSROOT_STRIP = "1"
7
8# Incompatible with musl, at least for now
9COMPATIBLE_HOST_libc-musl_class-target = "null"
10# x32 ABI is not supported on go compiler so far
11COMPATIBLE_HOST_linux-gnux32 = "null"
12# ppc32 is not supported in go compilers
13COMPATIBLE_HOST_powerpc = "null"
14
15export GOHOSTOS = "${BUILD_GOOS}"
16export GOHOSTARCH = "${BUILD_GOARCH}"
17export GOOS = "${TARGET_GOOS}"
18export GOARCH = "${TARGET_GOARCH}"
19export GOARM = "${TARGET_GOARM}"
20export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
21export GOROOT_FINAL = "${libdir}/go"
22export CGO_ENABLED = "1"
23export CC_FOR_TARGET = "${CC}"
24export CXX_FOR_TARGET = "${CXX}"
25
26do_configure[noexec] = "1"
27
28do_compile_prepend_class-cross() {
29 export CGO_ENABLED=0
30}
31
32do_compile() {
33 export GOBIN="${B}/bin"
34 export CC="${@d.getVar('BUILD_CC', True).strip()}"
35 rm -rf ${GOBIN} ${B}/pkg
36 mkdir ${GOBIN}
37
38 export TMPDIR=${WORKDIR}/build-tmp
39 mkdir -p ${WORKDIR}/build-tmp
40
41 cd src
42 ./make.bash --host-only
43 # Ensure cgo.a is built with the target toolchain
44 export GOBIN="${B}/target/bin"
45 rm -rf ${GOBIN}
46 mkdir -p ${GOBIN}
47 GO_FLAGS="-a" ./make.bash
48}
49
50do_install_class-target() {
51 install -d ${D}${libdir}/go
52 cp -a ${B}/pkg ${D}${libdir}/go/
53 install -d ${D}${libdir}/go/src
54 (cd ${S}/src; for d in *; do \
55 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
56 done)
57 install -d ${D}${bindir}
58 if [ -d ${B}/bin/${GOOS}_${GOARCH} ]
59 then
60 install -m 0755 ${B}/bin/${GOOS}_${GOARCH}/* ${D}${bindir}
61 else
62 install -m 0755 ${B}/bin/* ${D}${bindir}
63 fi
64}
65
66do_install_class-cross() {
67 install -d ${D}${libdir}/go
68 cp -a ${B}/pkg ${D}${libdir}/go/
69 install -d ${D}${libdir}/go/src
70 (cd ${S}/src; for d in *; do \
71 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
72 done)
73 install -d ${D}${bindir}
74 for f in ${B}/bin/go*
75 do
76 install -m755 $f ${D}${bindir}
77 done
78}
79
80INSANE_SKIP_${PN} += "staticdev"
81RDEPENDS_${PN} += "perl"
82
83do_package[noexec] = "1"
84do_packagedata[noexec] = "1"
85do_package_write_ipk[noexec] = "1"
86do_package_write_deb[noexec] = "1"
87do_package_write_rpm[noexec] = "1"
diff --git a/meta/recipes-devtools/go/go_1.6.bb b/meta/recipes-devtools/go/go_1.6.bb
new file mode 100644
index 0000000000..2f590338c4
--- /dev/null
+++ b/meta/recipes-devtools/go/go_1.6.bb
@@ -0,0 +1,4 @@
1require go.inc
2require go-${PV}.inc
3
4BBCLASSEXTEND = "cross"
diff --git a/meta/recipes-devtools/go/go_1.7.bb b/meta/recipes-devtools/go/go_1.7.bb
new file mode 100644
index 0000000000..e7a6ab277e
--- /dev/null
+++ b/meta/recipes-devtools/go/go_1.7.bb
@@ -0,0 +1,2 @@
1require go-${PV}.inc
2require go.inc
diff --git a/meta/recipes-devtools/go/go_1.8.bb b/meta/recipes-devtools/go/go_1.8.bb
new file mode 100644
index 0000000000..e7a6ab277e
--- /dev/null
+++ b/meta/recipes-devtools/go/go_1.8.bb
@@ -0,0 +1,2 @@
1require go-${PV}.inc
2require go.inc