Skip to contentSkip to conversation

Add golang basic infrastructure

PATCH Superseded Khem Raj 2 participants 6 messages Feb 25, 2017 – Feb 27, 2017

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover Add golang basic infrastructure

This patchset adds go to core, the bits has been fused from oe-meta-go and meta-virtualtization layers with additional changes needed for it to fit into oe-core

The following changes since commit 65cfc8aca3ff7e39453977a0215a350d13cb85ef:

libva: Find the correct wayland-scanner (2017-02-23 12:29:21 -0800)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib kraj/go
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=kraj/go

Khem Raj (4):
go: Add recipes for golang compilers and tools
go-examples: Add an example, helloworld written in go
go: Fix go cross build with rss
go: Use CC for CC_FOR_TARGET and CXX for CXX_FOR_TARGET

 meta/classes/go.bbclass                            |  74 +++++++
 meta/classes/goarch.bbclass                        |  46 +++++
 meta/recipes-devtools/go/go-1.4.inc                |  15 ++
 .../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             |  21 ++
 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                    |  76 +++++++
 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               |  15 ++
 31 files changed, 1182 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/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
Signature · 1 line
2.11.1
author
#1 lore raw

PATCH 1/4 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

---
 meta/classes/go.bbclass                            |  74 +++++++
 meta/classes/goarch.bbclass                        |  46 +++++
 meta/recipes-devtools/go/go-1.4.inc                |  15 ++
 .../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             |  21 ++
 meta/recipes-devtools/go/go-native.inc             |  54 +++++
 meta/recipes-devtools/go/go-native_1.4.bb          |   2 +
 meta/recipes-devtools/go/go.inc                    |  76 +++++++
 meta/recipes-devtools/go/go_1.6.bb                 |   4 +
 meta/recipes-devtools/go/go_1.7.bb                 |   4 +
 26 files changed, 1134 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/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-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
meta/classes/go.bbclass new file +74 -0
new file mode 100644
index 0000000000..e10864d99b
@@ -0,0 +1,74 @@
+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"
+DEPENDS_class-native += "go-native"
+
+INHIBIT_PACKAGE_STRIP = "1"
+
+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 +15 -0
new file mode 100644
index 0000000000..a65459fcef
@@ -0,0 +1,15 @@
+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 \
+"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
+SRC_URI[md5sum] = "dfb604511115dd402a77a553a5923a04"
+SRC_URI[sha256sum] = "9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959"
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 +21 -0
new file mode 100644
index 0000000000..8897cb1157
@@ -0,0 +1,21 @@
+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"
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 +76 -0

76 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 +4 -0
new file mode 100644
index 0000000000..8186427933
@@ -0,0 +1,4 @@
+require go-${PV}.inc
+require go.inc
+
+BBCLASSEXTEND = "cross"
Signature · 1 line
2.11.1
#2 lore raw

Re: [PATCH 1/4] go: Add recipes for golang compilers and tools

Quoted 3 lines · Khem Raj

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

ERROR: go-cross-x86_64-1.7.4-r0 do_compile: Function failed: do_compile
(log file is located at /data/poky-master/tmp/work/x86_64-linux/go-cross-x86_64/1.7.4-r0/temp/log.do_compile.21270)
ERROR: Logfile of failure stored in:
/data/poky-master/tmp/work/x86_64-linux/go-cross-x86_64/1.7.4-r0/temp/log.do_compile.21270 Log data follows:

| DEBUG: Executing shell function do_compile
| ##### Building Go bootstrap tool.
| cmd/dist
| #

_/data/poky-master/tmp/work/x86_64-linux/go-cross-x86_64/1.7.4-r0/go/src/cmd/dist
| /data/poky-master/tmp/work/x86_64-linux/go-cross-x86_64/1.7.4-r0/recipe-sysroot-native/usr/lib/go/pkg/tool/linux_amd64/6l:
readsym out of sync

Also, can you squash the fixing up patches so we just have a single commit that actually works.

Ross

author
#3 lore raw

PATCH 2/4 go-examples: Add an example, helloworld written in go

In reply to Khem Raj

This should serve as temlate for writing go recipes

---
 meta/recipes-extended/go-examples/files/helloworld.go  | 10 ++++++++++
 meta/recipes-extended/go-examples/go-examples.inc      | 10 ++++++++++
 meta/recipes-extended/go-examples/go-helloworld_0.1.bb | 15 +++++++++++++++
 3 files changed, 35 insertions(+)
 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/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 +15 -0
new file mode 100644
index 0000000000..af9d3b7454
@@ -0,0 +1,15 @@
+require go-examples.inc
+
+
+SRC_URI += " \
+  file://helloworld.go \
+"
+
+do_compile() {
+  go build helloworld.go
+}
+
+do_install() {
+  install -d "${D}/${bindir}"
+  install -m 0755 "${S}/helloworld" "${D}/${bindir}"
+}
Signature · 1 line
2.11.1
author
#4 lore raw

PATCH 3/4 go: Fix go cross build with rss

In reply to Khem Raj

recipe specific sysroot demanded changes how cross go compiler was built rename PN to include ARCH_NAME for cross recipe

---
 meta/classes/go.bbclass                  |  2 +-
 meta/recipes-devtools/go/go-cross.inc    | 10 ++++++++++
 meta/recipes-devtools/go/go-cross_1.7.bb |  5 +++++
 meta/recipes-devtools/go/go_1.7.bb       |  2 --
 4 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-devtools/go/go-cross.inc
 create mode 100644 meta/recipes-devtools/go/go-cross_1.7.bb
meta/classes/go.bbclass +1 -1
index e10864d99b..293194d39a 100644
@@ -21,7 +21,7 @@ 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"
+DEPENDS += "go-cross-${TARGET_ARCH}"
 DEPENDS_class-native += "go-native"
 
 INHIBIT_PACKAGE_STRIP = "1"
meta/recipes-devtools/go/go-cross.inc new file +10 -0
new file mode 100644
index 0000000000..fa9c339b93
@@ -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_1.7.bb +0 -2
index 8186427933..e7a6ab277e 100644
@@ -1,4 +1,2 @@
 require go-${PV}.inc
 require go.inc
-
-BBCLASSEXTEND = "cross"
Signature · 1 line
2.11.1
author
#5 lore raw

PATCH 4/4 go: Use CC for CC_FOR_TARGET and CXX for CXX_FOR_TARGET

In reply to Khem Raj

Helps building with clang

---
 meta/recipes-devtools/go/go.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/go/go.inc +2 -2
index 2449936dab..754fa34c1b 100644
@@ -13,8 +13,8 @@ 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}"
+export CC_FOR_TARGET = "${CC}"
+export CXX_FOR_TARGET = "${CXX}"
 
 do_configure[noexec] = "1"
 
Signature · 1 line
2.11.1