On Tue, Apr 5, 2016 at 5:54 AM, <[email protected]> wrote: > From: Zongchun Yu <[email protected]> > > * Add go-native as build bootstrap for go-cross. > * Upgrade go-cross to v1.5.2 >
In the past, we've been cherry picking this from oe-meta-go, so we can tweak things easily for our needs. Is this change from scratch ? Or from there as well ? This looks fine to me in general, but I'd like to couple it to the docker update, so I'll pend this on v2 of the docker update ... when I can build and test both myself as well. Bruce > > Signed-off-by: Zongchun Yu <[email protected]> > --- > classes/go-osarchmap.bbclass | 38 ++++++ > ...alignment-for-the-.rel.plt-section-on-32-.patch | 30 ----- > .../go-cross/files/bsd_svid_source.patch | 37 ------ > recipes-devtools/go-cross/files/ccache.patch | 147 > --------------------- > recipes-devtools/go-cross/go-1.4.inc | 14 ++ > .../go-cross/go-1.4/016-armhf-elf-header.patch | 21 +++ > recipes-devtools/go-cross/go-1.4/syslog.patch | 57 ++++++++ > recipes-devtools/go-cross/go-1.5.inc | 19 +++ > .../go-cross/go-1.5/armhf-elf-header.patch | 19 +++ > .../go-cross/go-1.5/fix-cc-handling.patch | 46 +++++++ > .../go-cross/go-1.5/fix-target-cc-for-build.patch | 13 ++ > recipes-devtools/go-cross/go-1.5/gotooldir.patch | 26 ++++ > .../go-1.5/split-host-and-target-build.patch | 58 ++++++++ > recipes-devtools/go-cross/go-1.5/syslog.patch | 57 ++++++++ > recipes-devtools/go-cross/go-common.inc | 20 +++ > recipes-devtools/go-cross/go-cross-1.3_1.3.bb | 72 ---------- > recipes-devtools/go-cross/go-cross.inc | 45 +++++++ > recipes-devtools/go-cross/go-cross_1.5.bb | 2 + > recipes-devtools/go-cross/go-native.inc | 50 +++++++ > recipes-devtools/go-cross/go-native_1.4.bb | 2 + > 20 files changed, 487 insertions(+), 286 deletions(-) > create mode 100644 classes/go-osarchmap.bbclass > delete mode 100644 > recipes-devtools/go-cross/files/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch > delete mode 100644 recipes-devtools/go-cross/files/bsd_svid_source.patch > delete mode 100644 recipes-devtools/go-cross/files/ccache.patch > create mode 100644 recipes-devtools/go-cross/go-1.4.inc > create mode 100644 > recipes-devtools/go-cross/go-1.4/016-armhf-elf-header.patch > create mode 100644 recipes-devtools/go-cross/go-1.4/syslog.patch > create mode 100644 recipes-devtools/go-cross/go-1.5.inc > create mode 100644 recipes-devtools/go-cross/go-1.5/armhf-elf-header.patch > create mode 100644 recipes-devtools/go-cross/go-1.5/fix-cc-handling.patch > create mode 100644 > recipes-devtools/go-cross/go-1.5/fix-target-cc-for-build.patch > create mode 100644 recipes-devtools/go-cross/go-1.5/gotooldir.patch > create mode 100644 > recipes-devtools/go-cross/go-1.5/split-host-and-target-build.patch > create mode 100644 recipes-devtools/go-cross/go-1.5/syslog.patch > create mode 100644 recipes-devtools/go-cross/go-common.inc > delete mode 100644 recipes-devtools/go-cross/go-cross-1.3_1.3.bb > create mode 100644 recipes-devtools/go-cross/go-cross.inc > create mode 100644 recipes-devtools/go-cross/go-cross_1.5.bb > create mode 100644 recipes-devtools/go-cross/go-native.inc > create mode 100644 recipes-devtools/go-cross/go-native_1.4.bb > > diff --git a/classes/go-osarchmap.bbclass b/classes/go-osarchmap.bbclass > new file mode 100644 > index 0000000..4e00c7b > --- /dev/null > +++ b/classes/go-osarchmap.bbclass > @@ -0,0 +1,38 @@ > +BUILD_GOOS = "${@go_map_os(d.getVar('BUILD_OS', True), d)}" > +BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH', True), d)}" > +BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}" > +HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS', True), d)}" > +HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH', True), d)}" > +HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH', True), > d.getVar('TUNE_FEATURES', True), d)}" > +HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}" > +TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS', True), d)}" > +TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH', True), d)}" > +TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH', True), > d.getVar('TUNE_FEATURES', True), d)}" > +TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}" > +GO_BUILD_BINDIR = > "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE',True) == > d.getVar('HOST_GOTUPLE',True)]}" > + > +def go_map_arch(a, d): > + import re > + if re.match('i.86', a): > + return '386' > + elif a == 'x86_64': > + return 'amd64' > + elif re.match('arm.*', a): > + return 'arm' > + elif re.match('aarch64.*', a): > + return 'arm64' > + elif re.match('p(pc|owerpc)(|64)', a): > + return 'powerpc' > + else: > + bb.error("cannot map '%s' to a Go architecture" % a) > + > +def go_map_arm(a, f, d): > + import re > + if re.match('arm.*', a) and re.match('arm.*7.*', f): > + return '7' > + return '' > + > +def go_map_os(o, d): > + if o.startswith('linux'): > + return 'linux' > + 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 4cfa9d1..0000000 > --- > 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 @@ > -From 855145d5c03c4b4faf60736c38d7a299c682af4a Mon Sep 17 00:00:00 2001 > -From: Shenghou Ma <[email protected]> > -Date: Sat, 7 Feb 2015 14:06:02 -0500 > -Subject: [PATCH] cmd/ld: set alignment for the .rel.plt section on 32-bit > - architectures > - > -Fixes #9802. > - > -Change-Id: I22c52a37bdb23a14cc4615c9519431bb14ca81ca > -Reviewed-on: https://go-review.googlesource.com/4170 > -Reviewed-by: Ian Lance Taylor <[email protected]> > ---- > - src/cmd/ld/elf.c | 1 + > - 1 file changed, 1 insertion(+) > - > -diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c > -index 12ced98..97ed4bd 100644 > ---- a/src/cmd/ld/elf.c > -+++ b/src/cmd/ld/elf.c > -@@ -1363,6 +1363,7 @@ asmbelf(vlong symo) > - sh->type = SHT_REL; > - sh->flags = SHF_ALLOC; > - sh->entsize = ELF32RELSIZE; > -+ sh->addralign = 4; > - sh->link = elfshname(".dynsym")->shnum; > - shsym(sh, linklookup(ctxt, ".rel.plt", 0)); > - > --- > -1.9.1 > - > 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 21e1d4c..0000000 > --- a/recipes-devtools/go-cross/files/bsd_svid_source.patch > +++ /dev/null > @@ -1,37 +0,0 @@ > -golang-cross: do_compile fails cc1: all warnings being treated as errors > - > -glibc 2.20 deprecates _BSD_SOURCE and _SVID_SOURCE and emits an error > -message. From patch 16632: > - libc [PATCH] BZ #16632: Disable _SVID_SOURCE/_BSD_SOURCE warning > - if _DEFAULT_SOURCE is defined > - > -Since we also need to support glibc before 2.20, from the release notes > -for glibc 2.20, the recommended fix is to define _DEFAULT_SOURCE > - > -(fixed upstream) > -https://groups.google.com/forum/#!topic/golang-codereviews/S4TARFCxu2k > - > -Signed-off-by: Amy Fong <[email protected]> > ---- > - include/u.h | 10 ++++++++++ > - 1 file changed, 10 insertions(+) > - > ---- a/include/u.h > -+++ b/include/u.h > -@@ -38,6 +38,16 @@ > - # define __MAKECONTEXT_V2_SOURCE 1 > - # endif > - #endif > -+/** > -+ * in glibc >= 2.20, _BSD_SOURCE and _SVID_SOURCE causes warning > -+ * messages if _DEFAULT_SOURCE is not defined. > -+ * > -+ * From glibc 2.20 release notes, since this application needs > _BSD_SOURCE > -+ * and/or _SVID_SOURCE and we must support glibc < 2.19 and > -+ * glibc >= 2.20, then define all 3 (_DEFAULT_SOURCE, _BSD_SOURCE, > -+ * and _SVID_SOURCE) unconditionally > -+ */ > -+#define _DEFAULT_SOURCE 1 > - #define _BSD_SOURCE 1 > - #define _NETBSD_SOURCE 1 /* NetBSD */ > - #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 b7a64bf..0000000 > --- a/recipes-devtools/go-cross/files/ccache.patch > +++ /dev/null > @@ -1,147 +0,0 @@ > -golang doesn't work with ccache. In the current state, a lot of parsing > -happens where it'll grab the first string in CC or LD and uses that for > -its builds. When ccache is enabled, it results in trying to do builds > -with just ccache. > - > -The brokeness is seen when building with apps that uses cgo, like docker. > -To enable ccache to work, some string comparisons and changes to parsing > -had to be made. > - > -Signed-off-by: Amy Fong <[email protected]> > - > -Index: go/src/cmd/cgo/gcc.go > -=================================================================== > ---- go.orig/src/cmd/cgo/gcc.go 2014-06-18 17:26:26.000000000 -0700 > -+++ go/src/cmd/cgo/gcc.go 2015-06-18 13:19:08.908877160 -0700 > -@@ -712,6 +712,12 @@ > - func (p *Package) gccBaseCmd() []string { > - // Use $CC if set, since that's what the build uses. > - if ret := strings.Fields(os.Getenv("CC")); len(ret) > 0 { > -+ if strings.Contains(ret[0], "ccache") { > -+ base_cc := ret[0] + " " + ret[1] > -+ os.Setenv("CCACHE_CC", ret[1]) > -+ ret[1] = base_cc > -+ return ret[1:] > -+ } > - return ret > - } > - // Try $GCC if set, since that's what we used to use. > -Index: go/src/pkg/os/exec/lp_unix.go > -=================================================================== > ---- go.orig/src/pkg/os/exec/lp_unix.go 2014-06-18 17:26:25.000000000 -0700 > -+++ go/src/pkg/os/exec/lp_unix.go 2015-06-18 13:19:29.464876331 -0700 > -@@ -35,8 +35,14 @@ > - // (only bypass the path if file begins with / or ./ or ../) > - // but that would not match all the Unix shells. > - > -- if strings.Contains(file, "/") { > -- err := findExecutable(file) > -+ tmp := file > -+ if strings.Contains(file, " ") { > -+ exec_part := strings.Split(file, " ")[0] > -+ tmp = exec_part > -+ } > -+ > -+ if strings.Contains(tmp, "/") { > -+ err := findExecutable(tmp) > - if err == nil { > - return file, nil > - } > -@@ -51,7 +57,7 @@ > - // Unix shell semantics: path element "" means "." > - dir = "." > - } > -- path := dir + "/" + file > -+ path := dir + "/" + tmp > - if err := findExecutable(path); err == nil { > - return path, nil > - } > -Index: go/src/cmd/go/build.go > -=================================================================== > ---- go.orig/src/cmd/go/build.go 2014-06-18 17:26:26.000000000 -0700 > -+++ go/src/cmd/go/build.go 2015-06-18 13:20:08.724874749 -0700 > -@@ -2005,8 +2005,15 @@ > - // strings returned are "gcc", "-I", objdir (and cuts them off). > - > - compiler := envList(envvar, defcmd) > -- a := []string{compiler[0], "-I", objdir} > -- a = append(a, compiler[1:]...) > -+ > -+ a := []string{compiler[0]} > -+ if strings.Contains(compiler[0], "ccache") { > -+ a = append(a, compiler[1], "-I", objdir) > -+ a = append(a, compiler[2:]...) > -+ } else { > -+ a = append(a, "-I", objdir) > -+ a = append(a, compiler[1:]...) > -+ } > - > - // Definitely want -fPIC but on Windows gcc complains > - // "-fPIC ignored for target (all code is position independent)" > -Index: go/src/cmd/ld/lib.c > -=================================================================== > ---- go.orig/src/cmd/ld/lib.c 2014-06-18 17:26:27.000000000 -0700 > -+++ go/src/cmd/ld/lib.c 2015-06-18 13:18:39.564878343 -0700 > -@@ -552,7 +552,7 @@ > - void > - hostlink(void) > - { > -- char *p, **argv; > -+ char *p, *q, **argv; > - int c, i, w, n, argc, len; > - Hostobj *h; > - Biobuf *f; > -@@ -577,6 +577,19 @@ > - if(extld == nil) > - extld = "gcc"; > - argv[argc++] = extld; > -+ > -+ p = extldflags; > -+ if (strstr(argv[0], "ccache") != NULL) { > -+ while(p != nil) { > -+ while(*p == ' ') > -+ *p++ = '\0'; > -+ if(*p == '\0') > -+ break; > -+ argv[argc++] = p; > -+ p = strchr(p + 1, ' '); > -+ break; > -+ } > -+ } > - switch(thechar){ > - case '8': > - argv[argc++] = "-m32"; > -@@ -629,12 +642,12 @@ > - errorexit(); > - } > - Bseek(f, h->off, 0); > -- p = smprint("%s/%06d.o", tmpdir, i); > -- argv[argc++] = p; > -- w = create(p, 1, 0775); > -+ q = smprint("%s/%06d.o", tmpdir, i); > -+ argv[argc++] = q; > -+ w = create(q, 1, 0775); > - if(w < 0) { > - ctxt->cursym = S; > -- diag("cannot create %s: %r", p); > -+ diag("cannot create %s: %r", q); > - errorexit(); > - } > - len = h->len; > -@@ -646,7 +659,7 @@ > - } > - if(close(w) < 0) { > - ctxt->cursym = S; > -- diag("cannot write %s: %r", p); > -+ diag("cannot write %s: %r", q); > - errorexit(); > - } > - Bterm(f); > -@@ -656,7 +669,6 @@ > - for(i=0; i<nldflag; i++) > - argv[argc++] = ldflag[i]; > - > -- p = extldflags; > - while(p != nil) { > - while(*p == ' ') > - *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 0000000..0ffbcd0 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.4.inc > @@ -0,0 +1,14 @@ > +require go-common.inc > + > +PV = "1.4.2" > +GO_BASEVERSION = "1.4" > +FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" > + > +SRC_URI += "\ > + file://016-armhf-elf-header.patch \ > + file://syslog.patch \ > +" > + > +LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" > +SRC_URI[md5sum] = "907f85c8fa765d31f7f955836fec4049" > +SRC_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 0000000..1ae53a3 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.4/016-armhf-elf-header.patch > @@ -0,0 +1,21 @@ > +Description: Use correct ELF header for armhf binaries. > +Author: Adam Conrad <[email protected]> > +Last-Update: 2013-07-08 > + > +Index: go/src/cmd/ld/elf.c > +=================================================================== > +--- go.orig/src/cmd/ld/elf.c 2015-02-20 10:49:58.763451586 -0800 > ++++ go/src/cmd/ld/elf.c 2015-02-20 10:49:27.895478521 -0800 > +@@ -57,7 +57,11 @@ > + case '5': > + // we use EABI on both linux/arm and freebsd/arm. > + if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd) > +- hdr.flags = 0x5000002; // has entry point, > Version5 EABI > ++#ifdef __ARM_PCS_VFP > ++ hdr.flags = 0x5000402; // has entry point, > Version5 EABI, hard-float ABI > ++#else > ++ hdr.flags = 0x5000202; // has entry point, > Version5 EABI, soft-float ABI > ++#endif > + // fallthrough > + default: > + 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 0000000..ce82a4f > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.4/syslog.patch > @@ -0,0 +1,57 @@ > +diff -r -u go/src/log/syslog/syslog.go > /home/achang/GOCOPY/go/src/log/syslog/syslog.go > +--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800 > ++++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 > 11:44:37.710403200 -0700 > +@@ -33,6 +33,9 @@ > + const severityMask = 0x07 > + const facilityMask = 0xf8 > + > ++var writeTimeout = 1 * time.Second > ++var connectTimeout = 1 * time.Second > ++ > + const ( > + // Severity. > + > +@@ -100,6 +103,7 @@ > + type serverConn interface { > + writeString(p Priority, hostname, tag, s, nl string) error > + close() error > ++ setWriteDeadline(t time.Time) error > + } > + > + type netConn struct { > +@@ -273,7 +277,11 @@ > + nl = "\n" > + } > + > +- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl) > ++ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout)) > ++ if err != nil { > ++ return 0, err > ++ } > ++ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl) > + if err != nil { > + return 0, err > + } > +@@ -305,6 +313,10 @@ > + return n.conn.Close() > + } > + > ++func (n *netConn) setWriteDeadline(t time.Time) error { > ++ return n.conn.SetWriteDeadline(t) > ++} > ++ > + // NewLogger creates a log.Logger whose output is written to > + // the system log service with the specified priority. The logFlag > + // argument is the flag set passed through to log.New to create > +diff -r -u go/src/log/syslog/syslog_unix.go > /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go > +--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800 > ++++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 > 11:44:39.010403175 -0700 > +@@ -19,7 +19,7 @@ > + logPaths := []string{"/dev/log", "/var/run/syslog"} > + for _, network := range logTypes { > + for _, path := range logPaths { > +- conn, err := net.Dial(network, path) > ++ conn, err := net.DialTimeout(network, path, > connectTimeout) > + if err != nil { > + continue > + } 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 0000000..bb91ed8 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.5.inc > @@ -0,0 +1,19 @@ > +require go-common.inc > + > +PV = "1.5.2" > +GO_BASEVERSION = "1.5" > +FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" > + > + > +SRC_URI += "\ > + file://armhf-elf-header.patch \ > + file://syslog.patch \ > + file://fix-target-cc-for-build.patch \ > + file://fix-cc-handling.patch \ > + file://split-host-and-target-build.patch \ > + file://gotooldir.patch \ > +" > + > +LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" > +SRC_URI[md5sum] = "38fed22e7b80672291e7cba7fb9c3475" > +SRC_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 0000000..f56869b > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.5/armhf-elf-header.patch > @@ -0,0 +1,19 @@ > +Index: go/src/cmd/link/internal/ld/elf.go > +=================================================================== > +--- go.orig/src/cmd/link/internal/ld/elf.go 2015-07-29 > 13:05:25.952533140 -0700 > ++++ go/src/cmd/link/internal/ld/elf.go 2015-07-29 13:14:53.413112995 -0700 > +@@ -780,7 +780,13 @@ > + // 32-bit architectures > + case '5': > + // we use EABI on both linux/arm and freebsd/arm. > +- if HEADTYPE == obj.Hlinux || HEADTYPE == obj.Hfreebsd { > ++ if HEADTYPE == obj.Hlinux { > ++ if Ctxt.Goarm == 7 { > ++ ehdr.flags = 0x5000402 // has entry point, > Version5 EABI, hard float > ++ } else { > ++ ehdr.flags = 0x5000202 // has entry point, > Version5 EABI, soft float > ++ } > ++ } else if HEADTYPE == obj.Hfreebsd { > + ehdr.flags = 0x5000002 // has entry point, > Version5 EABI > + } > + 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 0000000..85770a9 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.5/fix-cc-handling.patch > @@ -0,0 +1,46 @@ > +Index: go/src/cmd/go/build.go > +=================================================================== > +--- go.orig/src/cmd/go/build.go 2015-07-29 14:48:40.323185807 -0700 > ++++ go/src/cmd/go/build.go 2015-07-30 07:37:40.529818586 -0700 > +@@ -2805,12 +2805,24 @@ > + return b.ccompilerCmd("CC", defaultCC, objdir) > + } > + > ++// gccCmd returns a gcc command line prefix > ++// defaultCC is defined in zdefaultcc.go, written by cmd/dist. > ++func (b *builder) gccCmdForReal() []string { > ++ return envList("CC", defaultCC) > ++} > ++ > + // gxxCmd returns a g++ command line prefix > + // defaultCXX is defined in zdefaultcc.go, written by cmd/dist. > + func (b *builder) gxxCmd(objdir string) []string { > + return b.ccompilerCmd("CXX", defaultCXX, objdir) > + } > + > ++// gxxCmd returns a g++ command line prefix > ++// defaultCXX is defined in zdefaultcc.go, written by cmd/dist. > ++func (b *builder) gxxCmdForReal() []string { > ++ return envList("CXX", defaultCXX) > ++} > ++ > + // ccompilerCmd returns a command line prefix for the given environment > + // variable and using the default command when the variable is empty. > + func (b *builder) ccompilerCmd(envvar, defcmd, objdir string) []string { > +Index: go/src/cmd/go/env.go > +=================================================================== > +--- go.orig/src/cmd/go/env.go 2015-07-29 14:48:40.323185807 -0700 > ++++ go/src/cmd/go/env.go 2015-07-30 07:40:54.461655721 -0700 > +@@ -52,10 +52,9 @@ > + > + if goos != "plan9" { > + cmd := b.gccCmd(".") > +- env = append(env, envVar{"CC", cmd[0]}) > ++ env = append(env, envVar{"CC", > strings.Join(b.gccCmdForReal(), " ")}) > + env = append(env, envVar{"GOGCCFLAGS", > strings.Join(cmd[3:], " ")}) > +- cmd = b.gxxCmd(".") > +- env = append(env, envVar{"CXX", cmd[0]}) > ++ env = append(env, envVar{"CXX", > strings.Join(b.gxxCmdForReal(), " ")}) > + } > + > + 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 0000000..adfeb6b > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.5/fix-target-cc-for-build.patch > @@ -0,0 +1,13 @@ > +Index: go/src/make.bash > +=================================================================== > +--- go.orig/src/make.bash 2015-07-29 13:28:11.334031696 -0700 > ++++ go/src/make.bash 2015-07-29 13:36:55.814465630 -0700 > +@@ -158,7 +158,7 @@ > + fi > + > + echo "##### Building packages and commands for $GOOS/$GOARCH." > +-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags > "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd > ++CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags > "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd > + echo > + > + 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 0000000..473a328 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.5/gotooldir.patch > @@ -0,0 +1,26 @@ > +Index: go/src/go/build/build.go > +=================================================================== > +--- go.orig/src/go/build/build.go > ++++ go/src/go/build/build.go > +@@ -1388,7 +1388,7 @@ func init() { > + } > + > + // ToolDir is the directory containing build tools. > +-var ToolDir = filepath.Join(runtime.GOROOT(), > "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH) > ++var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), > "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)) > + > + // IsLocalImport reports whether the import path is > + // a local import path, like ".", "..", "./foo", or "../foo". > +Index: go/src/cmd/go/build.go > +=================================================================== > +--- go.orig/src/cmd/go/build.go > ++++ go/src/cmd/go/build.go > +@@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err > + } > + > + cgoExe := tool("cgo") > +- if a.cgo != nil && a.cgo.target != "" { > ++ if a.cgo != nil && a.cgo.target != "" && > os.Getenv("GOTOOLDIR") == "" { > + cgoExe = a.cgo.target > + } > + 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 0000000..85fb240 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.5/split-host-and-target-build.patch > @@ -0,0 +1,58 @@ > +Index: go/src/make.bash > +=================================================================== > +--- go.orig/src/make.bash > ++++ go/src/make.bash > +@@ -143,12 +143,23 @@ if [ "$1" = "--no-clean" ]; then > + buildall="" > + shift > + fi > +-./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds > go_bootstrap > +-# Delay move of dist tool to now, because bootstrap may clear tool > directory. > +-mv cmd/dist/dist "$GOTOOLDIR"/dist > +-echo > + > +-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then > ++do_host_build="yes" > ++do_target_build="yes" > ++if [ "$1" = "--target-only" ]; then > ++ do_host_build="no" > ++ shift > ++elif [ "$1" = "--host-only" ]; then > ++ do_target_build="no" > ++ shift > ++fi > ++ > ++if [ "$do_host_build" = "yes" ]; then > ++ ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds > go_bootstrap > ++ # Delay move of dist tool to now, because bootstrap may clear tool > directory. > ++ mv cmd/dist/dist "$GOTOOLDIR"/dist > ++ echo > ++ > + echo "##### Building packages and commands for host, > $GOHOSTOS/$GOHOSTARCH." > + # CC_FOR_TARGET is recorded as the default compiler for the go > tool. When building for the host, however, > + # use the host compiler, CC, from `cmd/dist/dist env` instead. > +@@ -157,11 +168,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH > + echo > + fi > + > +-echo "##### Building packages and commands for $GOOS/$GOARCH." > +-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags > "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd > +-echo > ++if [ "$do_target_build" = "yes" ]; then > ++ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}" > ++ echo "##### Building packages and commands for $GOOS/$GOARCH." > ++ if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a > "$do_host_build" = "yes" ]; then > ++ rm -rf ./host-tools > ++ mkdir ./host-tools > ++ mv "$GOTOOLDIR"/* ./host-tools > ++ GOTOOLDIR="$PWD/host-tools" > ++ fi > ++ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap > install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v > ${GO_INSTALL} > ++ echo > + > +-rm -f "$GOTOOLDIR"/go_bootstrap > ++ rm -f "$GOTOOLDIR"/go_bootstrap > ++fi > + > + if [ "$1" != "--no-banner" ]; then > + "$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 0000000..ce82a4f > --- /dev/null > +++ b/recipes-devtools/go-cross/go-1.5/syslog.patch > @@ -0,0 +1,57 @@ > +diff -r -u go/src/log/syslog/syslog.go > /home/achang/GOCOPY/go/src/log/syslog/syslog.go > +--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800 > ++++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 > 11:44:37.710403200 -0700 > +@@ -33,6 +33,9 @@ > + const severityMask = 0x07 > + const facilityMask = 0xf8 > + > ++var writeTimeout = 1 * time.Second > ++var connectTimeout = 1 * time.Second > ++ > + const ( > + // Severity. > + > +@@ -100,6 +103,7 @@ > + type serverConn interface { > + writeString(p Priority, hostname, tag, s, nl string) error > + close() error > ++ setWriteDeadline(t time.Time) error > + } > + > + type netConn struct { > +@@ -273,7 +277,11 @@ > + nl = "\n" > + } > + > +- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl) > ++ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout)) > ++ if err != nil { > ++ return 0, err > ++ } > ++ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl) > + if err != nil { > + return 0, err > + } > +@@ -305,6 +313,10 @@ > + return n.conn.Close() > + } > + > ++func (n *netConn) setWriteDeadline(t time.Time) error { > ++ return n.conn.SetWriteDeadline(t) > ++} > ++ > + // NewLogger creates a log.Logger whose output is written to > + // the system log service with the specified priority. The logFlag > + // argument is the flag set passed through to log.New to create > +diff -r -u go/src/log/syslog/syslog_unix.go > /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go > +--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800 > ++++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 > 11:44:39.010403175 -0700 > +@@ -19,7 +19,7 @@ > + logPaths := []string{"/dev/log", "/var/run/syslog"} > + for _, network := range logTypes { > + for _, path := range logPaths { > +- conn, err := net.Dial(network, path) > ++ conn, err := net.DialTimeout(network, path, > connectTimeout) > + if err != nil { > + continue > + } else { > diff --git a/recipes-devtools/go-cross/go-common.inc > b/recipes-devtools/go-cross/go-common.inc > new file mode 100644 > index 0000000..f9587ea > --- /dev/null > +++ b/recipes-devtools/go-cross/go-common.inc > @@ -0,0 +1,20 @@ > +SUMMARY = "Go programming language compiler" > +DESCRIPTION = " The Go programming language is an open source project to > make \ > + programmers more productive. Go is expressive, concise, clean, and\ > + efficient. Its concurrency mechanisms make it easy to write programs\ > + that get the most out of multicore and networked machines, while its\ > + novel type system enables flexible and modular program construction.\ > + Go compiles quickly to machine code yet has the convenience of\ > + garbage collection and the power of run-time reflection. It's a\ > + fast, statically typed, compiled language that feels like a\ > + dynamically typed, interpreted language." > +HOMEPAGE = " http://golang.org/" > +LICENSE = "BSD-3-Clause" > + > +inherit go-osarchmap > + > +SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz" > +S = "${WORKDIR}/go" > +B = "${S}" > + > +INHIBIT_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 dd57e56..0000000 > --- a/recipes-devtools/go-cross/go-cross-1.3_1.3.bb > +++ /dev/null > @@ -1,72 +0,0 @@ > -DESCRIPTION = "\ > - Go is an open source programming language that makes it easy to build > simple, \ > - reliable, and efficient software. \ > - " > -HOMEPAGE = "https://golang.org/" > -LICENSE = "BSD-3-Clause" > - > -DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc" > - > -SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz" > - > -S = "${WORKDIR}/go/" > - > -inherit cross > - > -LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" > -SRC_URI[md5sum] = "4b66d7249554181c314f139ea78920b1" > -SRC_URI[sha256sum] = > "eb983e6c5b2b9838f482c5442b1ac1856f610f2b21f3c123b3fedb48ffc35382" > - > -SRC_URI += "\ > - file://bsd_svid_source.patch \ > - file://ccache.patch \ > - > file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \ > - " > - > -do_compile() { > - ## Setting `$GOBIN` doesn't do any good, looks like it ends up > copying binaries there. > - export GOROOT_FINAL="${SYSROOT}${libdir}/go-1.3" > - > - export GOHOSTOS="linux" > - export GOOS="linux" > - > - export GOARCH="${TARGET_ARCH}" > - # golang only support 386, amd64 and arm architecture. > - if [ "${TARGET_ARCH}" = "x86_64" ]; then > - export GOARCH="amd64" > - elif [ "${TARGET_ARCH}" = "i586" ]; then > - export GOARCH="386" > - fi > - if [ "${TARGET_ARCH}" = "arm" ] > - then > - if [ `echo ${TUNE_PKGARCH} | cut -c 1-7` = "cortexa" ] > - then > - echo GOARM 7 > - export GOARM="7" > - fi > - fi > - > - export CGO_ENABLED="1" > - ## TODO: consider setting GO_EXTLINK_ENABLED > - > - export CC="${BUILD_CC}" > - export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} > --sysroot=${STAGING_DIR_TARGET}" > - export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} > --sysroot=${STAGING_DIR_TARGET}" > - export GO_CCFLAGS="${HOST_CFLAGS}" > - export GO_LDFLAGS="${HOST_LDFLAGS}" > - > - cd src && ./make.bash > -} > - > -do_install() { > - ## It should be okay to ignore `${WORKDIR}/go/bin/linux_arm`... > - ## Also `gofmt` is not needed right now. > - install -d "${D}${bindir}/go-1.3" > - install -m 0755 "${WORKDIR}/go/bin/go" "${D}${bindir}/go-1.3/" > - install -d "${D}${libdir}/go-1.3" > - > - ## TODO: use `install` instead of `cp` > - for dir in include lib pkg src test > - do cp -a "${WORKDIR}/go/${dir}" "${D}${libdir}/go-1.3/" > - done > -} > diff --git a/recipes-devtools/go-cross/go-cross.inc > b/recipes-devtools/go-cross/go-cross.inc > new file mode 100644 > index 0000000..eea1b2c > --- /dev/null > +++ b/recipes-devtools/go-cross/go-cross.inc > @@ -0,0 +1,45 @@ > +inherit cross > + > +DEPENDS += "go-native" > + > +export GOHOSTOS = "${BUILD_GOOS}" > +export GOHOSTARCH = "${BUILD_GOARCH}" > +export GOOS = "${TARGET_GOOS}" > +export GOARCH = "${TARGET_GOARCH}" > +export GOARM = "${TARGET_GOARM}" > +export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" > +export GOROOT_FINAL = "${libdir}/go" > +export CGO_ENABLED = "1" > +export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} > --sysroot=${STAGING_DIR_TARGET}" > +export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} > --sysroot=${STAGING_DIR_TARGET}" > +CC = "${@d.getVar('BUILD_CC', True).strip()}" > + > +do_configure[noexec] = "1" > + > +do_compile() { > + export GOBIN="${B}/bin" > + rm -rf ${GOBIN} ${B}/pkg > + mkdir ${GOBIN} > + cd src > + ./make.bash --host-only > +} > + > +do_install() { > + install -d ${D}${libdir}/go > + cp -a ${B}/pkg ${D}${libdir}/go/ > + install -d ${D}${libdir}/go/src > + (cd ${S}/src; for d in *; do \ > + [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ > + done) > + install -d ${D}${bindir} > + for f in ${B}/bin/* > + do > + install -m755 $f ${D}${bindir} > + done > +} > + > +do_package[noexec] = "1" > +do_packagedata[noexec] = "1" > +do_package_write_ipk[noexec] = "1" > +do_package_write_deb[noexec] = "1" > +do_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 0000000..80b5a03 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-cross_1.5.bb > @@ -0,0 +1,2 @@ > +require go-cross.inc > +require 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 0000000..ae3dc83 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-native.inc > @@ -0,0 +1,50 @@ > +inherit native > + > +export GOOS = "${BUILD_GOOS}" > +export GOARCH = "${BUILD_GOARCH}" > +export GOROOT_FINAL = "${STAGING_LIBDIR_NATIVE}/go" > +export CGO_ENABLED = "1" > + > +do_configure[noexec] = "1" > + > +do_compile() { > + export GOBIN="${B}/bin" > + rm -rf ${GOBIN} > + mkdir ${GOBIN} > + cd src > + ./make.bash --host-only > +} > + > + > +make_wrapper() { > + rm -f ${D}${bindir}/$2 > + cat <<END >${D}${bindir}/$2 > +#!/bin/bash > +here=\`dirname \$0\` > +export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" > +\$here/../lib/go/bin/$1 "\$@" > +END > + chmod +x ${D}${bindir}/$2 > +} > + > +do_install() { > + install -d ${D}${libdir}/go > + cp -a ${B}/pkg ${D}${libdir}/go/ > + install -d ${D}${libdir}/go/src > + (cd ${S}/src; for d in *; do \ > + [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ > + done) > + install -d ${D}${bindir} ${D}${libdir}/go/bin > + for f in ${B}/bin/* > + do > + base=`basename $f` > + install -m755 $f ${D}${libdir}/go/bin > + make_wrapper $base $base > + done > +} > + > +do_package[noexec] = "1" > +do_packagedata[noexec] = "1" > +do_package_write_ipk[noexec] = "1" > +do_package_write_deb[noexec] = "1" > +do_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 0000000..cf186e7 > --- /dev/null > +++ b/recipes-devtools/go-cross/go-native_1.4.bb > @@ -0,0 +1,2 @@ > +require go-native.inc > +require go-${PV}.inc > -- > 1.8.3.2 > > -- "Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
-- _______________________________________________ meta-virtualization mailing list [email protected] https://lists.yoctoproject.org/listinfo/meta-virtualization
