Skip to contentSkip to conversation

go: Add recipes for golang compilers and tools

PATCH Superseded Khem Raj 2 participants 3 messages Mar 6, 2017

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v7 1/1 go: Add recipes for golang compilers and tools

* This is converging the recipes for go from
meta-virtualization and oe-meta-go

* Add recipes for go 1.7

* go.bbclass is added to ease out writing
recipes for go packages

* go-examples: Add an example, helloworld written in go This should serve as temlate for writing go recipes

---
v4 -> v7
- Add missing SOB and Upstream-Status to patches

 meta/classes/go.bbclass                            |  72 +++++++
 meta/classes/goarch.bbclass                        |  46 +++++
 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-common.inc             |  22 ++
 meta/recipes-devtools/go/go-cross.inc              |  10 +
 meta/recipes-devtools/go/go-cross_1.7.bb           |   5 +
 meta/recipes-devtools/go/go-native.inc             |  54 +++++
 meta/recipes-devtools/go/go-native_1.4.bb          |   2 +
 meta/recipes-devtools/go/go.inc                    |  80 ++++++++
 meta/recipes-devtools/go/go_1.6.bb                 |   4 +
 meta/recipes-devtools/go/go_1.7.bb                 |   2 +
 .../go-examples/files/helloworld.go                |  10 +
 meta/recipes-extended/go-examples/go-examples.inc  |  10 +
 .../go-examples/go-helloworld_0.1.bb               |  13 ++
 32 files changed, 1217 insertions(+)
 create mode 100644 meta/classes/go.bbclass
 create mode 100644 meta/classes/goarch.bbclass
 create mode 100644 meta/recipes-devtools/go/go-1.4.inc
 create mode 100644 meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch
 create mode 100644 meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch
 create mode 100644 meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch
 create mode 100644 meta/recipes-devtools/go/go-1.4/syslog.patch
 create mode 100644 meta/recipes-devtools/go/go-1.6.inc
 create mode 100644 meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
 create mode 100644 meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
 create mode 100644 meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
 create mode 100644 meta/recipes-devtools/go/go-1.6/gotooldir.patch
 create mode 100644 meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
 create mode 100644 meta/recipes-devtools/go/go-1.6/syslog.patch
 create mode 100644 meta/recipes-devtools/go/go-1.7.inc
 create mode 100644 meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch
 create mode 100644 meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch
 create mode 100644 meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch
 create mode 100644 meta/recipes-devtools/go/go-1.7/gotooldir.patch
 create mode 100644 meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch
 create mode 100644 meta/recipes-devtools/go/go-1.7/syslog.patch
 create mode 100644 meta/recipes-devtools/go/go-common.inc
 create mode 100644 meta/recipes-devtools/go/go-cross.inc
 create mode 100644 meta/recipes-devtools/go/go-cross_1.7.bb
 create mode 100644 meta/recipes-devtools/go/go-native.inc
 create mode 100644 meta/recipes-devtools/go/go-native_1.4.bb
 create mode 100644 meta/recipes-devtools/go/go.inc
 create mode 100644 meta/recipes-devtools/go/go_1.6.bb
 create mode 100644 meta/recipes-devtools/go/go_1.7.bb
 create mode 100644 meta/recipes-extended/go-examples/files/helloworld.go
 create mode 100644 meta/recipes-extended/go-examples/go-examples.inc
 create mode 100644 meta/recipes-extended/go-examples/go-helloworld_0.1.bb
meta/classes/go.bbclass new file +72 -0
new file mode 100644
index 0000000000..e6ea996e9d
@@ -0,0 +1,72 @@
+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}"
+
+export GOOS = "${TARGET_GOOS}"
+export GOARCH = "${TARGET_GOARCH}"
+export GOARM = "${TARGET_GOARM}"
+export CGO_ENABLED = "1"
+export GOROOT
+export GOROOT_FINAL = "${libdir}/${TARGET_SYS}/go"
+export GOBIN_FINAL
+export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${GOOS}_${GOARCH}"
+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}"
+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}*"
+
+GO_INSTALL ?= "${GO_IMPORT}/..."
+
+do_go_compile() {
+	GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env
+	if test -n "${GO_INSTALL}" ; then
+		GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install -v ${GO_INSTALL}
+	fi
+}
+
+do_go_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 test -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
+	fi
+}
+
+do_compile() {
+	do_go_compile
+}
+
+do_install() {
+	do_go_install
+}
meta/classes/goarch.bbclass new file +46 -0

46 lines not on this page · raw message

meta/recipes-devtools/go/go-1.4.inc new file +16 -0
new file mode 100644
index 0000000000..2f500f32b9
@@ -0,0 +1,16 @@
+require go-common.inc
+
+PV = "1.4.3"
+GO_BASEVERSION = "1.4"
+FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
+
+SRC_URI += "\
+        file://016-armhf-elf-header.patch \
+        file://go-cross-backport-cmd-link-support-new-386-amd64-rel.patch \
+        file://syslog.patch \
+        file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \
+"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
+SRC_URI[md5sum] = "dfb604511115dd402a77a553a5923a04"
+SRC_URI[sha256sum] = "9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959"
meta/recipes-devtools/go/go-1.4/0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch new file +33 -0
new file mode 100644
index 0000000000..f2adc200b1
@@ -0,0 +1,33 @@
+From 855145d5c03c4b4faf60736c38d7a299c682af4a Mon Sep 17 00:00:00 2001
+From: Shenghou Ma <[email protected]>
+Date: Sat, 7 Feb 2015 14:06:02 -0500
+Subject: [PATCH] cmd/ld: set alignment for the .rel.plt section on 32-bit
+ architectures
+
+Fixes #9802.
+
+Change-Id: I22c52a37bdb23a14cc4615c9519431bb14ca81ca
+Reviewed-on: https://go-review.googlesource.com/4170
+Reviewed-by: Ian Lance Taylor <[email protected]>
+---
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <[email protected]>
+
+ src/cmd/ld/elf.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c
+index 12ced98..97ed4bd 100644
+--- a/src/cmd/ld/elf.c
++++ b/src/cmd/ld/elf.c
+@@ -1363,6 +1363,7 @@ asmbelf(vlong symo)
+ 			sh->type = SHT_REL;
+ 			sh->flags = SHF_ALLOC;
+ 			sh->entsize = ELF32RELSIZE;
++			sh->addralign = 4;
+ 			sh->link = elfshname(".dynsym")->shnum;
+ 			shsym(sh, linklookup(ctxt, ".rel.plt", 0));
+ 
+-- 
+1.9.1
+
meta/recipes-devtools/go/go-1.4/016-armhf-elf-header.patch new file +24 -0
new file mode 100644
index 0000000000..e6e414e52f
@@ -0,0 +1,24 @@
+Description: Use correct ELF header for armhf binaries.
+Author: Adam Conrad <[email protected]>
+Last-Update: 2013-07-08
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+
+Index: go/src/cmd/ld/elf.c
+===================================================================
+--- go.orig/src/cmd/ld/elf.c	2015-02-20 10:49:58.763451586 -0800
++++ go/src/cmd/ld/elf.c	2015-02-20 10:49:27.895478521 -0800
+@@ -57,7 +57,11 @@
+ 	case '5':
+ 		// we use EABI on both linux/arm and freebsd/arm.
+ 		if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)
+-			hdr.flags = 0x5000002; // has entry point, Version5 EABI
++#ifdef __ARM_PCS_VFP
++			hdr.flags = 0x5000402; // has entry point, Version5 EABI, hard-float ABI
++#else
++			hdr.flags = 0x5000202; // has entry point, Version5 EABI, soft-float ABI
++#endif
+ 		// fallthrough
+ 	default:
+ 		hdr.phoff = ELF32HDRSIZE;	/* Must be be ELF32HDRSIZE: first PHdr must follow ELF header */
meta/recipes-devtools/go/go-1.4/go-cross-backport-cmd-link-support-new-386-amd64-rel.patch new file +225 -0

225 lines not on this page · raw message

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

62 lines not on this page · raw message

meta/recipes-devtools/go/go-1.6.inc new file +19 -0
new file mode 100644
index 0000000000..769c1d8f22
@@ -0,0 +1,19 @@
+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"
+
meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch new file +23 -0
new file mode 100644
index 0000000000..1e3a16b319
@@ -0,0 +1,23 @@
+Encode arm EABI ( hard/soft ) calling convention in ELF header
+
+Signed-off-by: Khem Raj <[email protected]>
+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
meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch new file +50 -0

50 lines not on this page · raw message

meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch new file +17 -0
new file mode 100644
index 0000000000..2f6156ecd2
@@ -0,0 +1,17 @@
+Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
+
+Signed-off-by: Khem Raj <[email protected]>
+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
meta/recipes-devtools/go/go-1.6/gotooldir.patch new file +30 -0
new file mode 100644
index 0000000000..94670259f2
@@ -0,0 +1,30 @@
+Define tooldir in relation to GOTOOLDIR env var
+
+Signed-off-by: Khem Raj <[email protected]>
+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)
meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch new file +63 -0

63 lines not on this page · raw message

meta/recipes-devtools/go/go-1.6/syslog.patch new file +62 -0

62 lines not on this page · raw message

meta/recipes-devtools/go/go-1.7.inc new file +19 -0
new file mode 100644
index 0000000000..5c3004e875
@@ -0,0 +1,19 @@
+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"
+
meta/recipes-devtools/go/go-1.7/armhf-elf-header.patch new file +23 -0
new file mode 100644
index 0000000000..1e3a16b319
@@ -0,0 +1,23 @@
+Encode arm EABI ( hard/soft ) calling convention in ELF header
+
+Signed-off-by: Khem Raj <[email protected]>
+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
meta/recipes-devtools/go/go-1.7/fix-cc-handling.patch new file +50 -0

50 lines not on this page · raw message

meta/recipes-devtools/go/go-1.7/fix-target-cc-for-build.patch new file +17 -0
new file mode 100644
index 0000000000..2f6156ecd2
@@ -0,0 +1,17 @@
+Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
+
+Signed-off-by: Khem Raj <[email protected]>
+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
meta/recipes-devtools/go/go-1.7/gotooldir.patch new file +30 -0
new file mode 100644
index 0000000000..94670259f2
@@ -0,0 +1,30 @@
+Define tooldir in relation to GOTOOLDIR env var
+
+Signed-off-by: Khem Raj <[email protected]>
+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)
meta/recipes-devtools/go/go-1.7/split-host-and-target-build.patch new file +62 -0

62 lines not on this page · raw message

meta/recipes-devtools/go/go-1.7/syslog.patch new file +62 -0

62 lines not on this page · raw message

meta/recipes-devtools/go/go-common.inc new file +22 -0
new file mode 100644
index 0000000000..f74b8b7650
@@ -0,0 +1,22 @@
+SUMMARY = "Go programming language compiler"
+DESCRIPTION = " The Go programming language is an open source project to make \
+ programmers more productive. Go is expressive, concise, clean, and\
+ efficient. Its concurrency mechanisms make it easy to write programs\
+ that get the most out of multicore and networked machines, while its\
+ novel type system enables flexible and modular program construction.\
+ Go compiles quickly to machine code yet has the convenience of\
+ garbage collection and the power of run-time reflection. It's a\
+ fast, statically typed, compiled language that feels like a\
+ dynamically typed, interpreted language."
+
+HOMEPAGE = " http://golang.org/"
+LICENSE = "BSD-3-Clause"
+
+inherit goarch
+
+SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz"
+S = "${WORKDIR}/go"
+B = "${S}"
+
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+SSTATE_SCAN_CMD = "true"
meta/recipes-devtools/go/go-cross.inc new file +10 -0
new file mode 100644
index 0000000000..a6b31c804f
@@ -0,0 +1,10 @@
+inherit cross
+
+DEPENDS += "gcc-cross-${TARGET_ARCH}"
+
+PN = "go-cross-${TARGET_ARCH}"
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:"
+
+GOROOT_FINAL = "${libdir}/go"
+export GOROOT_FINAL
meta/recipes-devtools/go/go-cross_1.7.bb new file +5 -0
new file mode 100644
index 0000000000..56ee084b10
@@ -0,0 +1,5 @@
+require go-cross.inc
+require go_${PV}.bb
+
+# Go binaries are not understood by the strip tool.
+INHIBIT_SYSROOT_STRIP = "1"
meta/recipes-devtools/go/go-native.inc new file +54 -0

54 lines not on this page · raw message

meta/recipes-devtools/go/go-native_1.4.bb new file +2 -0
new file mode 100644
index 0000000000..bbf3c0dd73
@@ -0,0 +1,2 @@
+require ${PN}.inc
+require go-${PV}.inc
meta/recipes-devtools/go/go.inc new file +80 -0

80 lines not on this page · raw message

meta/recipes-devtools/go/go_1.6.bb new file +4 -0
new file mode 100644
index 0000000000..2f590338c4
@@ -0,0 +1,4 @@
+require go.inc
+require go-${PV}.inc
+
+BBCLASSEXTEND = "cross"
meta/recipes-devtools/go/go_1.7.bb new file +2 -0
new file mode 100644
index 0000000000..e7a6ab277e
@@ -0,0 +1,2 @@
+require go-${PV}.inc
+require go.inc
meta/recipes-extended/go-examples/files/helloworld.go new file +10 -0
new file mode 100644
index 0000000000..0253c40411
@@ -0,0 +1,10 @@
+// You can edit this code!
+// Click here and start typing.
+// taken from https://golang.org/
+package main
+
+import "fmt"
+
+func main() {
+	fmt.Println("Hello, 世界")
+}
meta/recipes-extended/go-examples/go-examples.inc new file +10 -0
new file mode 100644
index 0000000000..c63268116b
@@ -0,0 +1,10 @@
+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
meta/recipes-extended/go-examples/go-helloworld_0.1.bb new file +13 -0
new file mode 100644
index 0000000000..930c57df95
@@ -0,0 +1,13 @@
+require go-examples.inc
+
+SRC_URI += " \
+  file://helloworld.go \
+"
+
+do_compile() {
+	go build helloworld.go
+}
+
+do_install() {
+	install -D -m 0755 ${S}/helloworld ${D}${bindir}/helloworld
+}
Signature · 1 line
2.12.0
#1 lore raw
Quoted 3 lines · Khem Raj

* This is converging the recipes for go from
meta-virtualization and oe-meta-go

In master-next, Richard has a patch to disable Go on musl. Can you incorporate that too (or fix Go)?

In mut I've picked his musl fix on top on v7 for testing.

Ross

author
#2 lore raw
Quoted 9 lines · Ross
Quoted 3 lines · Khem Raj

* This is converging the recipes for go from
meta-virtualization and oe-meta-go

In master-next, Richard has a patch to disable Go on musl. Can you incorporate that too (or fix Go)?

Which arch is it failing for on musl ? I know I had issues with clang/musl for go but I thought it was more related to clang then musl

I have seen Richard's patch. its ok for now.

Quoted 4 lines

In mut I've picked his musl fix on top on v7 for testing.

Ross