diff options
| author | Amy Fong <amy.fong@windriver.com> | 2015-07-27 14:14:16 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2015-07-29 11:07:17 -0400 |
| commit | 26b2724b4335a5e3038fec508e65a8d9c2f5792a (patch) | |
| tree | dd5cd4ca63f8717607e95c1f4e160b2db8cfd3c0 | |
| parent | acb711dfa93a916805c286fafa8c304394fc05cc (diff) | |
| download | meta-virtualization-26b2724b4335a5e3038fec508e65a8d9c2f5792a.tar.gz | |
golang: use oe-meta-go
From b101a0c7ce6ef1eb41bef786831e58fa4d1b069f Mon Sep 17 00:00:00 2001
From: Amy Fong <amy.fong@windriver.com>
Date: Mon, 27 Jul 2015 14:10:20 -0400
Subject: [PATCH] golang: use oe-meta-go
Update meta-virtualization to use go package from oe-meta-go.
The package golang-cross is go-cross in the oe-meta-go.
Signed-off-by: Amy Fong <amy.fong@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
| -rw-r--r-- | README | 1 | ||||
| -rw-r--r-- | recipes-containers/docker/docker_git.bb | 2 | ||||
| -rw-r--r-- | recipes-devtools/go/files/bsd_svid_source.patch | 37 | ||||
| -rw-r--r-- | recipes-devtools/go/files/ccache.patch | 147 | ||||
| -rw-r--r-- | recipes-devtools/go/golang-1.3.inc | 4 | ||||
| -rw-r--r-- | recipes-devtools/go/golang-cross.inc | 61 | ||||
| -rw-r--r-- | recipes-devtools/go/golang-cross_1.3.bb | 4 |
7 files changed, 2 insertions, 254 deletions
| @@ -20,6 +20,7 @@ layers: meta-oe | |||
| 20 | meta-networking | 20 | meta-networking |
| 21 | meta-filesystems | 21 | meta-filesystems |
| 22 | meta-python | 22 | meta-python |
| 23 | oe-meta-go | ||
| 23 | 24 | ||
| 24 | BBFILE_PRIORITY_openembedded-layer = "4" | 25 | BBFILE_PRIORITY_openembedded-layer = "4" |
| 25 | 26 | ||
diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb index ab322350..aa125a3a 100644 --- a/recipes-containers/docker/docker_git.bb +++ b/recipes-containers/docker/docker_git.bb | |||
| @@ -36,7 +36,7 @@ S = "${WORKDIR}/git" | |||
| 36 | DOCKER_VERSION = "1.6.2" | 36 | DOCKER_VERSION = "1.6.2" |
| 37 | PV = "${DOCKER_VERSION}+git${SRCREV}" | 37 | PV = "${DOCKER_VERSION}+git${SRCREV}" |
| 38 | 38 | ||
| 39 | DEPENDS = "golang-cross \ | 39 | DEPENDS = "go-cross \ |
| 40 | go-cli \ | 40 | go-cli \ |
| 41 | go-pty \ | 41 | go-pty \ |
| 42 | go-context \ | 42 | go-context \ |
diff --git a/recipes-devtools/go/files/bsd_svid_source.patch b/recipes-devtools/go/files/bsd_svid_source.patch deleted file mode 100644 index 21e1d4cb..00000000 --- a/recipes-devtools/go/files/bsd_svid_source.patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | golang-cross: do_compile fails cc1: all warnings being treated as errors | ||
| 2 | |||
| 3 | glibc 2.20 deprecates _BSD_SOURCE and _SVID_SOURCE and emits an error | ||
| 4 | message. From patch 16632: | ||
| 5 | libc [PATCH] BZ #16632: Disable _SVID_SOURCE/_BSD_SOURCE warning | ||
| 6 | if _DEFAULT_SOURCE is defined | ||
| 7 | |||
| 8 | Since we also need to support glibc before 2.20, from the release notes | ||
| 9 | for glibc 2.20, the recommended fix is to define _DEFAULT_SOURCE | ||
| 10 | |||
| 11 | (fixed upstream) | ||
| 12 | https://groups.google.com/forum/#!topic/golang-codereviews/S4TARFCxu2k | ||
| 13 | |||
| 14 | Signed-off-by: Amy Fong <amy.fong@windriver.com> | ||
| 15 | --- | ||
| 16 | include/u.h | 10 ++++++++++ | ||
| 17 | 1 file changed, 10 insertions(+) | ||
| 18 | |||
| 19 | --- a/include/u.h | ||
| 20 | +++ b/include/u.h | ||
| 21 | @@ -38,6 +38,16 @@ | ||
| 22 | # define __MAKECONTEXT_V2_SOURCE 1 | ||
| 23 | # endif | ||
| 24 | #endif | ||
| 25 | +/** | ||
| 26 | + * in glibc >= 2.20, _BSD_SOURCE and _SVID_SOURCE causes warning | ||
| 27 | + * messages if _DEFAULT_SOURCE is not defined. | ||
| 28 | + * | ||
| 29 | + * From glibc 2.20 release notes, since this application needs _BSD_SOURCE | ||
| 30 | + * and/or _SVID_SOURCE and we must support glibc < 2.19 and | ||
| 31 | + * glibc >= 2.20, then define all 3 (_DEFAULT_SOURCE, _BSD_SOURCE, | ||
| 32 | + * and _SVID_SOURCE) unconditionally | ||
| 33 | + */ | ||
| 34 | +#define _DEFAULT_SOURCE 1 | ||
| 35 | #define _BSD_SOURCE 1 | ||
| 36 | #define _NETBSD_SOURCE 1 /* NetBSD */ | ||
| 37 | #define _SVID_SOURCE 1 | ||
diff --git a/recipes-devtools/go/files/ccache.patch b/recipes-devtools/go/files/ccache.patch deleted file mode 100644 index b7a64bf7..00000000 --- a/recipes-devtools/go/files/ccache.patch +++ /dev/null | |||
| @@ -1,147 +0,0 @@ | |||
| 1 | golang doesn't work with ccache. In the current state, a lot of parsing | ||
| 2 | happens where it'll grab the first string in CC or LD and uses that for | ||
| 3 | its builds. When ccache is enabled, it results in trying to do builds | ||
| 4 | with just ccache. | ||
| 5 | |||
| 6 | The brokeness is seen when building with apps that uses cgo, like docker. | ||
| 7 | To enable ccache to work, some string comparisons and changes to parsing | ||
| 8 | had to be made. | ||
| 9 | |||
| 10 | Signed-off-by: Amy Fong <amy.fong@windriver.com> | ||
| 11 | |||
| 12 | Index: go/src/cmd/cgo/gcc.go | ||
| 13 | =================================================================== | ||
| 14 | --- go.orig/src/cmd/cgo/gcc.go 2014-06-18 17:26:26.000000000 -0700 | ||
| 15 | +++ go/src/cmd/cgo/gcc.go 2015-06-18 13:19:08.908877160 -0700 | ||
| 16 | @@ -712,6 +712,12 @@ | ||
| 17 | func (p *Package) gccBaseCmd() []string { | ||
| 18 | // Use $CC if set, since that's what the build uses. | ||
| 19 | if ret := strings.Fields(os.Getenv("CC")); len(ret) > 0 { | ||
| 20 | + if strings.Contains(ret[0], "ccache") { | ||
| 21 | + base_cc := ret[0] + " " + ret[1] | ||
| 22 | + os.Setenv("CCACHE_CC", ret[1]) | ||
| 23 | + ret[1] = base_cc | ||
| 24 | + return ret[1:] | ||
| 25 | + } | ||
| 26 | return ret | ||
| 27 | } | ||
| 28 | // Try $GCC if set, since that's what we used to use. | ||
| 29 | Index: go/src/pkg/os/exec/lp_unix.go | ||
| 30 | =================================================================== | ||
| 31 | --- go.orig/src/pkg/os/exec/lp_unix.go 2014-06-18 17:26:25.000000000 -0700 | ||
| 32 | +++ go/src/pkg/os/exec/lp_unix.go 2015-06-18 13:19:29.464876331 -0700 | ||
| 33 | @@ -35,8 +35,14 @@ | ||
| 34 | // (only bypass the path if file begins with / or ./ or ../) | ||
| 35 | // but that would not match all the Unix shells. | ||
| 36 | |||
| 37 | - if strings.Contains(file, "/") { | ||
| 38 | - err := findExecutable(file) | ||
| 39 | + tmp := file | ||
| 40 | + if strings.Contains(file, " ") { | ||
| 41 | + exec_part := strings.Split(file, " ")[0] | ||
| 42 | + tmp = exec_part | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + if strings.Contains(tmp, "/") { | ||
| 46 | + err := findExecutable(tmp) | ||
| 47 | if err == nil { | ||
| 48 | return file, nil | ||
| 49 | } | ||
| 50 | @@ -51,7 +57,7 @@ | ||
| 51 | // Unix shell semantics: path element "" means "." | ||
| 52 | dir = "." | ||
| 53 | } | ||
| 54 | - path := dir + "/" + file | ||
| 55 | + path := dir + "/" + tmp | ||
| 56 | if err := findExecutable(path); err == nil { | ||
| 57 | return path, nil | ||
| 58 | } | ||
| 59 | Index: go/src/cmd/go/build.go | ||
| 60 | =================================================================== | ||
| 61 | --- go.orig/src/cmd/go/build.go 2014-06-18 17:26:26.000000000 -0700 | ||
| 62 | +++ go/src/cmd/go/build.go 2015-06-18 13:20:08.724874749 -0700 | ||
| 63 | @@ -2005,8 +2005,15 @@ | ||
| 64 | // strings returned are "gcc", "-I", objdir (and cuts them off). | ||
| 65 | |||
| 66 | compiler := envList(envvar, defcmd) | ||
| 67 | - a := []string{compiler[0], "-I", objdir} | ||
| 68 | - a = append(a, compiler[1:]...) | ||
| 69 | + | ||
| 70 | + a := []string{compiler[0]} | ||
| 71 | + if strings.Contains(compiler[0], "ccache") { | ||
| 72 | + a = append(a, compiler[1], "-I", objdir) | ||
| 73 | + a = append(a, compiler[2:]...) | ||
| 74 | + } else { | ||
| 75 | + a = append(a, "-I", objdir) | ||
| 76 | + a = append(a, compiler[1:]...) | ||
| 77 | + } | ||
| 78 | |||
| 79 | // Definitely want -fPIC but on Windows gcc complains | ||
| 80 | // "-fPIC ignored for target (all code is position independent)" | ||
| 81 | Index: go/src/cmd/ld/lib.c | ||
| 82 | =================================================================== | ||
| 83 | --- go.orig/src/cmd/ld/lib.c 2014-06-18 17:26:27.000000000 -0700 | ||
| 84 | +++ go/src/cmd/ld/lib.c 2015-06-18 13:18:39.564878343 -0700 | ||
| 85 | @@ -552,7 +552,7 @@ | ||
| 86 | void | ||
| 87 | hostlink(void) | ||
| 88 | { | ||
| 89 | - char *p, **argv; | ||
| 90 | + char *p, *q, **argv; | ||
| 91 | int c, i, w, n, argc, len; | ||
| 92 | Hostobj *h; | ||
| 93 | Biobuf *f; | ||
| 94 | @@ -577,6 +577,19 @@ | ||
| 95 | if(extld == nil) | ||
| 96 | extld = "gcc"; | ||
| 97 | argv[argc++] = extld; | ||
| 98 | + | ||
| 99 | + p = extldflags; | ||
| 100 | + if (strstr(argv[0], "ccache") != NULL) { | ||
| 101 | + while(p != nil) { | ||
| 102 | + while(*p == ' ') | ||
| 103 | + *p++ = '\0'; | ||
| 104 | + if(*p == '\0') | ||
| 105 | + break; | ||
| 106 | + argv[argc++] = p; | ||
| 107 | + p = strchr(p + 1, ' '); | ||
| 108 | + break; | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | switch(thechar){ | ||
| 112 | case '8': | ||
| 113 | argv[argc++] = "-m32"; | ||
| 114 | @@ -629,12 +642,12 @@ | ||
| 115 | errorexit(); | ||
| 116 | } | ||
| 117 | Bseek(f, h->off, 0); | ||
| 118 | - p = smprint("%s/%06d.o", tmpdir, i); | ||
| 119 | - argv[argc++] = p; | ||
| 120 | - w = create(p, 1, 0775); | ||
| 121 | + q = smprint("%s/%06d.o", tmpdir, i); | ||
| 122 | + argv[argc++] = q; | ||
| 123 | + w = create(q, 1, 0775); | ||
| 124 | if(w < 0) { | ||
| 125 | ctxt->cursym = S; | ||
| 126 | - diag("cannot create %s: %r", p); | ||
| 127 | + diag("cannot create %s: %r", q); | ||
| 128 | errorexit(); | ||
| 129 | } | ||
| 130 | len = h->len; | ||
| 131 | @@ -646,7 +659,7 @@ | ||
| 132 | } | ||
| 133 | if(close(w) < 0) { | ||
| 134 | ctxt->cursym = S; | ||
| 135 | - diag("cannot write %s: %r", p); | ||
| 136 | + diag("cannot write %s: %r", q); | ||
| 137 | errorexit(); | ||
| 138 | } | ||
| 139 | Bterm(f); | ||
| 140 | @@ -656,7 +669,6 @@ | ||
| 141 | for(i=0; i<nldflag; i++) | ||
| 142 | argv[argc++] = ldflag[i]; | ||
| 143 | |||
| 144 | - p = extldflags; | ||
| 145 | while(p != nil) { | ||
| 146 | while(*p == ' ') | ||
| 147 | *p++ = '\0'; | ||
diff --git a/recipes-devtools/go/golang-1.3.inc b/recipes-devtools/go/golang-1.3.inc deleted file mode 100644 index 5c507b45..00000000 --- a/recipes-devtools/go/golang-1.3.inc +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | LICENSE = "BSD" | ||
| 2 | LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" | ||
| 3 | SRC_URI[md5sum] = "4b66d7249554181c314f139ea78920b1" | ||
| 4 | SRC_URI[sha256sum] = "eb983e6c5b2b9838f482c5442b1ac1856f610f2b21f3c123b3fedb48ffc35382" | ||
diff --git a/recipes-devtools/go/golang-cross.inc b/recipes-devtools/go/golang-cross.inc deleted file mode 100644 index be2c1ebc..00000000 --- a/recipes-devtools/go/golang-cross.inc +++ /dev/null | |||
| @@ -1,61 +0,0 @@ | |||
| 1 | DESCRIPTION = "Go Programming Language Cross Compiler." | ||
| 2 | HOMEPAGE = "golang.org" | ||
| 3 | # DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc" | ||
| 4 | DEPENDS = "libgcc" | ||
| 5 | PROVIDES = "virtual/${TARGET_PREFIX}golang" | ||
| 6 | SRC_URI = "\ | ||
| 7 | http://golang.org/dl/go${PV}.src.tar.gz \ | ||
| 8 | file://bsd_svid_source.patch \ | ||
| 9 | file://ccache.patch \ | ||
| 10 | " | ||
| 11 | |||
| 12 | S="${WORKDIR}/go" | ||
| 13 | |||
| 14 | do_compile () { | ||
| 15 | export CC_FOR_TARGET="${CC}" | ||
| 16 | export CXX_FOR_TARGET="${CXX}" | ||
| 17 | # the above should set the right sysroot option, else...: | ||
| 18 | # export CGO_CFLAGS="--sysroot=${STAGING_DIR_HOST}" | ||
| 19 | # export CGO_LDFLAGS="--sysroot=${STAGING_DIR_HOST}" | ||
| 20 | |||
| 21 | export CC="${BUILD_CC}" | ||
| 22 | export GOROOT_FINAL="${libdir}/go" | ||
| 23 | export GOARCH="${TARGET_ARCH}" | ||
| 24 | |||
| 25 | # supported amd64, 386, arm | ||
| 26 | if [ "${TARGET_ARCH}" = "x86_64" ]; then | ||
| 27 | export GOARCH="amd64" | ||
| 28 | fi | ||
| 29 | |||
| 30 | if [ "${TARGET_ARCH}" = "arm" ] | ||
| 31 | then | ||
| 32 | if [ `echo ${TUNE_PKGARCH} | cut -c 1-7` = "cortexa" ] | ||
| 33 | then | ||
| 34 | echo GOARM 7 | ||
| 35 | export GOARM="7" | ||
| 36 | fi | ||
| 37 | fi | ||
| 38 | export GOOS="linux" | ||
| 39 | export GO_GCFLAGS="" | ||
| 40 | export GO_LDFLAGS="" | ||
| 41 | export GO_CCFLAGS="" | ||
| 42 | export CGO_ENABLED="1" | ||
| 43 | #export CC_FOR_TARGET="${TARGET_SYS}-gcc" | ||
| 44 | #export CXX_FOR_TARGET="${TARGET_SYS}-g++" | ||
| 45 | echo GOARCH ${GOARCH} | ||
| 46 | echo CC_FOR_TARGET ${CC_FOR_TARGET} | ||
| 47 | |||
| 48 | cd src | ||
| 49 | sh -x ./make.bash | ||
| 50 | } | ||
| 51 | |||
| 52 | do_install () { | ||
| 53 | # Install the executables into build system | ||
| 54 | mkdir -p ${D}${bindir} | ||
| 55 | cp -a bin/go ${D}${bindir}/ | ||
| 56 | mkdir -p ${D}${libdir}/go | ||
| 57 | cp -a pkg ${D}${libdir}/go/ | ||
| 58 | cp -a include ${D}${libdir}/go/ | ||
| 59 | cp -a api ${D}${libdir}/go/ | ||
| 60 | cp -a src ${D}${libdir}/go/ | ||
| 61 | } | ||
diff --git a/recipes-devtools/go/golang-cross_1.3.bb b/recipes-devtools/go/golang-cross_1.3.bb deleted file mode 100644 index fcb0e7a2..00000000 --- a/recipes-devtools/go/golang-cross_1.3.bb +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | inherit cross | ||
| 2 | |||
| 3 | require golang-cross.inc | ||
| 4 | require golang-${PV}.inc | ||
