All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/26] Revamp the Go support
@ 2017-09-11 12:45 Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 01/26] goarch.bbclass: Stop passing True as second argument of d.getVar Otavio Salvador
                   ` (26 more replies)
  0 siblings, 27 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, 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.

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

Changes in v5:
- new patch
- use new unpack support
- new patch

Changes in v4:
- new patch to consolidade in a single patchset all golang changes
- rebase on top of new "goarch.bbclass: Replace logic for setting
  GOARM"

Changes in v3:
- new patch
- new patch
- new patch

Changes in v2:
- Remove -x flag (madisongh)
- Remove GO_EXTLDFLAGS for now (madisongh)
- new patch

Matt Madison (16):
  go.bbclass: exported function cleanup
  go.bbclass: separate ${S} and ${B}
  go.bbclass: add do_unpack function to handle common cases
  go.bbclass: add GO_INSTALL_FILTEROUT variable
  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 (9):
  goarch.bbclass: Stop passing True as second argument of d.getVar
  go.bbclass: Fix binary installation path detection
  go: Remove Go 1.6 and 1.7 releases
  goarch.bbclass: Add support for ARMv5
  go.bbclass: Use a global Go build flags
  go.bbclass: Enable parallel build
  go.bbclass: Use an auxiliary variable to add the build dependencies
  go-dep: Add 0.3.0 release
  go-helloworld: Use the Golang examples repository

Will Newton (1):
  goarch.bbclass: Replace logic for setting GOARM

 meta/classes/go.bbclass                            | 146 +++++++------
 meta/classes/goarch.bbclass                        |  27 ++-
 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.6.inc                |  19 --
 .../go/go-1.6/armhf-elf-header.patch               |  23 ---
 .../go/go-1.6/fix-cc-handling.patch                |  50 -----
 .../go/go-1.6/fix-target-cc-for-build.patch        |  17 --
 meta/recipes-devtools/go/go-1.6/gotooldir.patch    |  30 ---
 .../go/go-1.6/split-host-and-target-build.patch    |  63 ------
 meta/recipes-devtools/go/go-1.6/syslog.patch       |  62 ------
 meta/recipes-devtools/go/go-1.7.inc                |  19 --
 .../go/go-1.7/armhf-elf-header.patch               |  23 ---
 .../go/go-1.7/fix-cc-handling.patch                |  50 -----
 .../go/go-1.7/fix-target-cc-for-build.patch        |  17 --
 meta/recipes-devtools/go/go-1.7/gotooldir.patch    |  30 ---
 .../go/go-1.7/split-host-and-target-build.patch    |  62 ------
 meta/recipes-devtools/go/go-1.7/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 |  17 ++
 .../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.7.bb           |   5 -
 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           |  18 ++
 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.6.bb                 |   4 -
 meta/recipes-devtools/go/go_1.7.bb                 |   2 -
 meta/recipes-devtools/go/go_1.8.bb                 |   2 +-
 .../go-examples/files/helloworld.go                |  10 -
 meta/recipes-extended/go-examples/go-examples.inc  |  10 -
 .../go-examples/go-helloworld_0.1.bb               |  24 ++-
 46 files changed, 500 insertions(+), 1117 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-1.6.inc
 delete mode 100644 meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/gotooldir.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/syslog.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7.inc
 delete mode 100644 meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/gotooldir.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/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
 delete mode 100644 meta/recipes-devtools/go/go-cross_1.7.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-dep_0.3.0.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
 delete mode 100644 meta/recipes-devtools/go/go_1.6.bb
 delete mode 100644 meta/recipes-devtools/go/go_1.7.bb
 delete mode 100644 meta/recipes-extended/go-examples/files/helloworld.go
 delete mode 100644 meta/recipes-extended/go-examples/go-examples.inc

-- 
2.14.1



^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v5 01/26] goarch.bbclass: Stop passing True as second argument of d.getVar
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 02/26] go.bbclass: Fix binary installation path detection Otavio Salvador
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

The d.getVar has the second argument as True by default, avoid passing
it here.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/goarch.bbclass | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
index 9cd38b8c48..7960ac5f9e 100644
--- a/meta/classes/goarch.bbclass
+++ b/meta/classes/goarch.bbclass
@@ -1,15 +1,15 @@
-BUILD_GOOS = "${@go_map_os(d.getVar('BUILD_OS', True), d)}"
-BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH', True), d)}"
+BUILD_GOOS = "${@go_map_os(d.getVar('BUILD_OS'), d)}"
+BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH'), 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_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}"
+HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}"
+HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), 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_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}"
+TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}"
+TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
 TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
-GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE',True) == d.getVar('HOST_GOTUPLE',True)]}"
+GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}"
 
 # define here because everybody inherits this class
 #
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 02/26] go.bbclass: Fix binary installation path detection
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 01/26] goarch.bbclass: Stop passing True as second argument of d.getVar Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 03/26] go: Remove Go 1.6 and 1.7 releases Otavio Salvador
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

Go toolchain changes the installation path when building for the same
architecture as the build host. This was already been considered in
the GO_BUILD_BINDIR variable but was not being used by the go class.

This fixes following error:

,----
| ERROR: go-dep-0.3.0-r0 do_package: QA Issue: go-dep: Files/directories
| were installed but not shipped in any package:
|   /usr/lib/x86_64-oel-linux/go/bin/dep
| Please set FILES such that these items are packaged. Alternatively if
| they are unneeded, avoid installing them or delete them within
| do_install.
`----

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index cedda68c55..e073cb91b5 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -3,7 +3,7 @@ inherit goarch
 GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
 GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin"
-GOBIN_FINAL = "${GOROOT_FINAL}/bin/${GOOS}_${GOARCH}"
+GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}"
 
 export GOOS = "${TARGET_GOOS}"
 export GOARCH = "${TARGET_GOARCH}"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 03/26] go: Remove Go 1.6 and 1.7 releases
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 01/26] goarch.bbclass: Stop passing True as second argument of d.getVar Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 02/26] go.bbclass: Fix binary installation path detection Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 04/26] goarch.bbclass: Replace logic for setting GOARM Otavio Salvador
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

The OE-Core has no reason to support multiple versions of Go as this
increases the maintenance work and testing efforts. So we are going to
support just a single version from now on which currently is 1.8.3.

The 1.4 release is kept around as it is used for bootstrap, as such,
it cannot be removed.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/recipes-devtools/go/go-1.6.inc                | 19 -------
 .../go/go-1.6/armhf-elf-header.patch               | 23 --------
 .../go/go-1.6/fix-cc-handling.patch                | 50 -----------------
 .../go/go-1.6/fix-target-cc-for-build.patch        | 17 ------
 meta/recipes-devtools/go/go-1.6/gotooldir.patch    | 30 -----------
 .../go/go-1.6/split-host-and-target-build.patch    | 63 ----------------------
 meta/recipes-devtools/go/go-1.6/syslog.patch       | 62 ---------------------
 meta/recipes-devtools/go/go-1.7.inc                | 19 -------
 .../go/go-1.7/armhf-elf-header.patch               | 23 --------
 .../go/go-1.7/fix-cc-handling.patch                | 50 -----------------
 .../go/go-1.7/fix-target-cc-for-build.patch        | 17 ------
 meta/recipes-devtools/go/go-1.7/gotooldir.patch    | 30 -----------
 .../go/go-1.7/split-host-and-target-build.patch    | 62 ---------------------
 meta/recipes-devtools/go/go-1.7/syslog.patch       | 62 ---------------------
 meta/recipes-devtools/go/go-cross_1.7.bb           |  5 --
 meta/recipes-devtools/go/go_1.6.bb                 |  4 --
 meta/recipes-devtools/go/go_1.7.bb                 |  2 -
 17 files changed, 538 deletions(-)
 delete mode 100644 meta/recipes-devtools/go/go-1.6.inc
 delete mode 100644 meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/gotooldir.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.6/syslog.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7.inc
 delete mode 100644 meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/gotooldir.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch
 delete mode 100644 meta/recipes-devtools/go/go-1.7/syslog.patch
 delete mode 100644 meta/recipes-devtools/go/go-cross_1.7.bb
 delete mode 100644 meta/recipes-devtools/go/go_1.6.bb
 delete mode 100644 meta/recipes-devtools/go/go_1.7.bb

diff --git a/meta/recipes-devtools/go/go-1.6.inc b/meta/recipes-devtools/go/go-1.6.inc
deleted file mode 100644
index 769c1d8f22..0000000000
--- a/meta/recipes-devtools/go/go-1.6.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-require go-common.inc
-
-PV = "1.6.3"
-GO_BASEVERSION = "1.6"
-FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
-
-LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
-
-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 \
-"
-SRC_URI[md5sum] = "bf3fce6ccaadd310159c9e874220e2a2"
-SRC_URI[sha256sum] = "6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00"
-
diff --git a/meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
deleted file mode 100644
index 1e3a16b319..0000000000
--- a/meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Encode arm EABI ( hard/soft ) calling convention in ELF header
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-Index: go/src/cmd/link/internal/ld/elf.go
-===================================================================
---- go.orig/src/cmd/link/internal/ld/elf.go
-+++ go/src/cmd/link/internal/ld/elf.go
-@@ -827,7 +827,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 {
- 			// We set a value here that makes no indication of which
- 			// float ABI the object uses, because this is information
- 			// used by the dynamic linker to compare executables and
diff --git a/meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch b/meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
deleted file mode 100644
index 983323ace9..0000000000
--- a/meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Accept CC with multiple words in its name
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-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/meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch b/meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
deleted file mode 100644
index 2f6156ecd2..0000000000
--- a/meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-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/meta/recipes-devtools/go/go-1.6/gotooldir.patch b/meta/recipes-devtools/go/go-1.6/gotooldir.patch
deleted file mode 100644
index 94670259f2..0000000000
--- a/meta/recipes-devtools/go/go-1.6/gotooldir.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Define tooldir in relation to GOTOOLDIR env var
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-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/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch b/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
deleted file mode 100644
index afbae02b4e..0000000000
--- a/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Add new option --target-only to build target components
-Separates the host and target pieces of build
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-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/meta/recipes-devtools/go/go-1.6/syslog.patch b/meta/recipes-devtools/go/go-1.6/syslog.patch
deleted file mode 100644
index 29be06f1bd..0000000000
--- a/meta/recipes-devtools/go/go-1.6/syslog.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-Add timeouts to logger
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-
-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/meta/recipes-devtools/go/go-1.7.inc b/meta/recipes-devtools/go/go-1.7.inc
deleted file mode 100644
index 5c3004e875..0000000000
--- a/meta/recipes-devtools/go/go-1.7.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-require go-common.inc
-
-PV = "1.7.4"
-GO_BASEVERSION = "1.7"
-FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
-
-LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
-
-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 \
-"
-SRC_URI[md5sum] = "49c1076428a5d3b5ad7ac65233fcca2f"
-SRC_URI[sha256sum] = "4c189111e9ba651a2bb3ee868aa881fab36b2f2da3409e80885ca758a6b614cc"
-
diff --git a/meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch
deleted file mode 100644
index 1e3a16b319..0000000000
--- a/meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Encode arm EABI ( hard/soft ) calling convention in ELF header
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-Index: go/src/cmd/link/internal/ld/elf.go
-===================================================================
---- go.orig/src/cmd/link/internal/ld/elf.go
-+++ go/src/cmd/link/internal/ld/elf.go
-@@ -827,7 +827,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 {
- 			// We set a value here that makes no indication of which
- 			// float ABI the object uses, because this is information
- 			// used by the dynamic linker to compare executables and
diff --git a/meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch b/meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch
deleted file mode 100644
index a67caf41a5..0000000000
--- a/meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Accept CC with multiple words in its name
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-Index: go/src/cmd/go/build.go
-===================================================================
---- go.orig/src/cmd/go/build.go
-+++ go/src/cmd/go/build.go
-@@ -2991,12 +2991,24 @@ func (b *builder) gccCmd(objdir string)
- 	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)
-+}
-+
- // gfortranCmd returns a gfortran command line prefix.
- func (b *builder) gfortranCmd(objdir string) []string {
- 	return b.ccompilerCmd("FC", "gfortran", objdir)
-Index: go/src/cmd/go/env.go
-===================================================================
---- go.orig/src/cmd/go/env.go
-+++ go/src/cmd/go/env.go
-@@ -51,10 +51,9 @@ func mkEnv() []envVar {
- 
- 	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/meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch b/meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch
deleted file mode 100644
index 2f6156ecd2..0000000000
--- a/meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-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/meta/recipes-devtools/go/go-1.7/gotooldir.patch b/meta/recipes-devtools/go/go-1.7/gotooldir.patch
deleted file mode 100644
index 94670259f2..0000000000
--- a/meta/recipes-devtools/go/go-1.7/gotooldir.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Define tooldir in relation to GOTOOLDIR env var
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-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/meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch b/meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch
deleted file mode 100644
index b0dd95bbe7..0000000000
--- a/meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-Add new option --target-only to build target components
-Separates the host and target pieces of build
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-Index: go/src/make.bash
-===================================================================
---- go.orig/src/make.bash
-+++ go/src/make.bash
-@@ -154,13 +154,22 @@ if [ "$1" = "--no-clean" ]; then
- 	buildall=""
- 	shift
- fi
--./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
-+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
- 
--# Delay move of dist tool to now, because bootstrap may clear tool directory.
--mv cmd/dist/dist "$GOTOOLDIR"/dist
--echo
-+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
- 
--if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
- 	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.
-@@ -169,11 +178,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/meta/recipes-devtools/go/go-1.7/syslog.patch b/meta/recipes-devtools/go/go-1.7/syslog.patch
deleted file mode 100644
index 29be06f1bd..0000000000
--- a/meta/recipes-devtools/go/go-1.7/syslog.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-Add timeouts to logger
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-
-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/meta/recipes-devtools/go/go-cross_1.7.bb b/meta/recipes-devtools/go/go-cross_1.7.bb
deleted file mode 100644
index 56ee084b10..0000000000
--- a/meta/recipes-devtools/go/go-cross_1.7.bb
+++ /dev/null
@@ -1,5 +0,0 @@
-require go-cross.inc
-require go_${PV}.bb
-
-# Go binaries are not understood by the strip tool.
-INHIBIT_SYSROOT_STRIP = "1"
diff --git a/meta/recipes-devtools/go/go_1.6.bb b/meta/recipes-devtools/go/go_1.6.bb
deleted file mode 100644
index 2f590338c4..0000000000
--- a/meta/recipes-devtools/go/go_1.6.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-require go.inc
-require go-${PV}.inc
-
-BBCLASSEXTEND = "cross"
diff --git a/meta/recipes-devtools/go/go_1.7.bb b/meta/recipes-devtools/go/go_1.7.bb
deleted file mode 100644
index e7a6ab277e..0000000000
--- a/meta/recipes-devtools/go/go_1.7.bb
+++ /dev/null
@@ -1,2 +0,0 @@
-require go-${PV}.inc
-require go.inc
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 04/26] goarch.bbclass: Replace logic for setting GOARM
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (2 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 03/26] go: Remove Go 1.6 and 1.7 releases Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-18 13:26   ` Will Newton
  2017-09-11 12:45 ` [PATCH v5 05/26] goarch.bbclass: Add support for ARMv5 Otavio Salvador
                   ` (22 subsequent siblings)
  26 siblings, 1 reply; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Will Newton <will.newton@gmail.com>

The previous logic applied a regex to TUNE_FEATURES which could
set the GOARM value to 7 incorrectly, for example when dealing
with an arm1176 core. Simplify to check for the presence of
"armv7" instead. At the same time add a check for "armv6" and
set GOARM to 6 in that case.

Signed-off-by: Will Newton <willn@resin.io>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4:
- new patch to consolidade in a single patchset all golang changes

Changes in v3: None
Changes in v2: None

 meta/classes/goarch.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
index 7960ac5f9e..0f0d8b6a60 100644
--- a/meta/classes/goarch.bbclass
+++ b/meta/classes/goarch.bbclass
@@ -45,8 +45,11 @@ def go_map_arch(a, d):
 
 def go_map_arm(a, f, d):
     import re
-    if re.match('arm.*', a) and re.match('arm.*7.*', f):
-        return '7'
+    if re.match('arm.*', a):
+        if 'armv7' in f:
+            return '7'
+        elif 'armv6' in f:
+            return '6'
     return ''
 
 def go_map_os(o, d):
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 05/26] goarch.bbclass: Add support for ARMv5
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (3 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 04/26] goarch.bbclass: Replace logic for setting GOARM Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 06/26] go.bbclass: Use a global Go build flags Otavio Salvador
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

This adds support to return the proper ARMv5 format.

This change is based on the meta-golang[1] layer. Thanks to Matt
Madison <matt@madison.systems> for his work on this.

1. https://github.com/madisongh/meta-golang

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4:
- rebase on top of new "goarch.bbclass: Replace logic for setting
  GOARM"

Changes in v3: None
Changes in v2: None

 meta/classes/goarch.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
index 0f0d8b6a60..0c22f80518 100644
--- a/meta/classes/goarch.bbclass
+++ b/meta/classes/goarch.bbclass
@@ -50,6 +50,8 @@ def go_map_arm(a, f, d):
             return '7'
         elif 'armv6' in f:
             return '6'
+        elif 'armv5' in f:
+            return '5'
     return ''
 
 def go_map_os(o, d):
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 06/26] go.bbclass: Use a global Go build flags
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (4 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 05/26] goarch.bbclass: Add support for ARMv5 Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 07/26] go.bbclass: Enable parallel build Otavio Salvador
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

We now use a GOBUILDFLAGS to provide a global variable to control the
build flags to be given to Go.

This change is based on the meta-golang[1] layer. Thanks to Matt
Madison <matt@madison.systems> for his work on this.

1. https://github.com/madisongh/meta-golang

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Remove -x flag (madisongh)
- Remove GO_EXTLDFLAGS for now (madisongh)

 meta/classes/go.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index e073cb91b5..720a504cd8 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -5,6 +5,8 @@ GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin"
 GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}"
 
+export GOBUILDFLAGS ?= "-v"
+
 export GOOS = "${TARGET_GOOS}"
 export GOARCH = "${TARGET_GOARCH}"
 export GOARM = "${TARGET_GOARM}"
@@ -32,7 +34,7 @@ GO_INSTALL ?= "${GO_IMPORT}/..."
 do_go_compile() {
 	GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
 	if [ -n "${GO_INSTALL}" ]; then
-		GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install -v ${GO_INSTALL}
+		GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL}
 	fi
 }
 
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 07/26] go.bbclass: Enable parallel build
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (5 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 06/26] go.bbclass: Use a global Go build flags Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 08/26] go.bbclass: exported function cleanup Otavio Salvador
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

The parallel build is based on PARALLEL_MAKE variable but can be
overriden setting the GO_PARALLEL_BUILD one.

This change is based on the meta-golang[1] layer. Thanks to Matt
Madison <matt@madison.systems> for his work on this.

1. https://github.com/madisongh/meta-golang

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 720a504cd8..f64b07fd82 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -1,11 +1,31 @@
 inherit goarch
 
+def get_go_parallel_make(d):
+    pm = (d.getVar('PARALLEL_MAKE') or '').split()
+    # look for '-j' and throw other options (e.g. '-l') away
+    # because they might have a different meaning in golang
+    while pm:
+        opt = pm.pop(0)
+        if opt == '-j':
+            v = pm.pop(0)
+        elif opt.startswith('-j'):
+            v = opt[2:].strip()
+        else:
+            continue
+
+        return '-p %d' % int(v)
+
+    return ""
+
+GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"
+
 GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
 GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin"
 GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}"
 
 export GOBUILDFLAGS ?= "-v"
+GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} "
 
 export GOOS = "${TARGET_GOOS}"
 export GOARCH = "${TARGET_GOARCH}"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 08/26] go.bbclass: exported function cleanup
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (6 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 07/26] go.bbclass: Enable parallel build Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 09/26] go.bbclass: Use an auxiliary variable to add the build dependencies Otavio Salvador
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

Since this is a class, it should follow the
class function export mechanism for its task
functions, and should set directory-related
flags for directories they need.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- new patch

Changes in v2: None

 meta/classes/go.bbclass | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index f64b07fd82..6df73bf377 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -51,14 +51,14 @@ FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*"
 
 GO_INSTALL ?= "${GO_IMPORT}/..."
 
-do_go_compile() {
+go_do_compile() {
 	GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
 	if [ -n "${GO_INSTALL}" ]; then
 		GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL}
 	fi
 }
 
-do_go_install() {
+go_do_install() {
 	rm -rf ${WORKDIR}/staging
 	install -d ${WORKDIR}/staging${GOROOT_FINAL} ${D}${GOROOT_FINAL}
 	tar -C ${S} -cf - . | tar -C ${WORKDIR}/staging${GOROOT_FINAL} -xpvf -
@@ -84,11 +84,7 @@ do_go_install() {
 		rmdir -p "${D}${GOBIN_FINAL}" || true
 	fi
 }
+do_install[dirs] =+ "${WORKDIR}/staging"
+do_install[cleandirs] += "${WORKDIR}/staging"
 
-do_compile() {
-	do_go_compile
-}
-
-do_install() {
-	do_go_install
-}
+EXPORT_FUNCTIONS do_compile do_install
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 09/26] go.bbclass: Use an auxiliary variable to add the build dependencies
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (7 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 08/26] go.bbclass: exported function cleanup Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 10/26] go.bbclass: separate ${S} and ${B} Otavio Salvador
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

This is going to easy the addition of nativesdk and virtual providers
in the future.

This change is based on the meta-golang[1] layer. Thanks to Matt
Madison <matt@madison.systems> for his work on this.

1. https://github.com/madisongh/meta-golang

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 6df73bf377..82b5f83aa0 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -24,6 +24,11 @@ GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/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-native = "go-native"
+
+DEPENDS_append = " ${DEPENDS_GOLANG}"
+
 export GOBUILDFLAGS ?= "-v"
 GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} "
 
@@ -43,9 +48,6 @@ 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}"
 
-DEPENDS += "go-cross-${TARGET_ARCH}"
-DEPENDS_class-native += "go-native"
-
 FILES_${PN}-staticdev += "${GOSRC_FINAL}/${GO_IMPORT}"
 FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*"
 
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 10/26] go.bbclass: separate ${S} and ${B}
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (8 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 09/26] go.bbclass: Use an auxiliary variable to add the build dependencies Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 11/26] go.bbclass: add do_unpack function to handle common cases Otavio Salvador
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

Add a do_configure task to populate ${B} by symlinking
in the src subdirectory under ${S}, which lets us point
GOPATH at ${B}.  This lets us take advantage of the
automatic directory creation and cleaning for do_configure.

This necessitates a change to do_install to split the
installation of the sources and built artifacts.  Taking
advantage of some additional tar options, we can eliminate
the extra staging area and extra recursive chown command.
So overall efficiency should be improved.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- new patch

Changes in v2: None

 meta/classes/go.bbclass | 46 ++++++++++++++++++----------------------------
 1 file changed, 18 insertions(+), 28 deletions(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 82b5f83aa0..cfe773e13d 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -53,40 +53,30 @@ FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*"
 
 GO_INSTALL ?= "${GO_IMPORT}/..."
 
+B = "${WORKDIR}/build"
+
+go_do_configure() {
+	ln -snf ${S}/src ${B}/
+}
+
 go_do_compile() {
-	GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
+	GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
 	if [ -n "${GO_INSTALL}" ]; then
-		GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL}
+		GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL}
 	fi
 }
+do_compile[cleandirs] = "${B}/bin ${B}/pkg"
 
 go_do_install() {
-	rm -rf ${WORKDIR}/staging
-	install -d ${WORKDIR}/staging${GOROOT_FINAL} ${D}${GOROOT_FINAL}
-	tar -C ${S} -cf - . | tar -C ${WORKDIR}/staging${GOROOT_FINAL} -xpvf -
-
-	find ${WORKDIR}/staging${GOROOT_FINAL} \( \
-		-name \*.indirectionsymlink -o \
-		-name .git\* -o                \
-		-name .hg -o                   \
-		-name .svn -o                  \
-		-name .pc\* -o                 \
-		-name patches\*                \
-		\) -print0 | \
-	xargs -r0 rm -rf
-
-	tar -C ${WORKDIR}/staging${GOROOT_FINAL} -cf - . | \
-	tar -C ${D}${GOROOT_FINAL} -xpvf -
-
-	chown -R root:root "${D}${GOROOT_FINAL}"
-
-	if [ -e "${D}${GOBIN_FINAL}" ]; then
-		install -d -m 0755 "${D}${bindir}"
-		find "${D}${GOBIN_FINAL}" ! -type d -print0 | xargs -r0 mv --target-directory="${D}${bindir}"
-		rmdir -p "${D}${GOBIN_FINAL}" || true
+	install -d ${D}${GOROOT_FINAL}/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 -
+
+	if [ -n "`ls ${B}/${GO_BUILD_BINDIR}/`" ]; then
+		install -d ${D}${bindir}
+		install -m 0755 ${B}/${GO_BUILD_BINDIR}/* ${D}${bindir}/
 	fi
 }
-do_install[dirs] =+ "${WORKDIR}/staging"
-do_install[cleandirs] += "${WORKDIR}/staging"
 
-EXPORT_FUNCTIONS do_compile do_install
+EXPORT_FUNCTIONS do_configure do_compile do_install
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 11/26] go.bbclass: add do_unpack function to handle common cases
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (9 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 10/26] go.bbclass: separate ${S} and ${B} Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 12/26] go.bbclass: add GO_INSTALL_FILTEROUT variable Otavio Salvador
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

Go source trees have a particular structure, with all
sources located under ${GOROOT}/src/<import-path>.
The fetcher step implemented by the 'go get' command
automatically follows this structure, so we need
to do the same here.

Since most Go packages are hosted in git repositories,
this adds a custom do_unpack() function that sets
the destsuffix to match the expected directory structure,
for any git SRC_URIs that haven't had a destsuffix
explicitly set in the recipe.

This simplifies recipe writing for the most common
cases.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- new patch

Changes in v2: None

 meta/classes/go.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index cfe773e13d..c1ef01fafe 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -55,6 +55,24 @@ GO_INSTALL ?= "${GO_IMPORT}/..."
 
 B = "${WORKDIR}/build"
 
+python go_do_unpack() {
+    src_uri = (d.getVar('SRC_URI') or "").split()
+    if len(src_uri) == 0:
+        return
+
+    try:
+        fetcher = bb.fetch2.Fetch(src_uri, d)
+        for url in fetcher.urls:
+            if fetcher.ud[url].type == 'git':
+                if fetcher.ud[url].parm.get('destsuffix') is None:
+                    s_dirname = os.path.basename(d.getVar('S'))
+                    fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src',
+                                                                      d.getVar('GO_IMPORT')) + '/'
+        fetcher.unpack(d.getVar('WORKDIR'))
+    except bb.fetch2.BBFetchException as e:
+        raise bb.build.FuncFailed(e)
+}
+
 go_do_configure() {
 	ln -snf ${S}/src ${B}/
 }
@@ -79,4 +97,4 @@ go_do_install() {
 	fi
 }
 
-EXPORT_FUNCTIONS do_configure do_compile do_install
+EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 12/26] go.bbclass: add GO_INSTALL_FILTEROUT variable
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (10 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 11/26] go.bbclass: add do_unpack function to handle common cases Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 13/26] go-dep: Add 0.3.0 release Otavio Salvador
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

When using the Go 'vendor' mechanism to bring in
dependencies for a Go package, the default GO_INSTALL
setting, which uses the '...' wildcard, will include
the vendored packages in the build, which produces
incorrect results.

There are also some Go packages that are structured
poorly, so that the '...' wildcard results in building
example or test code that should not be included in
the build, or fail to build.

This patch adds a mechanism for filtering out a
subset of the sources.  It defaults to filtering
out everything under the 'vendor' subdirectory
under package's main directory, which is the
normal location for vendored packages, but can
be overridden by a recipe to filter out other
subdirectories, if needed.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5:
- new patch

Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index c1ef01fafe..cb1e96d88b 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -52,6 +52,7 @@ FILES_${PN}-staticdev += "${GOSRC_FINAL}/${GO_IMPORT}"
 FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*"
 
 GO_INSTALL ?= "${GO_IMPORT}/..."
+GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
 
@@ -73,6 +74,11 @@ python go_do_unpack() {
         raise bb.build.FuncFailed(e)
 }
 
+go_list_packages() {
+	GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
+		egrep -v '${GO_INSTALL_FILTEROUT}'
+}
+
 go_do_configure() {
 	ln -snf ${S}/src ${B}/
 }
@@ -80,7 +86,7 @@ go_do_configure() {
 go_do_compile() {
 	GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
 	if [ -n "${GO_INSTALL}" ]; then
-		GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL}
+		GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} `go_list_packages`
 	fi
 }
 do_compile[cleandirs] = "${B}/bin ${B}/pkg"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 13/26] go-dep: Add 0.3.0 release
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (11 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 12/26] go.bbclass: add GO_INSTALL_FILTEROUT variable Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 14/26] go-helloworld: Use the Golang examples repository Otavio Salvador
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

This is the Golang dependency management tool under development; it is
ready for production use and intended to be merged onto Golang
1.10. Until that, projects are starting to use it and making it
available on OE-Core reduces the Golang integration work for new
recipes.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5:
- use new unpack support

Changes in v4: None
Changes in v3: None
Changes in v2:
- new patch

 meta/recipes-devtools/go/go-dep_0.3.0.bb | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 meta/recipes-devtools/go/go-dep_0.3.0.bb

diff --git a/meta/recipes-devtools/go/go-dep_0.3.0.bb b/meta/recipes-devtools/go/go-dep_0.3.0.bb
new file mode 100644
index 0000000000..c65b4f7cb5
--- /dev/null
+++ b/meta/recipes-devtools/go/go-dep_0.3.0.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Dependency management tool for Golang"
+HOMEPAGE = "https://github.com/golang/dep"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=1bad315647751fab0007812f70d42c0d"
+
+GO_IMPORT = "github.com/golang/dep"
+SRC_URI = "git://${GO_IMPORT}"
+
+# Points to 0.3.0 tag
+SRCREV = "7a91b794bbfbf1f3b8b79823799316451127801b"
+
+inherit go
+
+GO_INSTALL = "${GO_IMPORT}/cmd/dep"
+
+INSANE_SKIP_${PN} += "ldflags"
+
+RDEPENDS_${PN}-staticdev += "bash"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 14/26] go-helloworld: Use the Golang examples repository
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (12 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 13/26] go-dep: Add 0.3.0 release Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 15/26] go-native: remove dependency on go-bootstrap-native Otavio Salvador
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

This updates the recipe to use the Golang examples repository so it
makes use of the unpack as well as standard tasks showing how easy it
can be.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5:
- new patch

Changes in v4: None
Changes in v3: None
Changes in v2: None

 .../go-examples/files/helloworld.go                | 10 ---------
 meta/recipes-extended/go-examples/go-examples.inc  | 10 ---------
 .../go-examples/go-helloworld_0.1.bb               | 24 ++++++++++++++--------
 3 files changed, 15 insertions(+), 29 deletions(-)
 delete mode 100644 meta/recipes-extended/go-examples/files/helloworld.go
 delete mode 100644 meta/recipes-extended/go-examples/go-examples.inc

diff --git a/meta/recipes-extended/go-examples/files/helloworld.go b/meta/recipes-extended/go-examples/files/helloworld.go
deleted file mode 100644
index 0253c40411..0000000000
--- a/meta/recipes-extended/go-examples/files/helloworld.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// You can edit this code!
-// Click here and start typing.
-// taken from https://golang.org/
-package main
-
-import "fmt"
-
-func main() {
-	fmt.Println("Hello, 世界")
-}
diff --git a/meta/recipes-extended/go-examples/go-examples.inc b/meta/recipes-extended/go-examples/go-examples.inc
deleted file mode 100644
index c63268116b..0000000000
--- a/meta/recipes-extended/go-examples/go-examples.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-DESCRIPTION = "This is a simple example recipe that cross-compiles a Go program."
-SECTION = "examples"
-HOMEPAGE = "https://golang.org/"
-
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
-
-S = "${WORKDIR}"
-
-inherit go
diff --git a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
index 930c57df95..222fc9d349 100644
--- a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
+++ b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
@@ -1,13 +1,19 @@
-require go-examples.inc
+DESCRIPTION = "This is a simple example recipe that cross-compiles a Go program."
+SECTION = "examples"
+HOMEPAGE = "https://golang.org/"
 
-SRC_URI += " \
-  file://helloworld.go \
-"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
-do_compile() {
-	go build helloworld.go
-}
+SRC_URI = "git://${GO_IMPORT}"
+SRCREV = "46695d81d1fae905a270fb7db8a4d11a334562fe"
+
+GO_IMPORT = "github.com/golang/example"
+GO_INSTALL = "${GO_IMPORT}/hello"
+
+inherit go
 
-do_install() {
-	install -D -m 0755 ${S}/helloworld ${D}${bindir}/helloworld
+# This is just to make clear where this example is
+do_install_append() {
+    mv ${D}${bindir}/hello ${D}${bindir}/${BPN}
 }
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 15/26] go-native: remove dependency on go-bootstrap-native
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (13 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 14/26] go-helloworld: Use the Golang examples repository Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 16/26] go-bootstrap-native: remove recipe Otavio Salvador
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

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.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 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(-)

diff --git a/meta/recipes-devtools/go/go-1.8.inc b/meta/recipes-devtools/go/go-1.8.inc
index 3690f310bd..bfb26de01d 100644
--- a/meta/recipes-devtools/go/go-1.8.inc
+++ b/meta/recipes-devtools/go/go-1.8.inc
@@ -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"
diff --git a/meta/recipes-devtools/go/go-common.inc b/meta/recipes-devtools/go/go-common.inc
index f74b8b7650..ce1eb86812 100644
--- a/meta/recipes-devtools/go/go-common.inc
+++ b/meta/recipes-devtools/go/go-common.inc
@@ -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}"
 
diff --git a/meta/recipes-devtools/go/go-native.inc b/meta/recipes-devtools/go/go-native.inc
index c21f8fda78..9eb2b3211f 100644
--- a/meta/recipes-devtools/go/go-native.inc
+++ b/meta/recipes-devtools/go/go-native.inc
@@ -1,16 +1,28 @@
+# Use immediate assingment here to get the original (/usr/lib)
+# instead of the one rewritten by native.bbclass.
+nonstaging_libdir := "${libdir}"
+
 inherit native
 
-BOOTSTRAP ?= ""
+SRC_URI_append = " http://golang.org/dl/go1.4.3.src.tar.gz;name=bootstrap;subdir=go1.4"
+SRC_URI[bootstrap.md5sum] = "dfb604511115dd402a77a553a5923a04"
+SRC_URI[bootstrap.sha256sum] = "9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959"
+
 export GOOS = "${BUILD_GOOS}"
 export GOARCH = "${BUILD_GOARCH}"
-export GOROOT_FINAL = "${STAGING_LIBDIR_NATIVE}/go${BOOTSTRAP}"
-export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go1.4"
+CC = "${@d.getVar('BUILD_CC', True).strip()}"
+
 export CGO_ENABLED = "1"
 
-do_configure[noexec] = "1"
+do_configure() {
+    cd ${WORKDIR}/go1.4/go/src
+    CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash
+}
 
 do_compile() {
 	export GOBIN="${B}/bin"
+	export GOROOT_FINAL="${nonstaging_libdir}/go"
+	export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go"
 	rm -rf ${GOBIN}
 	mkdir ${GOBIN}
 
@@ -18,7 +30,7 @@ do_compile() {
 	mkdir -p ${WORKDIR}/build-tmp
 
 	cd src
-	CGO_ENABLED=0 ./make.bash --host-only
+	./make.bash --host-only
 }
 
 make_wrapper() {
@@ -26,31 +38,25 @@ make_wrapper() {
 	cat <<END >${D}${bindir}/$2$3
 #!/bin/bash
 here=\`dirname \$0\`
-export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go$3\`}"
-\$here/../lib/go$3/bin/$1 "\$@"
+export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
+\$here/../lib/go/bin/$1 "\$@"
 END
-	chmod +x ${D}${bindir}/$2$3
+	chmod +x ${D}${bindir}/$2
 }
 
 do_install() {
-	install -d ${D}${libdir}/go${BOOTSTRAP}
-	cp -a ${B}/pkg ${D}${libdir}/go${BOOTSTRAP}/
-	install -d ${D}${libdir}/go${BOOTSTRAP}/src
+	install -d ${D}${libdir}/go
+	cp --preserve=mode,timestamps -R ${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${BOOTSTRAP}/src/; \
+		[ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
 	done)
 
-	install -d ${D}${bindir} ${D}${libdir}/go${BOOTSTRAP}/bin
+	install -d ${D}${bindir} ${D}${libdir}/go/bin
 	for f in ${B}/bin/*
 	do
 		base=`basename $f`
-		install -m755 $f ${D}${libdir}/go${BOOTSTRAP}/bin
-		make_wrapper $base $base ${BOOTSTRAP}
+		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/meta/recipes-devtools/go/go-native_1.8.bb b/meta/recipes-devtools/go/go-native_1.8.bb
index 182fca27a0..bbf3c0dd73 100644
--- a/meta/recipes-devtools/go/go-native_1.8.bb
+++ b/meta/recipes-devtools/go/go-native_1.8.bb
@@ -1,3 +1,2 @@
 require ${PN}.inc
 require go-${PV}.inc
-DEPENDS += "go-bootstrap-native"
diff --git a/meta/recipes-devtools/go/go.inc b/meta/recipes-devtools/go/go.inc
index 52abbebd7e..9efbd275bd 100644
--- a/meta/recipes-devtools/go/go.inc
+++ b/meta/recipes-devtools/go/go.inc
@@ -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}"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 16/26] go-bootstrap-native: remove recipe
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (14 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 15/26] go-native: remove dependency on go-bootstrap-native Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 17/26] go: split out go-runtime into separate recipe Otavio Salvador
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

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

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 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

diff --git a/meta/recipes-devtools/go/go-1.4.inc b/meta/recipes-devtools/go/go-1.4.inc
deleted file mode 100644
index 2f500f32b9..0000000000
--- a/meta/recipes-devtools/go/go-1.4.inc
+++ /dev/null
@@ -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"
diff --git a/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch b/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
deleted file mode 100644
index f2adc200b1..0000000000
--- a/meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 855145d5c03c4b4faf60736c38d7a299c682af4a Mon Sep 17 00:00:00 2001
-From: Shenghou Ma <minux@golang.org>
-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 <iant@golang.org>
----
-Upstream-Status: Backport
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
- 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/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
deleted file mode 100644
index e6e414e52f..0000000000
--- a/meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Description: Use correct ELF header for armhf binaries.
-Author: Adam Conrad <adconrad@ubuntu.com>
-Last-Update: 2013-07-08
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-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/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch b/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
deleted file mode 100644
index 95ca9d3aa9..0000000000
--- a/meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
+++ /dev/null
@@ -1,225 +0,0 @@
-From d6eefad445831c161fca130f9bdf7b3848aac23c Mon Sep 17 00:00:00 2001
-From: Paul Gortmaker <paul.gortmaker@windriver.com>
-Date: Tue, 29 Mar 2016 21:14:33 -0400
-Subject: [PATCH] go-cross: backport "cmd/link: support new 386/amd64
- relocations"
-
-Newer binutils won't support building older go-1.4.3 as per:
-
-https://github.com/golang/go/issues/13114
-
-Upstream commit 914db9f060b1fd3eb1f74d48f3bd46a73d4ae9c7 (see subj)
-was identified as the fix and nominated for 1.4.4 but that release
-never happened.  The paths in 1.4.3 aren't the same as go1.6beta1~662
-where this commit appeared, but the NetBSD folks indicated what a
-1.4.3 backport would look like here: https://gnats.netbsd.org/50777
-
-This is based on that, but without the BSD wrapper infrastructure
-layer that makes things look like patches of patches.
-
-Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-
-Upstream-Status: Backport [ Partial ]
-
-diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c
-index 18b5aa311981..2e9d339aef87 100644
---- a/src/cmd/6l/asm.c
-+++ b/src/cmd/6l/asm.c
-@@ -118,6 +118,8 @@ adddynrel(LSym *s, Reloc *r)
- 		return;
- 	
- 	case 256 + R_X86_64_GOTPCREL:
-+	case 256 + R_X86_64_GOTPCRELX:
-+	case 256 + R_X86_64_REX_GOTPCRELX:
- 		if(targ->type != SDYNIMPORT) {
- 			// have symbol
- 			if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
-diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c
-index 98c04240374f..cff29488e8af 100644
---- a/src/cmd/8l/asm.c
-+++ b/src/cmd/8l/asm.c
-@@ -115,6 +115,7 @@ adddynrel(LSym *s, Reloc *r)
- 		return;		
- 	
- 	case 256 + R_386_GOT32:
-+	case 256 + R_386_GOT32X:
- 		if(targ->type != SDYNIMPORT) {
- 			// have symbol
- 			if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
-diff --git a/src/cmd/ld/elf.h b/src/cmd/ld/elf.h
-index e84d996f2596..bbf2cfaa3cc0 100644
---- a/src/cmd/ld/elf.h
-+++ b/src/cmd/ld/elf.h
-@@ -478,32 +478,47 @@ typedef struct {
-  * Relocation types.
-  */
- 
--#define	R_X86_64_NONE	0	/* No relocation. */
--#define	R_X86_64_64	1	/* Add 64 bit symbol value. */
--#define	R_X86_64_PC32	2	/* PC-relative 32 bit signed sym value. */
--#define	R_X86_64_GOT32	3	/* PC-relative 32 bit GOT offset. */
--#define	R_X86_64_PLT32	4	/* PC-relative 32 bit PLT offset. */
--#define	R_X86_64_COPY	5	/* Copy data from shared object. */
--#define	R_X86_64_GLOB_DAT 6	/* Set GOT entry to data address. */
--#define	R_X86_64_JMP_SLOT 7	/* Set GOT entry to code address. */
--#define	R_X86_64_RELATIVE 8	/* Add load address of shared object. */
--#define	R_X86_64_GOTPCREL 9	/* Add 32 bit signed pcrel offset to GOT. */
--#define	R_X86_64_32	10	/* Add 32 bit zero extended symbol value */
--#define	R_X86_64_32S	11	/* Add 32 bit sign extended symbol value */
--#define	R_X86_64_16	12	/* Add 16 bit zero extended symbol value */
--#define	R_X86_64_PC16	13	/* Add 16 bit signed extended pc relative symbol value */
--#define	R_X86_64_8	14	/* Add 8 bit zero extended symbol value */
--#define	R_X86_64_PC8	15	/* Add 8 bit signed extended pc relative symbol value */
--#define	R_X86_64_DTPMOD64 16	/* ID of module containing symbol */
--#define	R_X86_64_DTPOFF64 17	/* Offset in TLS block */
--#define	R_X86_64_TPOFF64 18	/* Offset in static TLS block */
--#define	R_X86_64_TLSGD	19	/* PC relative offset to GD GOT entry */
--#define	R_X86_64_TLSLD	20	/* PC relative offset to LD GOT entry */
--#define	R_X86_64_DTPOFF32 21	/* Offset in TLS block */
--#define	R_X86_64_GOTTPOFF 22	/* PC relative offset to IE GOT entry */
--#define	R_X86_64_TPOFF32 23	/* Offset in static TLS block */
--
--#define	R_X86_64_COUNT	24	/* Count of defined relocation types. */
-+#define	R_X86_64_NONE           0
-+#define	R_X86_64_64             1
-+#define	R_X86_64_PC32           2
-+#define	R_X86_64_GOT32          3
-+#define	R_X86_64_PLT32          4
-+#define	R_X86_64_COPY           5
-+#define	R_X86_64_GLOB_DAT       6
-+#define	R_X86_64_JMP_SLOT       7
-+#define	R_X86_64_RELATIVE       8
-+#define	R_X86_64_GOTPCREL       9
-+#define	R_X86_64_32             10
-+#define	R_X86_64_32S            11
-+#define	R_X86_64_16             12
-+#define	R_X86_64_PC16           13
-+#define	R_X86_64_8              14
-+#define	R_X86_64_PC8            15
-+#define	R_X86_64_DTPMOD64       16
-+#define	R_X86_64_DTPOFF64       17
-+#define	R_X86_64_TPOFF64        18
-+#define	R_X86_64_TLSGD          19
-+#define	R_X86_64_TLSLD          20
-+#define	R_X86_64_DTPOFF32       21
-+#define	R_X86_64_GOTTPOFF       22
-+#define	R_X86_64_TPOFF32        23
-+#define	R_X86_64_PC64           24
-+#define	R_X86_64_GOTOFF64       25
-+#define	R_X86_64_GOTPC32        26
-+#define	R_X86_64_GOT64          27
-+#define	R_X86_64_GOTPCREL64     28
-+#define	R_X86_64_GOTPC64        29
-+#define	R_X86_64_GOTPLT64       30
-+#define	R_X86_64_PLTOFF64       31
-+#define	R_X86_64_SIZE32         32
-+#define	R_X86_64_SIZE64         33
-+#define	R_X86_64_GOTPC32_TLSDEC 34
-+#define	R_X86_64_TLSDESC_CALL   35
-+#define	R_X86_64_TLSDESC        36
-+#define	R_X86_64_IRELATIVE      37
-+#define	R_X86_64_PC32_BND       40
-+#define	R_X86_64_GOTPCRELX      41
-+#define	R_X86_64_REX_GOTPCRELX  42
- 
- 
- #define	R_ALPHA_NONE		0	/* No reloc */
-@@ -581,39 +596,42 @@ typedef struct {
- #define	R_ARM_COUNT		38	/* Count of defined relocation types. */
- 
- 
--#define	R_386_NONE	0	/* No relocation. */
--#define	R_386_32	1	/* Add symbol value. */
--#define	R_386_PC32	2	/* Add PC-relative symbol value. */
--#define	R_386_GOT32	3	/* Add PC-relative GOT offset. */
--#define	R_386_PLT32	4	/* Add PC-relative PLT offset. */
--#define	R_386_COPY	5	/* Copy data from shared object. */
--#define	R_386_GLOB_DAT	6	/* Set GOT entry to data address. */
--#define	R_386_JMP_SLOT	7	/* Set GOT entry to code address. */
--#define	R_386_RELATIVE	8	/* Add load address of shared object. */
--#define	R_386_GOTOFF	9	/* Add GOT-relative symbol address. */
--#define	R_386_GOTPC	10	/* Add PC-relative GOT table address. */
--#define	R_386_TLS_TPOFF	14	/* Negative offset in static TLS block */
--#define	R_386_TLS_IE	15	/* Absolute address of GOT for -ve static TLS */
--#define	R_386_TLS_GOTIE	16	/* GOT entry for negative static TLS block */
--#define	R_386_TLS_LE	17	/* Negative offset relative to static TLS */
--#define	R_386_TLS_GD	18	/* 32 bit offset to GOT (index,off) pair */
--#define	R_386_TLS_LDM	19	/* 32 bit offset to GOT (index,zero) pair */
--#define	R_386_TLS_GD_32	24	/* 32 bit offset to GOT (index,off) pair */
--#define	R_386_TLS_GD_PUSH 25	/* pushl instruction for Sun ABI GD sequence */
--#define	R_386_TLS_GD_CALL 26	/* call instruction for Sun ABI GD sequence */
--#define	R_386_TLS_GD_POP 27	/* popl instruction for Sun ABI GD sequence */
--#define	R_386_TLS_LDM_32 28	/* 32 bit offset to GOT (index,zero) pair */
--#define	R_386_TLS_LDM_PUSH 29	/* pushl instruction for Sun ABI LD sequence */
--#define	R_386_TLS_LDM_CALL 30	/* call instruction for Sun ABI LD sequence */
--#define	R_386_TLS_LDM_POP 31	/* popl instruction for Sun ABI LD sequence */
--#define	R_386_TLS_LDO_32 32	/* 32 bit offset from start of TLS block */
--#define	R_386_TLS_IE_32	33	/* 32 bit offset to GOT static TLS offset entry */
--#define	R_386_TLS_LE_32	34	/* 32 bit offset within static TLS block */
--#define	R_386_TLS_DTPMOD32 35	/* GOT entry containing TLS index */
--#define	R_386_TLS_DTPOFF32 36	/* GOT entry containing TLS offset */
--#define	R_386_TLS_TPOFF32 37	/* GOT entry of -ve static TLS offset */
--
--#define	R_386_COUNT	38	/* Count of defined relocation types. */
-+#define	R_386_NONE          0
-+#define	R_386_32            1
-+#define	R_386_PC32          2
-+#define	R_386_GOT32         3
-+#define	R_386_PLT32         4
-+#define	R_386_COPY          5
-+#define	R_386_GLOB_DAT      6
-+#define	R_386_JMP_SLOT      7
-+#define	R_386_RELATIVE      8
-+#define	R_386_GOTOFF        9
-+#define	R_386_GOTPC         10
-+#define	R_386_TLS_TPOFF     14
-+#define	R_386_TLS_IE        15
-+#define	R_386_TLS_GOTIE     16
-+#define	R_386_TLS_LE        17
-+#define	R_386_TLS_GD        18
-+#define	R_386_TLS_LDM       19
-+#define	R_386_TLS_GD_32     24
-+#define	R_386_TLS_GD_PUSH   25
-+#define	R_386_TLS_GD_CALL   26
-+#define	R_386_TLS_GD_POP    27
-+#define	R_386_TLS_LDM_32    28
-+#define	R_386_TLS_LDM_PUSH  29
-+#define	R_386_TLS_LDM_CALL  30
-+#define	R_386_TLS_LDM_POP   31
-+#define	R_386_TLS_LDO_32    32
-+#define	R_386_TLS_IE_32     33
-+#define	R_386_TLS_LE_32     34
-+#define	R_386_TLS_DTPMOD32  35
-+#define	R_386_TLS_DTPOFF32  36
-+#define	R_386_TLS_TPOFF32   37
-+#define	R_386_TLS_GOTDESC   39
-+#define	R_386_TLS_DESC_CALL 40
-+#define	R_386_TLS_DESC      41
-+#define	R_386_IRELATIVE     42
-+#define	R_386_GOT32X        43
- 
- #define	R_PPC_NONE		0	/* No relocation. */
- #define	R_PPC_ADDR32		1
-diff --git a/src/cmd/ld/ldelf.c b/src/cmd/ld/ldelf.c
-index dd5fa0d2a839..2e2fbd17377f 100644
---- a/src/cmd/ld/ldelf.c
-+++ b/src/cmd/ld/ldelf.c
-@@ -888,12 +888,15 @@ reltype(char *pn, int elftype, uchar *siz)
- 	case R('6', R_X86_64_PC32):
- 	case R('6', R_X86_64_PLT32):
- 	case R('6', R_X86_64_GOTPCREL):
-+	case R('6', R_X86_64_GOTPCRELX):
-+	case R('6', R_X86_64_REX_GOTPCRELX):
- 	case R('8', R_386_32):
- 	case R('8', R_386_PC32):
- 	case R('8', R_386_GOT32):
- 	case R('8', R_386_PLT32):
- 	case R('8', R_386_GOTOFF):
- 	case R('8', R_386_GOTPC):
-+	case R('8', R_386_GOT32X):
- 		*siz = 4;
- 		break;
- 	case R('6', R_X86_64_64):
--- 
-2.7.2
-
diff --git a/meta/recipes-devtools/go/go-1.4/syslog.patch b/meta/recipes-devtools/go/go-1.4/syslog.patch
deleted file mode 100644
index 29be06f1bd..0000000000
--- a/meta/recipes-devtools/go/go-1.4/syslog.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-Add timeouts to logger
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-
-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/meta/recipes-devtools/go/go-bootstrap-native_1.4.bb b/meta/recipes-devtools/go/go-bootstrap-native_1.4.bb
deleted file mode 100644
index 3d4141e879..0000000000
--- a/meta/recipes-devtools/go/go-bootstrap-native_1.4.bb
+++ /dev/null
@@ -1,3 +0,0 @@
-BOOTSTRAP = "1.4"
-require go-native.inc
-require go-${PV}.inc
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 17/26] go: split out go-runtime into separate recipe
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (15 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 16/26] go-bootstrap-native: remove recipe Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 18/26] go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGS Otavio Salvador
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

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.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 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

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index cb1e96d88b..b3464d2105 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -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"
diff --git a/meta/recipes-devtools/go/go-1.8.inc b/meta/recipes-devtools/go/go-1.8.inc
index bfb26de01d..2920d06f60 100644
--- a/meta/recipes-devtools/go/go-1.8.inc
+++ b/meta/recipes-devtools/go/go-1.8.inc
@@ -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"
diff --git a/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch b/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch
new file mode 100644
index 0000000000..c17839214a
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch
@@ -0,0 +1,21 @@
+Prevent GOROOT-resident packages from being rebuilt
+
+Signed-off-by: Matt Madison <matt@madison.systems>
+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 {
diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc
index 1c2d9e3a3d..df3e4ea914 100644
--- a/meta/recipes-devtools/go/go-cross.inc
+++ b/meta/recipes-devtools/go/go-cross.inc
@@ -1,15 +1,60 @@
 inherit cross
 
-DEPENDS += "gcc-cross-${TARGET_ARCH}"
+PROVIDES = "virtual/${TARGET_PREFIX}go"
+DEPENDS += "go-native"
 
 PN = "go-cross-${TARGET_ARCH}"
 
-# Ignore how TARGET_ARCH is computed.
-TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
-# Ignore target os libc for cross compiler
-#TARGET_OS[vardepexclude] = "LIBCEXTENSION"
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:"
+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()}"
 
-GOROOT_FINAL = "${libdir}/go"
-export GOROOT_FINAL
+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}"
+export GOARM="${TARGET_GOARM}"
+\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
+END
+    chmod +x ${D}${bindir}/$2
+}
+
+do_install() {
+    install -d ${D}${libdir}/go
+    cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
+    install -d ${D}${libdir}/go/src
+    (cd ${S}/src; for d in *; do \
+        [ ! -d $d ] || cp --preserve=mode,timestamps -R ${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 ${TARGET_PREFIX}$base
+    done
+}
diff --git a/meta/recipes-devtools/go/go-cross_1.8.bb b/meta/recipes-devtools/go/go-cross_1.8.bb
index 56ee084b10..80b5a03f6c 100644
--- a/meta/recipes-devtools/go/go-cross_1.8.bb
+++ b/meta/recipes-devtools/go/go-cross_1.8.bb
@@ -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
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
new file mode 100644
index 0000000000..e3eddda837
--- /dev/null
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -0,0 +1,58 @@
+DEPENDS = "virtual/${TARGET_PREFIX}go go-native"
+PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
+
+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 GO_TARGET_INSTALL = "std"
+export CGO_ENABLED = "1"
+export CC_FOR_TARGET="${CC}"
+export CXX_FOR_TARGET="${CXX}"
+export GOROOT_OVERRIDE = "1"
+
+do_configure[noexec] = "1"
+
+do_compile() {
+	export GOBIN="${B}/bin"
+	export CC="${@d.getVar('BUILD_CC').strip()}"
+	rm -rf ${GOBIN} ${B}/pkg
+	mkdir ${GOBIN}
+	cd src
+	GO_FLAGS="" ./make.bash
+	cd ${B}
+}
+
+do_install() {
+	install -d ${D}${libdir}/go/src
+	cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
+	if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
+		rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+		rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
+	fi
+	rm -rf ${D}${libdir}/go/pkg/tool
+	rm -rf ${D}${libdir}/go/pkg/obj
+	rm -rf ${D}${libdir}/go/pkg/bootstrap
+	find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
+		[ "$srcdir" = "./cmd" ] || cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
+	done
+}
+
+# These testdata directories aren't needed for builds and contain binaries
+# that can cause errors in sysroot_strip(), so just remove them.
+sysroot_stage_all_append() {
+	find ${SYSROOT_DESTDIR}${libdir}/go/src -depth -type d -name 'testdata' -exec rm -rf {} \;
+}
+
+ALLOW_EMPTY_${PN} = "1"
+FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include"
+FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE} ${libdir}/go/pkg/${TARGET_GOTUPLE}"
+# The testdata directories in the source tree include some binaries for various
+# architectures, scripts, and .a files
+INSANE_SKIP_${PN}-dev = "staticdev ldflags file-rdeps arch"
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta/recipes-devtools/go/go-runtime_1.8.bb b/meta/recipes-devtools/go/go-runtime_1.8.bb
new file mode 100644
index 0000000000..43b68b4e46
--- /dev/null
+++ b/meta/recipes-devtools/go/go-runtime_1.8.bb
@@ -0,0 +1,2 @@
+require go-${PV}.inc
+require go-runtime.inc
diff --git a/meta/recipes-devtools/go/go.inc b/meta/recipes-devtools/go/go.inc
index 9efbd275bd..5984a60c28 100644
--- a/meta/recipes-devtools/go/go.inc
+++ b/meta/recipes-devtools/go/go.inc
@@ -1,16 +1,5 @@
 inherit goarch
-DEPENDS += "go-native"
-
-# libgcc is required for the target specific libraries to build
-# properly, but apparently not for go-cross and, more importantly,
-# also can't be used there because go-cross cannot depend on
-# the tune-specific libgcc. Otherwise go-cross also would have
-# to be tune-specific.
-DEPENDS += "${@ 'libgcc' if not oe.utils.inherits(d, 'cross') else ''}"
-
-# Prevent runstrip from running because you get errors when the host arch != target arch
-INHIBIT_PACKAGE_STRIP = "1"
-INHIBIT_SYSROOT_STRIP = "1"
+DEPENDS = "virtual/${TARGET_PREFIX}go go-native"
 
 export GOHOSTOS = "${BUILD_GOOS}"
 export GOHOSTARCH = "${BUILD_GOARCH}"
@@ -22,13 +11,11 @@ export GOROOT_FINAL = "${libdir}/go"
 export CGO_ENABLED = "1"
 export CC_FOR_TARGET = "${CC}"
 export CXX_FOR_TARGET = "${CXX}"
+export GO_TARGET_INSTALL = "cmd"
+export GO_FLAGS = "-a"
 
 do_configure[noexec] = "1"
 
-do_compile_prepend_class-cross() {
-	export CGO_ENABLED=0
-}
-
 do_compile() {
 	export GOBIN="${B}/bin"
 	export CC="${@d.getVar('BUILD_CC', True).strip()}"
@@ -39,43 +26,26 @@ do_compile() {
 	mkdir -p ${WORKDIR}/build-tmp
 
 	cd src
-	./make.bash --host-only
-	# Ensure cgo.a is built with the target toolchain
-	export GOBIN="${B}/target/bin"
-	rm -rf ${GOBIN}
-	mkdir -p ${GOBIN}
-	GO_FLAGS="-a" ./make.bash
-}
-
-do_install_class-target() {
-	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}
-	if [ -d ${B}/bin/${GOOS}_${GOARCH} ]
-	then
-		install -m 0755 ${B}/bin/${GOOS}_${GOARCH}/* ${D}${bindir}
-	else
-		install -m 0755 ${B}/bin/* ${D}${bindir}
-	fi
+	./make.bash
+	cd ${B}
 }
 
-do_install_class-cross() {
-	install -d ${D}${libdir}/go
-	cp -a ${B}/pkg ${D}${libdir}/go/
+do_install() {
+	install -d ${D}${libdir}/go/pkg/tool
+	cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
 	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)
+	cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
+	install -d ${D}${libdir}/go/bin
 	install -d ${D}${bindir}
-	for f in ${B}/bin/go*
-	do
-		install -m755 $f ${D}${bindir}
+	for f in ${B}/${GO_BUILD_BINDIR}/*; do
+		name=`basename $f`
+		install -m 0755 $f ${D}${libdir}/go/bin/
+		ln -sf ../${BASELIB}/go/bin/$name ${D}${bindir}/
 	done
 }
-do_package_qa[noexec] = "1"
 
-RDEPENDS_${PN} += "perl"
+PACKAGES = "${PN} ${PN}-dev"
+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"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 18/26] go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGS
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (16 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 17/26] go: split out go-runtime into separate recipe Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 19/26] go.bbclass: remove some xxx_FINAL variables Otavio Salvador
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

These variables are not used anywhere.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 2 --
 1 file changed, 2 deletions(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index b3464d2105..0ff82ca2bb 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -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}"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 19/26] go.bbclass: remove some xxx_FINAL variables
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (17 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 18/26] go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGS Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 20/26] go.bbclass: clean up CGO_xxx settings Otavio Salvador
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

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.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 0ff82ca2bb..c0b117d155 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -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"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 20/26] go.bbclass: clean up CGO_xxx settings
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (18 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 19/26] go.bbclass: remove some xxx_FINAL variables Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 21/26] go: rename go.inc -> go-target.inc Otavio Salvador
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

* 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

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index c0b117d155..8fb41e5c09 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -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/"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 21/26] go: rename go.inc -> go-target.inc
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (19 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 20/26] go.bbclass: clean up CGO_xxx settings Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 22/26] go-cross: take GOARM environment setting Otavio Salvador
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

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

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 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%)

diff --git a/meta/recipes-devtools/go/go.inc b/meta/recipes-devtools/go/go-target.inc
similarity index 100%
rename from meta/recipes-devtools/go/go.inc
rename to meta/recipes-devtools/go/go-target.inc
diff --git a/meta/recipes-devtools/go/go_1.8.bb b/meta/recipes-devtools/go/go_1.8.bb
index ef8bc14383..08ab793f86 100644
--- a/meta/recipes-devtools/go/go_1.8.bb
+++ b/meta/recipes-devtools/go/go_1.8.bb
@@ -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"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 22/26] go-cross: take GOARM environment setting
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (20 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 21/26] go: rename go.inc -> go-target.inc Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 23/26] go: enable nativesdk builds for the toolchain Otavio Salvador
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

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.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/recipes-devtools/go/go-cross.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc
index df3e4ea914..d18d9613ff 100644
--- a/meta/recipes-devtools/go/go-cross.inc
+++ b/meta/recipes-devtools/go/go-cross.inc
@@ -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
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 23/26] go: enable nativesdk builds for the toolchain
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (21 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 22/26] go-cross: take GOARM environment setting Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 24/26] go-crosssdk: add recipe Otavio Salvador
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

All that's needed is setting BBCLASSEXTEND.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/recipes-devtools/go/go-target.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-devtools/go/go-target.inc b/meta/recipes-devtools/go/go-target.inc
index 5984a60c28..0d80bf0d97 100644
--- a/meta/recipes-devtools/go/go-target.inc
+++ b/meta/recipes-devtools/go/go-target.inc
@@ -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"
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 24/26] go-crosssdk: add recipe
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (22 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 23/26] go: enable nativesdk builds for the toolchain Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 25/26] go.bbclass: enable nativesdk builds for Go packages Otavio Salvador
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

Enable crosssdk builds for the Go toolchain.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 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

diff --git a/meta/recipes-devtools/go/go-crosssdk.inc b/meta/recipes-devtools/go/go-crosssdk.inc
new file mode 100644
index 0000000000..e9bc677131
--- /dev/null
+++ b/meta/recipes-devtools/go/go-crosssdk.inc
@@ -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"
diff --git a/meta/recipes-devtools/go/go-crosssdk_1.8.bb b/meta/recipes-devtools/go/go-crosssdk_1.8.bb
new file mode 100644
index 0000000000..1857c8a577
--- /dev/null
+++ b/meta/recipes-devtools/go/go-crosssdk_1.8.bb
@@ -0,0 +1,2 @@
+require go-crosssdk.inc
+require go-${PV}.inc
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 25/26] go.bbclass: enable nativesdk builds for Go packages
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (23 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 24/26] go-crosssdk: add recipe Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 12:45 ` [PATCH v5 26/26] go-cross-canadian: add recipe Otavio Salvador
  2017-09-11 13:00 ` ✗ patchtest: failure for Revamp the Go support (rev6) Patchwork
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

Adding the necessary overrides for nativesdk builds.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/classes/go.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 8fb41e5c09..8d363e86a2 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -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}"
 
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH v5 26/26] go-cross-canadian: add recipe
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (24 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 25/26] go.bbclass: enable nativesdk builds for Go packages Otavio Salvador
@ 2017-09-11 12:45 ` Otavio Salvador
  2017-09-11 13:00 ` ✗ patchtest: failure for Revamp the Go support (rev6) Patchwork
  26 siblings, 0 replies; 30+ messages in thread
From: Otavio Salvador @ 2017-09-11 12:45 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List; +Cc: Will Newton, Otavio Salvador

From: Matt Madison <matt@madison.systems>

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.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6:
- new patch

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 meta/recipes-devtools/go/go-1.8.inc                |  1 +
 .../go/go-1.8/set-gotooldir-during-bootstrap.patch | 17 ++++++
 meta/recipes-devtools/go/go-cross-canadian.inc     | 64 ++++++++++++++++++++++
 meta/recipes-devtools/go/go-cross-canadian_1.8.bb  |  2 +
 4 files changed, 84 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

diff --git a/meta/recipes-devtools/go/go-1.8.inc b/meta/recipes-devtools/go/go-1.8.inc
index 2920d06f60..141c0994c3 100644
--- a/meta/recipes-devtools/go/go-1.8.inc
+++ b/meta/recipes-devtools/go/go-1.8.inc
@@ -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"
diff --git a/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch b/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch
new file mode 100644
index 0000000000..82718f923b
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch
@@ -0,0 +1,17 @@
+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
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc
new file mode 100644
index 0000000000..f0315d558a
--- /dev/null
+++ b/meta/recipes-devtools/go/go-cross-canadian.inc
@@ -0,0 +1,64 @@
+inherit cross-canadian
+
+DEPENDS = "go-native virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc virtual/nativesdk-${HOST_PREFIX}compilerlibs"
+PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+export GOHOSTOS = "${BUILD_GOOS}"
+export GOHOSTARCH = "${BUILD_GOARCH}"
+export GOOS = "${HOST_GOOS}"
+export GOARCH = "${HOST_GOARCH}"
+export GOARM = "${HOST_GOARM}"
+export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
+export GOTOOLDIR_BOOTSTRAP = "${GOROOT_BOOTSTRAP}/pkg/tool/${BUILD_GOTUPLE}"
+export GOROOT_FINAL = "${libdir}/go"
+export CGO_ENABLED = "1"
+export CC_FOR_TARGET = "${HOST_CC}"
+export CXX_FOR_TARGET = "${HOST_CXX}"
+CC = "${@d.getVar('BUILD_CC', True).strip()}"
+export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "${TOOLCHAIN_OPTIONS} ${LDFLAGS}"'
+
+do_configure[noexec] = "1"
+
+do_compile() {
+	export GOBIN="${B}/bin"
+	rm -rf ${GOBIN} ${B}/pkg
+	mkdir ${GOBIN}
+	cd src
+	./make.bash --host-only --no-banner
+	cd ${B}
+}
+
+
+make_wrapper() {
+    rm -f ${D}${bindir}/$2
+    cat <<END >${D}${bindir}/$2
+#!/bin/bash
+here=\`dirname \$0\`
+native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\`
+export GOARCH="${TARGET_GOARCH}"
+export GOOS="${TARGET_GOOS}"
+export GOARM="\${GOARM:-${TARGET_GOARM}}"
+export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}"
+export GOROOT="\${GOROOT:-\$OECORE_TARGET_SYSROOT/${target_libdir}/go}"
+\$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@"
+END
+    chmod +x ${D}${bindir}/$2
+}
+
+do_install() {
+	install -d ${D}${libdir}/go
+	cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
+	install -d ${D}${libdir}/go/src
+	(cd ${S}/src; for d in *; do \
+		[ -d $d ] && cp --preserve=mode,timestamps -R ${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 ${TARGET_PREFIX}$base
+	done
+}
+
+FILES_${PN}-staticdev = "${libdir}/go/pkg"
diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.8.bb b/meta/recipes-devtools/go/go-cross-canadian_1.8.bb
new file mode 100644
index 0000000000..7ac9449e47
--- /dev/null
+++ b/meta/recipes-devtools/go/go-cross-canadian_1.8.bb
@@ -0,0 +1,2 @@
+require go-cross-canadian.inc
+require go-${PV}.inc
-- 
2.14.1



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* ✗ patchtest: failure for Revamp the Go support (rev6)
  2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
                   ` (25 preceding siblings ...)
  2017-09-11 12:45 ` [PATCH v5 26/26] go-cross-canadian: add recipe Otavio Salvador
@ 2017-09-11 13:00 ` Patchwork
  26 siblings, 0 replies; 30+ messages in thread
From: Patchwork @ 2017-09-11 13:00 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: openembedded-core

== Series Details ==

Series: Revamp the Go support (rev6)
Revision: 6
URL   : https://patchwork.openembedded.org/series/8697/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Added patch file is missing Upstream-Status in the header [test_upstream_status_presence] 
  Suggested fix    Add Upstream-Status: <status> to the header of meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch (possible values: Pending, Submitted, Accepted, Backport, Denied, Inappropriate)

* Issue             A patch file has been added, but does not have a Signed-off-by tag [test_signed_off_by_presence] 
  Suggested fix    Sign off the added patch file (meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v5 04/26] goarch.bbclass: Replace logic for setting GOARM
  2017-09-11 12:45 ` [PATCH v5 04/26] goarch.bbclass: Replace logic for setting GOARM Otavio Salvador
@ 2017-09-18 13:26   ` Will Newton
  2017-09-18 13:30     ` Alexander Kanavin
  0 siblings, 1 reply; 30+ messages in thread
From: Will Newton @ 2017-09-18 13:26 UTC (permalink / raw)
  To: Armin Kuster; +Cc: OpenEmbedded Core Mailing List

Hi Armin,

Would it be possible to get this patch backported to the Pyro branch?

It fixes running Go programs on Raspberry Pi 1 systems which without
this will die with illegal instruction errors.

Thanks,


On Mon, Sep 11, 2017 at 1:45 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> From: Will Newton <will.newton@gmail.com>
>
> The previous logic applied a regex to TUNE_FEATURES which could
> set the GOARM value to 7 incorrectly, for example when dealing
> with an arm1176 core. Simplify to check for the presence of
> "armv7" instead. At the same time add a check for "armv6" and
> set GOARM to 6 in that case.
>
> Signed-off-by: Will Newton <willn@resin.io>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>
> Changes in v6: None
> Changes in v5: None
> Changes in v4:
> - new patch to consolidade in a single patchset all golang changes
>
> Changes in v3: None
> Changes in v2: None
>
>  meta/classes/goarch.bbclass | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
> index 7960ac5f9e..0f0d8b6a60 100644
> --- a/meta/classes/goarch.bbclass
> +++ b/meta/classes/goarch.bbclass
> @@ -45,8 +45,11 @@ def go_map_arch(a, d):
>
>  def go_map_arm(a, f, d):
>      import re
> -    if re.match('arm.*', a) and re.match('arm.*7.*', f):
> -        return '7'
> +    if re.match('arm.*', a):
> +        if 'armv7' in f:
> +            return '7'
> +        elif 'armv6' in f:
> +            return '6'
>      return ''
>
>  def go_map_os(o, d):
> --
> 2.14.1
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v5 04/26] goarch.bbclass: Replace logic for setting GOARM
  2017-09-18 13:26   ` Will Newton
@ 2017-09-18 13:30     ` Alexander Kanavin
  0 siblings, 0 replies; 30+ messages in thread
From: Alexander Kanavin @ 2017-09-18 13:30 UTC (permalink / raw)
  To: Will Newton, Armin Kuster; +Cc: OpenEmbedded Core Mailing List

On 09/18/2017 04:26 PM, Will Newton wrote:
> Would it be possible to get this patch backported to the Pyro branch?
> 
> It fixes running Go programs on Raspberry Pi 1 systems which without
> this will die with illegal instruction errors.

Just do the backport and submit it to this list with [pyro] prefix.


Alex


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2017-09-18 13:34 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 12:45 [PATCH v5 00/26] Revamp the Go support Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 01/26] goarch.bbclass: Stop passing True as second argument of d.getVar Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 02/26] go.bbclass: Fix binary installation path detection Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 03/26] go: Remove Go 1.6 and 1.7 releases Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 04/26] goarch.bbclass: Replace logic for setting GOARM Otavio Salvador
2017-09-18 13:26   ` Will Newton
2017-09-18 13:30     ` Alexander Kanavin
2017-09-11 12:45 ` [PATCH v5 05/26] goarch.bbclass: Add support for ARMv5 Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 06/26] go.bbclass: Use a global Go build flags Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 07/26] go.bbclass: Enable parallel build Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 08/26] go.bbclass: exported function cleanup Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 09/26] go.bbclass: Use an auxiliary variable to add the build dependencies Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 10/26] go.bbclass: separate ${S} and ${B} Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 11/26] go.bbclass: add do_unpack function to handle common cases Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 12/26] go.bbclass: add GO_INSTALL_FILTEROUT variable Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 13/26] go-dep: Add 0.3.0 release Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 14/26] go-helloworld: Use the Golang examples repository Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 15/26] go-native: remove dependency on go-bootstrap-native Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 16/26] go-bootstrap-native: remove recipe Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 17/26] go: split out go-runtime into separate recipe Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 18/26] go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGS Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 19/26] go.bbclass: remove some xxx_FINAL variables Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 20/26] go.bbclass: clean up CGO_xxx settings Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 21/26] go: rename go.inc -> go-target.inc Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 22/26] go-cross: take GOARM environment setting Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 23/26] go: enable nativesdk builds for the toolchain Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 24/26] go-crosssdk: add recipe Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 25/26] go.bbclass: enable nativesdk builds for Go packages Otavio Salvador
2017-09-11 12:45 ` [PATCH v5 26/26] go-cross-canadian: add recipe Otavio Salvador
2017-09-11 13:00 ` ✗ patchtest: failure for Revamp the Go support (rev6) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.