Skip to contentSkip to conversation

Revamp the Go support

PATCH Superseded Otavio Salvador 6 participants 24 messages Sep 12, 2017 – Sep 13, 2017

v8 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v8 cover Revamp the Go support

This improves the Go support on OE-Core.

We are trying to port as much as possible work done by Matt on meta-golang back to OE-Core and also to avoid carrying old releases as there is no need to support more versions of Go toolchain.

This fixes issues in existing support as well as add support for SDK generation which supports Go.

Changes in v8:
- new patch
- Fix patch header

Changes in v7:
- Fix Upstream-Status header typo
- Add patch header

Changes in v6:
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch

Matt Madison (12):
go-native: remove dependency on go-bootstrap-native
go-bootstrap-native: remove recipe
go: split out go-runtime into separate recipe go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGS go.bbclass: remove some xxx_FINAL variables go.bbclass: clean up CGO_xxx settings
go: rename go.inc -> go-target.inc
go-cross: take GOARM environment setting
go: enable nativesdk builds for the toolchain
go-crosssdk: add recipe
go.bbclass: enable nativesdk builds for Go packages
go-cross-canadian: add recipe

Otavio Salvador (1):
go-dep: Move bash dependency to -dev package

 meta/classes/go.bbclass                            |  54 +++--
 meta/recipes-devtools/go/go-1.4.inc                |  16 --
 ...alignment-for-the-.rel.plt-section-on-32-.patch |  33 ---
 .../go/go-1.4/016-armhf-elf-header.patch           |  24 ---
 ...ckport-cmd-link-support-new-386-amd64-rel.patch | 225 ---------------------
 meta/recipes-devtools/go/go-1.4/syslog.patch       |  62 ------
 meta/recipes-devtools/go/go-1.8.inc                |   6 +-
 .../go/go-1.8/make-goroot-precious.patch           |  21 ++
 .../go/go-1.8/set-gotooldir-during-bootstrap.patch |  22 ++
 .../recipes-devtools/go/go-bootstrap-native_1.4.bb |   3 -
 meta/recipes-devtools/go/go-common.inc             |   2 +-
 meta/recipes-devtools/go/go-cross-canadian.inc     |  64 ++++++
 meta/recipes-devtools/go/go-cross-canadian_1.8.bb  |   2 +
 meta/recipes-devtools/go/go-cross.inc              |  61 +++++-
 meta/recipes-devtools/go/go-cross_1.8.bb           |   5 +-
 meta/recipes-devtools/go/go-crosssdk.inc           |  55 +++++
 meta/recipes-devtools/go/go-crosssdk_1.8.bb        |   2 +
 meta/recipes-devtools/go/go-dep_0.3.0.bb           |   2 +-
 meta/recipes-devtools/go/go-native.inc             |  48 +++--
 meta/recipes-devtools/go/go-native_1.8.bb          |   1 -
 meta/recipes-devtools/go/go-runtime.inc            |  58 ++++++
 meta/recipes-devtools/go/go-runtime_1.8.bb         |   2 +
 meta/recipes-devtools/go/go-target.inc             |  54 +++++
 meta/recipes-devtools/go/go.inc                    |  81 --------
 meta/recipes-devtools/go/go_1.8.bb                 |   2 +-
 25 files changed, 394 insertions(+), 511 deletions(-)
 delete mode 100644 meta/recipes-devtools/go/go-1.4.inc
 delete mode 100644 meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.4/syslog.patch
 create mode 100644 meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch
 create mode 100644 meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch
 delete mode 100644 meta/recipes-devtools/go/go-bootstrap-native_1.4.bb
 create mode 100644 meta/recipes-devtools/go/go-cross-canadian.inc
 create mode 100644 meta/recipes-devtools/go/go-cross-canadian_1.8.bb
 create mode 100644 meta/recipes-devtools/go/go-crosssdk.inc
 create mode 100644 meta/recipes-devtools/go/go-crosssdk_1.8.bb
 create mode 100644 meta/recipes-devtools/go/go-runtime.inc
 create mode 100644 meta/recipes-devtools/go/go-runtime_1.8.bb
 create mode 100644 meta/recipes-devtools/go/go-target.inc
 delete mode 100644 meta/recipes-devtools/go/go.inc
Signature · 1 line
2.14.1
#1 lore raw

PATCH v8 1/13 go-native: remove dependency on go-bootstrap-native

From: Matt Madison <[email protected]>

The go1.4 toolchain is only required for bootstrapping go-native, and should not be used for anything else, so build it as part of the go-native build. This way, we don't have to carry around its built artifacts in the native sysroot.

The go-cross and target toolchains can then just depend on go-native, using that for their 'bootstrap' toolchain.

Also removed some unnecessary package-related noexec settings, since native recipes inherit nopackages.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/recipes-devtools/go/go-1.8.inc       |  4 +--
 meta/recipes-devtools/go/go-common.inc    |  2 +-
 meta/recipes-devtools/go/go-native.inc    | 48 +++++++++++++++++--------------
 meta/recipes-devtools/go/go-native_1.8.bb |  1 -
 meta/recipes-devtools/go/go.inc           |  4 +--
 5 files changed, 32 insertions(+), 27 deletions(-)
meta/recipes-devtools/go/go-1.8.inc +2 -2
index 3690f310bd..bfb26de01d 100644
@@ -15,5 +15,5 @@ SRC_URI += "\
        file://split-host-and-target-build.patch \
        file://gotooldir.patch \
 "
-SRC_URI[md5sum] = "64e9380e07bba907e26a00cf5fcbe77e"
-SRC_URI[sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6"
+SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e"
+SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6"
meta/recipes-devtools/go/go-common.inc +1 -1
index f74b8b7650..ce1eb86812 100644
@@ -14,7 +14,7 @@ LICENSE = "BSD-3-Clause"
 
 inherit goarch
 
-SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz"
+SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz;name=main"
 S = "${WORKDIR}/go"
 B = "${S}"
 
meta/recipes-devtools/go/go-native.inc +27 -21

81 lines not on this page · raw message

meta/recipes-devtools/go/go-native_1.8.bb +0 -1
index 182fca27a0..bbf3c0dd73 100644
@@ -1,3 +1,2 @@
 require ${PN}.inc
 require go-${PV}.inc
-DEPENDS += "go-bootstrap-native"
meta/recipes-devtools/go/go.inc +2 -2
index 52abbebd7e..9efbd275bd 100644
@@ -1,5 +1,5 @@
 inherit goarch
-DEPENDS += "go-bootstrap-native"
+DEPENDS += "go-native"
 
 # libgcc is required for the target specific libraries to build
 # properly, but apparently not for go-cross and, more importantly,
@@ -17,7 +17,7 @@ export GOHOSTARCH = "${BUILD_GOARCH}"
 export GOOS = "${TARGET_GOOS}"
 export GOARCH = "${TARGET_GOARCH}"
 export GOARM = "${TARGET_GOARM}"
-export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go1.4"
+export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
 export GOROOT_FINAL = "${libdir}/go"
 export CGO_ENABLED = "1"
 export CC_FOR_TARGET = "${CC}"
Signature · 1 line
2.14.1
#2 lore raw

PATCH v8 2/13 go-bootstrap-native: remove recipe

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

No longer needed, with go-native handling its own
bootstrap phase.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/recipes-devtools/go/go-1.4.inc                |  16 --
 ...alignment-for-the-.rel.plt-section-on-32-.patch |  33 ---
 .../go/go-1.4/016-armhf-elf-header.patch           |  24 ---
 ...ckport-cmd-link-support-new-386-amd64-rel.patch | 225 ---------------------
 meta/recipes-devtools/go/go-1.4/syslog.patch       |  62 ------
 .../recipes-devtools/go/go-bootstrap-native_1.4.bb |   3 -
 6 files changed, 363 deletions(-)
 delete mode 100644 meta/recipes-devtools/go/go-1.4.inc
 delete mode 100644 meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.4/syslog.patch
 delete mode 100644 meta/recipes-devtools/go/go-bootstrap-native_1.4.bb
meta/recipes-devtools/go/go-1.4.inc deleted +0 -16
deleted file mode 100644
index 2f500f32b9..0000000000
@@ -1,16 +0,0 @@
-require go-common.inc
-
-PV = "1.4.3"
-GO_BASEVERSION = "1.4"
-FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
-
-SRC_URI += "\
-        file://016-armhf-elf-header.patch \
-        file://go-cross-backport-cmd-link-support-new-386-amd64-rel.patch \
-        file://syslog.patch \
-        file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \
-"
-
-LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
-SRC_URI[md5sum] = "dfb604511115dd402a77a553a5923a04"
-SRC_URI[sha256sum] = "9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959"
meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch deleted +0 -33
deleted file mode 100644
index f2adc200b1..0000000000
@@ -1,33 +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]>
----
-Upstream-Status: Backport
-Signed-off-by: Khem Raj <[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
-
meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch deleted +0 -24
deleted file mode 100644
index e6e414e52f..0000000000
@@ -1,24 +0,0 @@
-Description: Use correct ELF header for armhf binaries.
-Author: Adam Conrad <[email protected]>
-Last-Update: 2013-07-08
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <[email protected]>
-
-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 */
meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch deleted +0 -225

225 lines not on this page · raw message

meta/recipes-devtools/go/go-1.4/syslog.patch deleted +0 -62

62 lines not on this page · raw message

meta/recipes-devtools/go/go-bootstrap-native_1.4.bb deleted +0 -3
deleted file mode 100644
index 3d4141e879..0000000000
@@ -1,3 +0,0 @@
-BOOTSTRAP = "1.4"
-require go-native.inc
-require go-${PV}.inc
Signature · 1 line
2.14.1
#3 lore raw

PATCH v8 3/13 go: split out go-runtime into separate recipe

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

Reorganize the Go toolchain build to split out the Go standard runtime libraries into a separate recipe. This simplifies the extension to crosssdk and cross-canadian builds.

* Adds a patch to the go build tool to prevent it from trying to rebuild anything in GOROOT, which is now resident in the target sysroot.

* 'go' bb and inc files are now for building the
compiler for the target only.

* 'go-cross' bb and inc files are now just for
the cross-compiler.

* Adds virtual/<prefix> PROVIDES for the compiler
and runtime

* Removes testdata directories from the sysroot
during staging, as they are unnecessary and
can cause strip errors (some of the test files
are ELF files).

* Re-enables pacakage QA checks, adding selective
INSANE_SKIP settings where needed.

---

Changes in v8: None
Changes in v7:
- Fix Upstream-Status header typo

Changes in v6:
- new patch

 meta/classes/go.bbclass                            | 22 +++----
 meta/recipes-devtools/go/go-1.8.inc                |  1 +
 .../go/go-1.8/make-goroot-precious.patch           | 21 +++++++
 meta/recipes-devtools/go/go-cross.inc              | 61 ++++++++++++++++---
 meta/recipes-devtools/go/go-cross_1.8.bb           |  5 +-
 meta/recipes-devtools/go/go-runtime.inc            | 58 ++++++++++++++++++
 meta/recipes-devtools/go/go-runtime_1.8.bb         |  2 +
 meta/recipes-devtools/go/go.inc                    | 68 ++++++----------------
 8 files changed, 167 insertions(+), 71 deletions(-)
 create mode 100644 meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch
 create mode 100644 meta/recipes-devtools/go/go-runtime.inc
 create mode 100644 meta/recipes-devtools/go/go-runtime_1.8.bb
meta/classes/go.bbclass +12 -10
index cb1e96d88b..b3464d2105 100644
@@ -20,11 +20,11 @@ def get_go_parallel_make(d):
 GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"
 
 GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
-GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
+GOROOT = "${STAGING_LIBDIR}/go"
 GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin"
 GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}"
 
-DEPENDS_GOLANG_class-target = "go-cross-${TARGET_ARCH}"
+DEPENDS_GOLANG_class-target = "virtual/${TARGET_PREFIX}go virtual/${TARGET_PREFIX}go-runtime"
 DEPENDS_GOLANG_class-native = "go-native"
 
 DEPENDS_append = " ${DEPENDS_GOLANG}"
@@ -32,14 +32,15 @@ DEPENDS_append = " ${DEPENDS_GOLANG}"
 export GOBUILDFLAGS ?= "-v"
 GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} "
 
-export GOOS = "${TARGET_GOOS}"
-export GOARCH = "${TARGET_GOARCH}"
-export GOARM = "${TARGET_GOARM}"
+export GO = "${HOST_PREFIX}go"
+GOTOOLDIR = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
+GOTOOLDIR_class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}"
+export GOTOOLDIR
 export CGO_ENABLED = "1"
 export GOROOT
-export GOROOT_FINAL = "${libdir}/${TARGET_SYS}/go"
+export GOROOT_FINAL = "${libdir}/go"
 export GOBIN_FINAL
-export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${GOOS}_${GOARCH}"
+export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${TARGET_GOTUPLE}"
 export GOSRC_FINAL = "${GOROOT_FINAL}/src"
 export GO_GCFLAGS = "${TARGET_CFLAGS}"
 export GO_LDFLAGS = "${TARGET_LDFLAGS}"
@@ -55,6 +56,7 @@ GO_INSTALL ?= "${GO_IMPORT}/..."
 GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
+export GOPATH = "${B}"
 
 python go_do_unpack() {
     src_uri = (d.getVar('SRC_URI') or "").split()
@@ -75,7 +77,7 @@ python go_do_unpack() {
 }
 
 go_list_packages() {
-	GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
+	${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
 		egrep -v '${GO_INSTALL_FILTEROUT}'
 }
 
@@ -84,9 +86,9 @@ go_do_configure() {
 }
 
 go_do_compile() {
-	GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
+	${GO} env
 	if [ -n "${GO_INSTALL}" ]; then
-		GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} `go_list_packages`
+		${GO} install ${GOBUILDFLAGS} `go_list_packages`
 	fi
 }
 do_compile[cleandirs] = "${B}/bin ${B}/pkg"
meta/recipes-devtools/go/go-1.8.inc +1 -0
index bfb26de01d..2920d06f60 100644
@@ -14,6 +14,7 @@ SRC_URI += "\
        file://fix-cc-handling.patch \
        file://split-host-and-target-build.patch \
        file://gotooldir.patch \
+       file://make-goroot-precious.patch \
 "
 SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e"
 SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6"
meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch new file +21 -0
new file mode 100644
index 0000000000..28a7a34773
@@ -0,0 +1,21 @@
+Prevent GOROOT-resident packages from being rebuilt
+
+Signed-off-by: Matt Madison <[email protected]>
+Upstream-Status: Pending
+
+--- go.orig/src/cmd/go/pkg.go
++++ go/src/cmd/go/pkg.go
+@@ -1496,6 +1496,13 @@ func isStale(p *Package) (bool, string)
+ 		return true, "build ID mismatch"
+ 	}
+ 
++	// For OE builds, make anything in GOROOT non-stale,
++	// to prevent a package build from overwriting the
++	// build root.
++	if p.Goroot && os.Getenv("GOROOT_OVERRIDE") != "1" {
++		return false, "GOROOT-resident packages do not get rebuilt"
++	}
++
+ 	// Package is stale if a dependency is.
+ 	for _, p1 := range p.deps {
+ 		if p1.Stale {
meta/recipes-devtools/go/go-cross.inc +53 -8

68 lines not on this page · raw message

meta/recipes-devtools/go/go-cross_1.8.bb +1 -4
index 56ee084b10..80b5a03f6c 100644
@@ -1,5 +1,2 @@
 require go-cross.inc
-require go_${PV}.bb
-
-# Go binaries are not understood by the strip tool.
-INHIBIT_SYSROOT_STRIP = "1"
+require go-${PV}.inc
meta/recipes-devtools/go/go-runtime.inc new file +58 -0

58 lines not on this page · raw message

meta/recipes-devtools/go/go-runtime_1.8.bb new file +2 -0
new file mode 100644
index 0000000000..43b68b4e46
@@ -0,0 +1,2 @@
+require go-${PV}.inc
+require go-runtime.inc
meta/recipes-devtools/go/go.inc +19 -49

91 lines not on this page · raw message

Signature · 1 line
2.14.1
#4 lore raw

PATCH v8 4/13 go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGS

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

These variables are not used anywhere.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/classes/go.bbclass | 2 --
 1 file changed, 2 deletions(-)
meta/classes/go.bbclass +0 -2
index b3464d2105..0ff82ca2bb 100644
@@ -42,8 +42,6 @@ export GOROOT_FINAL = "${libdir}/go"
 export GOBIN_FINAL
 export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${TARGET_GOTUPLE}"
 export GOSRC_FINAL = "${GOROOT_FINAL}/src"
-export GO_GCFLAGS = "${TARGET_CFLAGS}"
-export GO_LDFLAGS = "${TARGET_LDFLAGS}"
 export CGO_CFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CFLAGS}"
 export CGO_CPPFLAGS = "${TARGET_CPPFLAGS}"
 export CGO_CXXFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CXXFLAGS}"
Signature · 1 line
2.14.1
#5 lore raw

PATCH v8 5/13 go.bbclass: remove some xxx_FINAL variables

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

GOROOT_FINAL is used by the Go linker for rewriting source paths when the build GOROOT is not the same as the runtime GOROOT, but the other _FINAL variables aren't really needed.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/classes/go.bbclass | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
meta/classes/go.bbclass +7 -12
index 0ff82ca2bb..c0b117d155 100644
@@ -21,8 +21,7 @@ GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"
 
 GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
 GOROOT = "${STAGING_LIBDIR}/go"
-GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin"
-GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}"
+export GOROOT_FINAL = "${libdir}/go"
 
 DEPENDS_GOLANG_class-target = "virtual/${TARGET_PREFIX}go virtual/${TARGET_PREFIX}go-runtime"
 DEPENDS_GOLANG_class-native = "go-native"
@@ -38,18 +37,11 @@ GOTOOLDIR_class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}"
 export GOTOOLDIR
 export CGO_ENABLED = "1"
 export GOROOT
-export GOROOT_FINAL = "${libdir}/go"
-export GOBIN_FINAL
-export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${TARGET_GOTUPLE}"
-export GOSRC_FINAL = "${GOROOT_FINAL}/src"
 export CGO_CFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CFLAGS}"
 export CGO_CPPFLAGS = "${TARGET_CPPFLAGS}"
 export CGO_CXXFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CXXFLAGS}"
 export CGO_LDFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_LDFLAGS}"
 
-FILES_${PN}-staticdev += "${GOSRC_FINAL}/${GO_IMPORT}"
-FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*"
-
 GO_INSTALL ?= "${GO_IMPORT}/..."
 GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
@@ -92,10 +84,10 @@ go_do_compile() {
 do_compile[cleandirs] = "${B}/bin ${B}/pkg"
 
 go_do_install() {
-	install -d ${D}${GOROOT_FINAL}/src/${GO_IMPORT}
+	install -d ${D}${libdir}/go/src/${GO_IMPORT}
 	tar -C ${S}/src/${GO_IMPORT} -cf - --exclude-vcs . | \
-		tar -C ${D}${GOROOT_FINAL}/src/${GO_IMPORT} --no-same-owner -xf -
-	tar -C ${B} -cf - pkg | tar -C ${D}${GOROOT_FINAL} --no-same-owner -xf -
+		tar -C ${D}${libdir}/go/src/${GO_IMPORT} --no-same-owner -xf -
+	tar -C ${B} -cf - pkg | tar -C ${D}${libdir}/go --no-same-owner -xf -
 
 	if [ -n "`ls ${B}/${GO_BUILD_BINDIR}/`" ]; then
 		install -d ${D}${bindir}
@@ -104,3 +96,6 @@ go_do_install() {
 }
 
 EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install
+
+FILES_${PN}-dev = "${libdir}/go/src"
+FILES_${PN}-staticdev = "${libdir}/go/pkg"
Signature · 1 line
2.14.1
#6 lore raw

PATCH v8 6/13 go-dep: Move bash dependency to -dev package

In reply to Otavio Salvador

The src content has been moved to -dev package, so does the test routines. Fix the runtime dependency accordingly.

---

Changes in v8:
- new patch

Changes in v7: None
Changes in v6: None

 meta/recipes-devtools/go/go-dep_0.3.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/go/go-dep_0.3.0.bb +1 -1
index c65b4f7cb5..5e4544a104 100644
@@ -15,4 +15,4 @@ GO_INSTALL = "${GO_IMPORT}/cmd/dep"
 
 INSANE_SKIP_${PN} += "ldflags"
 
-RDEPENDS_${PN}-staticdev += "bash"
+RDEPENDS_${PN}-dev += "bash"
Signature · 1 line
2.14.1
#7 lore raw

Re: [PATCH v8 06/13] go-dep: Move bash dependency to -dev package

Doesn't this belong into:
[OE-core] [PATCH v8 03/13] go: split out go-runtime into separate recipe where it packaging change was probably introduced?

Also just RFC question, would it make sense to use:

VIRTUAL-RUNTIME_bash ?= "bash"
RDEPENDS_${PN}-dev += "${VIRTUAL-RUNTIME_bash}"

instead of the bash dependency directly? If it's acceptable for oe-core I'll create change to do it for all recipe (I don't mind waiting after 2.4 is released).

Because right now for reasons described in
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9217 I need to do the above +
RDEPENDS_${PN}-dev_remove = "bash"
for many recipes with many bbappends, for our distro where we RPROVIDE bash by busybox, which is good enough for package manager, but QA error is still shown in cases where the real bash is built before the component rdpenending on it.

Regards,

Quoted 35 lines · Otavio Salvador

The src content has been moved to -dev package, so does the test routines. Fix the runtime dependency accordingly.

---

Changes in v8:
- new patch

Changes in v7: None
Changes in v6: None

 meta/recipes-devtools/go/go-dep_0.3.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/go/go-dep_0.3.0.bb +1 -2
index c65b4f7cb5..5e4544a104 100644
@@ -15,4 +15,4 @@ GO_INSTALL = "${GO_IMPORT}/cmd/dep"
 
 INSANE_SKIP_${PN} += "ldflags"
 
-RDEPENDS_${PN}-staticdev += "bash"
+RDEPENDS_${PN}-dev += "bash"
--

2.14.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#8 lore raw

Re: [PATCH v8 06/13] go-dep: Move bash dependency to -dev package

Quoted 3 lines · Martin Jansa

Doesn't this belong into:
[OE-core] [PATCH v8 03/13] go: split out go-runtime into separate recipe where it packaging change was probably introduced?

I can squash it; in fact the change was introduced on "[v8,05/13] go.bbclass: remove some xxx_FINAL variables". Not sure if it is better or worse in this case. What do you think?

Quoted 9 lines

Also just RFC question, would it make sense to use:

VIRTUAL-RUNTIME_bash ?= "bash"
RDEPENDS_${PN}-dev += "${VIRTUAL-RUNTIME_bash}"

instead of the bash dependency directly? If it's acceptable for oe-core I'll create change to do it for all recipe (I don't mind waiting after 2.4 is released).

Quoted 8 lines

Because right now for reasons described in
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9217 I need to do the above +
RDEPENDS_${PN}-dev_remove = "bash"
for many recipes with many bbappends, for our distro where we RPROVIDE bash by busybox, which is good enough for package manager, but QA error is still shown in cases where the real bash is built before the component rdpenending on it.

I'd be fine with this. It does make sense to allow the replacement of bash.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#9 lore raw

Re: [PATCH v8 06/13] go-dep: Move bash dependency to -dev package

Seems like this version was already picked to master-next, so probably better to leave as standalone change now.

The version currently in master fails to build for arm with thumb enabled:
http://errors.yoctoproject.org/Errors/Details/155765/

Is it fixed somewhere in this new patchset?

# github.com/golang/dep/cmd/dep
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/recipe-sysroot-native/usr/lib/arm-oe-linux-gnueabi/go/pkg/tool/linux_amd64/link:
R_ARM_THM_CALL, are you using -marm?
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/temp/log.do_compile.13531)
Quoted 39 lines · Otavio Salvador
Quoted 3 lines · Martin Jansa

Doesn't this belong into:
[OE-core] [PATCH v8 03/13] go: split out go-runtime into separate recipe where it packaging change was probably introduced?

I can squash it; in fact the change was introduced on "[v8,05/13] go.bbclass: remove some xxx_FINAL variables". Not sure if it is better or worse in this case. What do you think?

Quoted 6 lines

Also just RFC question, would it make sense to use:

VIRTUAL-RUNTIME_bash ?= "bash"
RDEPENDS_${PN}-dev += "${VIRTUAL-RUNTIME_bash}"

instead of the bash dependency directly? If it's acceptable for oe-core

I'll

Quoted 8 lines

create change to do it for all recipe (I don't mind waiting after 2.4 is released).

Because right now for reasons described in
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9217 I need to do the above +
RDEPENDS_${PN}-dev_remove = "bash"
for many recipes with many bbappends, for our distro where we RPROVIDE

bash

Quoted 1 line

by busybox, which is good enough for package manager, but QA error is

still

Quoted 1 line

shown in cases where the real bash is built before the component

rdpenending

Quoted 1 line

on it.

I'd be fine with this. It does make sense to allow the replacement of bash.

--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750

#10 lore raw

Re: [PATCH v8 06/13] go-dep: Move bash dependency to -dev package

Quoted 6 lines · Martin Jansa

Seems like this version was already picked to master-next, so probably better to leave as standalone change now.

The version currently in master fails to build for arm with thumb enabled:
http://errors.yoctoproject.org/Errors/Details/155765/

Quoted 8 lines

Is it fixed somewhere in this new patchset?

# github.com/golang/dep/cmd/dep
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/recipe-sysroot-native/usr/lib/arm-oe-linux-gnueabi/go/pkg/tool/linux_amd64/link:
R_ARM_THM_CALL, are you using -marm?
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/temp/log.do_compile.13531)

No, it is not.

It seems that Go, when using CGO, does not play nice with Thumb. Matt, do you know if there is a known fix for it?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#11 lore raw

Re: [PATCH v8 06/13] go-dep: Move bash dependency to -dev package

Quoted 16 lines · Otavio Salvador
Quoted 6 lines · Martin Jansa

Seems like this version was already picked to master-next, so probably better to leave as standalone change now.

The version currently in master fails to build for arm with thumb enabled:
http://errors.yoctoproject.org/Errors/Details/155765/

Quoted 8 lines

Is it fixed somewhere in this new patchset?

# github.com/golang/dep/cmd/dep
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/recipe-sysroot-native/usr/lib/arm-oe-linux-gnueabi/go/pkg/tool/linux_amd64/link:
R_ARM_THM_CALL, are you using -marm?
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/temp/log.do_compile.13531)
Quoted 4 lines

No, it is not.

It seems that Go, when using CGO, does not play nice with Thumb. Matt, do you know if there is a known fix for it?

Disable CGO for thumb, we have a variable to select cgo

#12 lore raw

Re: [PATCH v8 06/13] go-dep: Move bash dependency to -dev package

Quoted 18 lines · Khem Raj
Quoted 16 lines · Otavio Salvador
Quoted 14 lines · Martin Jansa

Seems like this version was already picked to master-next, so probably better to leave as standalone change now.

The version currently in master fails to build for arm with thumb enabled:
http://errors.yoctoproject.org/Errors/Details/155765/

Is it fixed somewhere in this new patchset?

# github.com/golang/dep/cmd/dep
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/recipe-sysroot-native/usr/lib/arm-oe-linux-gnueabi/go/pkg/tool/linux_amd64/link:
R_ARM_THM_CALL, are you using -marm?
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/temp/log.do_compile.13531)
Quoted 6 lines
Quoted 4 lines

No, it is not.

It seems that Go, when using CGO, does not play nice with Thumb. Matt, do you know if there is a known fix for it?

Disable CGO for thumb, we have a variable to select cgo

Yeah, I don't think Go handles Thumb at all. Maybe we should set ARM_INSTRUCTION_SET to "arm" in goarch.bbclass?

-Matt

#13 lore raw

Re: [PATCH v8 06/13] go-dep: Move bash dependency to -dev package

Quoted 21 lines · Matt Madison
Quoted 20 lines · Khem Raj
Quoted 18 lines · Otavio Salvador
Quoted 6 lines · Martin Jansa

Seems like this version was already picked to master-next, so probably better to leave as standalone change now.

The version currently in master fails to build for arm with thumb enabled:
http://errors.yoctoproject.org/Errors/Details/155765/

Quoted 8 lines

Is it fixed somewhere in this new patchset?

# github.com/golang/dep/cmd/dep
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/recipe-sysroot-native/usr/lib/arm-oe-linux-gnueabi/go/pkg/tool/linux_amd64/link:
R_ARM_THM_CALL, are you using -marm?
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at
TOPDIR/tmp-glibc/work/armv5te-oe-linux-gnueabi/go-dep/0.3.0-r0/temp/log.do_compile.13531)

No, it is not.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It seems that Go, when using CGO, does not play nice with Thumb. Matt, do you know if there is a known fix for it?

Disable CGO for thumb, we have a variable to select cgo

Yeah, I don't think Go handles Thumb at all. Maybe we should set ARM_INSTRUCTION_SET to "arm" in goarch.bbclass?

I think we have a problem with dependencies. It is possibly a solution but not sure it will work.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#14 lore raw

PATCH v8 7/13 go.bbclass: clean up CGO_xxx settings

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

* use conditional assignment for the CGO_xxx variables, so they can be overridden more easily
* remove the TOOLCHAIN_OPTIONS and TARGET_CC_ARCH references, since those are already present in CC and CXX
* remove the TARGET_ prefix so the values are appropriate for native, nativesdk, etc. builds
* move the GOROOT export away from the CGO settings and closer to its definition

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/classes/go.bbclass | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
meta/classes/go.bbclass +7 -6
index c0b117d155..8fb41e5c09 100644
@@ -21,6 +21,7 @@ GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"
 
 GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
 GOROOT = "${STAGING_LIBDIR}/go"
+export GOROOT
 export GOROOT_FINAL = "${libdir}/go"
 
 DEPENDS_GOLANG_class-target = "virtual/${TARGET_PREFIX}go virtual/${TARGET_PREFIX}go-runtime"
@@ -35,12 +36,12 @@ export GO = "${HOST_PREFIX}go"
 GOTOOLDIR = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
 GOTOOLDIR_class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}"
 export GOTOOLDIR
-export CGO_ENABLED = "1"
-export GOROOT
-export CGO_CFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CFLAGS}"
-export CGO_CPPFLAGS = "${TARGET_CPPFLAGS}"
-export CGO_CXXFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CXXFLAGS}"
-export CGO_LDFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_LDFLAGS}"
+
+export CGO_ENABLED ?= "1"
+export CGO_CFLAGS ?= "${CFLAGS}"
+export CGO_CPPFLAGS ?= "${CPPFLAGS}"
+export CGO_CXXFLAGS ?= "${CXXFLAGS}"
+export CGO_LDFLAGS ?= "${LDFLAGS}"
 
 GO_INSTALL ?= "${GO_IMPORT}/..."
 GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
Signature · 1 line
2.14.1
#15 lore raw

PATCH v8 8/13 go: rename go.inc -> go-target.inc

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

to make it clearer that it is only used for building the toolchain for the target.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/recipes-devtools/go/{go.inc => go-target.inc} | 0
 meta/recipes-devtools/go/go_1.8.bb                 | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename meta/recipes-devtools/go/{go.inc => go-target.inc} (100%)
meta/recipes-devtools/go/go-target.inc renamed from meta/recipes-devtools/go/go.inc +0 -0
similarity index 100%
rename from meta/recipes-devtools/go/go.inc
rename to meta/recipes-devtools/go/go-target.inc
meta/recipes-devtools/go/go_1.8.bb +1 -1
index ef8bc14383..08ab793f86 100644
@@ -1,4 +1,4 @@
 require go-${PV}.inc
-require go.inc
+require go-target.inc
 TUNE_CCARGS_remove = "-march=mips32r2"
 SECURITY_PIE_CFLAGS_remove = "-fPIE -pie"
Signature · 1 line
2.14.1
#16 lore raw

PATCH v8 9/13 go-cross: take GOARM environment setting

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

Instead of hard-coding GOARM to ${TARGET_GOARM} in the wrapper script, take it from an existing environment setting if present. This allows the same cross-compiler to be used for different ARM targets.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/recipes-devtools/go/go-cross.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/go/go-cross.inc +1 -1
index df3e4ea914..d18d9613ff 100644
@@ -36,7 +36,7 @@ make_wrapper() {
 here=\`dirname \$0\`
 export GOARCH="${TARGET_GOARCH}"
 export GOOS="${TARGET_GOOS}"
-export GOARM="${TARGET_GOARM}"
+export GOARM="\${GOARM:-${TARGET_GOARM}}"
 \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
 END
     chmod +x ${D}${bindir}/$2
Signature · 1 line
2.14.1
#17 lore raw

PATCH v8 10/13 go: enable nativesdk builds for the toolchain

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

All that's needed is setting BBCLASSEXTEND.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/recipes-devtools/go/go-target.inc | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-devtools/go/go-target.inc +3 -0
index 5984a60c28..0d80bf0d97 100644
@@ -1,5 +1,6 @@
 inherit goarch
 DEPENDS = "virtual/${TARGET_PREFIX}go go-native"
+DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
 
 export GOHOSTOS = "${BUILD_GOOS}"
 export GOHOSTARCH = "${BUILD_GOARCH}"
@@ -49,3 +50,5 @@ FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir
 FILES_${PN}-dev = "${libdir}/go"
 RDEPENDS_${PN}-dev = "perl bash"
 INSANE_SKIP_${PN} = "ldflags"
+
+BBCLASSEXTEND = "nativesdk"
Signature · 1 line
2.14.1
#18 lore raw

PATCH v8 11/13 go-crosssdk: add recipe

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

Enable crosssdk builds for the Go toolchain.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/recipes-devtools/go/go-crosssdk.inc    | 55 +++++++++++++++++++++++++++++
 meta/recipes-devtools/go/go-crosssdk_1.8.bb |  2 ++
 2 files changed, 57 insertions(+)
 create mode 100644 meta/recipes-devtools/go/go-crosssdk.inc
 create mode 100644 meta/recipes-devtools/go/go-crosssdk_1.8.bb
meta/recipes-devtools/go/go-crosssdk.inc new file +55 -0
new file mode 100644
index 0000000000..e9bc677131
@@ -0,0 +1,55 @@
+inherit crosssdk
+
+DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
+PN = "go-crosssdk-${TARGET_ARCH}"
+PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk"
+
+export GOHOSTOS = "${BUILD_GOOS}"
+export GOHOSTARCH = "${BUILD_GOARCH}"
+export GOOS = "${TARGET_GOOS}"
+export GOARCH = "${TARGET_GOARCH}"
+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
+	cd ${B}
+}
+
+make_wrapper() {
+    rm -f ${D}${bindir}/$2
+    cat <<END >${D}${bindir}/$2
+#!/bin/bash
+here=\`dirname \$0\`
+export GOARCH="${TARGET_GOARCH}"
+export GOOS="${TARGET_GOOS}"
+\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
+END
+    chmod +x ${D}${bindir}/$2
+}
+
+do_install() {
+	install -d ${D}${libdir}/go
+	install -d ${D}${libdir}/go/bin
+	install -d ${D}${libdir}/go/pkg/tool
+	install -d ${D}${bindir}
+	cp --preserve=mode,timestamps -R ${S}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
+	for f in ${B}/${GO_BUILD_BINDIR}/*
+	do
+		base=`basename $f`
+		install -m755 $f ${D}${libdir}/go/bin
+		make_wrapper $base ${TARGET_PREFIX}$base
+	done
+}
+
+FILES_${PN}-staticdev = "${libdir}/go/pkg"
meta/recipes-devtools/go/go-crosssdk_1.8.bb new file +2 -0
new file mode 100644
index 0000000000..1857c8a577
@@ -0,0 +1,2 @@
+require go-crosssdk.inc
+require go-${PV}.inc
Signature · 1 line
2.14.1
#19 lore raw

PATCH v8 12/13 go.bbclass: enable nativesdk builds for Go packages

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

Adding the necessary overrides for nativesdk builds.

---

Changes in v8: None
Changes in v7: None
Changes in v6:
- new patch

 meta/classes/go.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/go.bbclass +2 -0
index 8fb41e5c09..8d363e86a2 100644
@@ -20,12 +20,14 @@ def get_go_parallel_make(d):
 GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"
 
 GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
+GOROOT_class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go"
 GOROOT = "${STAGING_LIBDIR}/go"
 export GOROOT
 export GOROOT_FINAL = "${libdir}/go"
 
 DEPENDS_GOLANG_class-target = "virtual/${TARGET_PREFIX}go virtual/${TARGET_PREFIX}go-runtime"
 DEPENDS_GOLANG_class-native = "go-native"
+DEPENDS_GOLANG_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime"
 
 DEPENDS_append = " ${DEPENDS_GOLANG}"
 
Signature · 1 line
2.14.1
#20 lore raw

PATCH v8 13/13 go-cross-canadian: add recipe

In reply to Otavio Salvador

From: Matt Madison <[email protected]>

Enable cross-canadian builds of the Go toolchain. This requires an additional patch to the Go source to allow us to use the native GOTOOLDIR during the bootstrap phase.

---

Changes in v8:
- Fix patch header

Changes in v7:
- Add patch header

Changes in v6:
- new patch

 meta/recipes-devtools/go/go-1.8.inc                |  1 +
 .../go/go-1.8/set-gotooldir-during-bootstrap.patch | 22 ++++++++
 meta/recipes-devtools/go/go-cross-canadian.inc     | 64 ++++++++++++++++++++++
 meta/recipes-devtools/go/go-cross-canadian_1.8.bb  |  2 +
 4 files changed, 89 insertions(+)
 create mode 100644 meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch
 create mode 100644 meta/recipes-devtools/go/go-cross-canadian.inc
 create mode 100644 meta/recipes-devtools/go/go-cross-canadian_1.8.bb
meta/recipes-devtools/go/go-1.8.inc +1 -0
index 2920d06f60..141c0994c3 100644
@@ -15,6 +15,7 @@ SRC_URI += "\
        file://split-host-and-target-build.patch \
        file://gotooldir.patch \
        file://make-goroot-precious.patch \
+       file://set-gotooldir-during-bootstrap.patch \
 "
 SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e"
 SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6"
meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch new file +22 -0
new file mode 100644
index 0000000000..4b5e424d96
@@ -0,0 +1,22 @@
+Set GOTOOLDIR during bootstrap 
+
+Signed-off-by: Matt Madison <[email protected]>
+Upstream-Status: Pending
+
+Index: go/src/make.bash
+===================================================================
+--- go.orig/src/make.bash
++++ go/src/make.bash
+@@ -172,10 +172,11 @@ if [ "$do_host_build" = "yes" ]; then
+ 	mv cmd/dist/dist "$GOTOOLDIR"/dist
+ 	echo
+ 
++	GOTOOLDIR_BOOTSTRAP="${GOTOOLDIR_BOOTSTRAP:-$GOTOOLDIR}"
+ 	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.
+-	CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
++	CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH GOTOOLDIR="$GOTOOLDIR_BOOTSTRAP" \
+ 		"$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+ 	echo
+ fi
meta/recipes-devtools/go/go-cross-canadian.inc new file +64 -0

64 lines not on this page · raw message

meta/recipes-devtools/go/go-cross-canadian_1.8.bb new file +2 -0
new file mode 100644
index 0000000000..7ac9449e47
@@ -0,0 +1,2 @@
+require go-cross-canadian.inc
+require go-${PV}.inc
Signature · 1 line
2.14.1
#21 lore raw
In reply to Otavio Salvador
Quoted 9 lines · Otavio Salvador

This improves the Go support on OE-Core.

We are trying to port as much as possible work done by Matt on meta-golang back to OE-Core and also to avoid carrying old releases as there is no need to support more versions of Go toolchain.

This fixes issues in existing support as well as add support for SDK generation which supports Go.

Testing against what has merged, and what are in these series is showing that large
parts of the go applications that are used in meta-virt no longer work. Was it the
intention of the re-work to not be compatible with existing users of the language support ?

Just curious, since I haven't seen this flagged in this context (compatibility), but now we
have to fixup the layers before I branch to match the release .. and that was unexpected.

Bruce

Quoted 98 lines

Changes in v8:
- new patch
- Fix patch header

Changes in v7:
- Fix Upstream-Status header typo
- Add patch header

Changes in v6:
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch
- new patch

Matt Madison (12):
go-native: remove dependency on go-bootstrap-native
go-bootstrap-native: remove recipe
go: split out go-runtime into separate recipe go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGS go.bbclass: remove some xxx_FINAL variables go.bbclass: clean up CGO_xxx settings
go: rename go.inc -> go-target.inc
go-cross: take GOARM environment setting
go: enable nativesdk builds for the toolchain
go-crosssdk: add recipe
go.bbclass: enable nativesdk builds for Go packages
go-cross-canadian: add recipe

Otavio Salvador (1):
go-dep: Move bash dependency to -dev package

 meta/classes/go.bbclass                            |  54 +++--
 meta/recipes-devtools/go/go-1.4.inc                |  16 --
 ...alignment-for-the-.rel.plt-section-on-32-.patch |  33 ---
 .../go/go-1.4/016-armhf-elf-header.patch           |  24 ---
 ...ckport-cmd-link-support-new-386-amd64-rel.patch | 225
---------------------
 meta/recipes-devtools/go/go-1.4/syslog.patch       |  62 ------
 meta/recipes-devtools/go/go-1.8.inc                |   6 +-
 .../go/go-1.8/make-goroot-precious.patch           |  21 ++
 .../go/go-1.8/set-gotooldir-during-bootstrap.patch |  22 ++
 .../recipes-devtools/go/go-bootstrap-native_1.4.bb |   3 -
 meta/recipes-devtools/go/go-common.inc             |   2 +-
 meta/recipes-devtools/go/go-cross-canadian.inc     |  64 ++++++
 meta/recipes-devtools/go/go-cross-canadian_1.8.bb  |   2 +
 meta/recipes-devtools/go/go-cross.inc              |  61 +++++-
 meta/recipes-devtools/go/go-cross_1.8.bb           |   5 +-
 meta/recipes-devtools/go/go-crosssdk.inc           |  55 +++++
 meta/recipes-devtools/go/go-crosssdk_1.8.bb        |   2 +
 meta/recipes-devtools/go/go-dep_0.3.0.bb           |   2 +-
 meta/recipes-devtools/go/go-native.inc             |  48 +++--
 meta/recipes-devtools/go/go-native_1.8.bb          |   1 -
 meta/recipes-devtools/go/go-runtime.inc            |  58 ++++++
 meta/recipes-devtools/go/go-runtime_1.8.bb         |   2 +
 meta/recipes-devtools/go/go-target.inc             |  54 +++++
 meta/recipes-devtools/go/go.inc                    |  81 --------
 meta/recipes-devtools/go/go_1.8.bb                 |   2 +-
 25 files changed, 394 insertions(+), 511 deletions(-)
 delete mode 100644 meta/recipes-devtools/go/go-1.4.inc
 delete mode 100644 meta/recipes-devtools/go/go-1.
4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.
4/016-armhf-elf-header.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.
4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.4/syslog.patch
 create mode 100644 meta/recipes-devtools/go/go-1.
8/make-goroot-precious.patch
 create mode 100644 meta/recipes-devtools/go/go-1.8/set-gotooldir-during-
bootstrap.patch
 delete mode 100644 meta/recipes-devtools/go/go-bootstrap-native_1.4.bb
 create mode 100644 meta/recipes-devtools/go/go-cross-canadian.inc
 create mode 100644 meta/recipes-devtools/go/go-cross-canadian_1.8.bb
 create mode 100644 meta/recipes-devtools/go/go-crosssdk.inc
 create mode 100644 meta/recipes-devtools/go/go-crosssdk_1.8.bb
 create mode 100644 meta/recipes-devtools/go/go-runtime.inc
 create mode 100644 meta/recipes-devtools/go/go-runtime_1.8.bb
 create mode 100644 meta/recipes-devtools/go/go-target.inc
 delete mode 100644 meta/recipes-devtools/go/go.inc

--
2.14.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"
#22 lore raw
Quoted 20 lines · Bruce Ashfield
Quoted 9 lines · Otavio Salvador

This improves the Go support on OE-Core.

We are trying to port as much as possible work done by Matt on meta-golang back to OE-Core and also to avoid carrying old releases as there is no need to support more versions of Go toolchain.

This fixes issues in existing support as well as add support for SDK generation which supports Go.

Testing against what has merged, and what are in these series is showing that large
parts of the go applications that are used in meta-virt no longer work. Was it the
intention of the re-work to not be compatible with existing users of the language support ?

Quoted 4 lines

Just curious, since I haven't seen this flagged in this context (compatibility), but now we
have to fixup the layers before I branch to match the release .. and that was unexpected.

It does change things which can potentially break old recipes. That said, it is straightforward to fix for most recipes as they end being simpler.

I volunteer to help if there is the need.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#23 lore raw
Quoted 24 lines · Otavio Salvador
Quoted 1 line · Bruce Ashfield

On Tue, Sep 12, 2017 at 8:50 AM, Otavio Salvador <

[email protected]>

Quoted 8 lines
Quoted 7 lines · wrote:

This improves the Go support on OE-Core.

We are trying to port as much as possible work done by Matt on meta-golang back to OE-Core and also to avoid carrying old releases as there is no need to support more versions of Go toolchain.

Quoted 7 lines
Quoted 2 lines

This fixes issues in existing support as well as add support for SDK generation which supports Go.

Testing against what has merged, and what are in these series is showing that large
parts of the go applications that are used in meta-virt no longer work.

Was

Quoted 4 lines

it the
intention of the re-work to not be compatible with existing users of the language support ?

Quoted 9 lines
Quoted 4 lines

Just curious, since I haven't seen this flagged in this context (compatibility), but now we
have to fixup the layers before I branch to match the release .. and that was unexpected.

It does change things which can potentially break old recipes. That said, it is straightforward to fix for most recipes as they end being simpler.

ok, cool. I just didn't notice this went it first went in (that doesn't mean it wasn't stated .. just that I missed it :)

Quoted 3 lines

I volunteer to help if there is the need.

Right now some of the fixes are in flight, if the fixes get stuck, I'll make sure to ping.

Thanks,

Bruce

Quoted 6 lines

--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"