summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.6
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-03-07 22:40:22 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-10 15:51:55 +0000
commit760e81678cec80dcdaab12c2a0a0148e3e0ba275 (patch)
tree6b587a2e9bd13c68788c1ff20df54db7e2f38c53 /meta/recipes-devtools/go/go-1.6
parent0efe58df2e5389f86dfbd53f90afc8f2970def7d (diff)
downloadpoky-760e81678cec80dcdaab12c2a0a0148e3e0ba275.tar.gz
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 * Disable for musl, at least for now * Disable for x32/ppc32 which is not supported (From OE-Core rev: 78615e9260fb5d6569de4883521b049717fa4340) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go/go-1.6')
-rw-r--r--meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch23
-rw-r--r--meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch50
-rw-r--r--meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch17
-rw-r--r--meta/recipes-devtools/go/go-1.6/gotooldir.patch30
-rw-r--r--meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch63
-rw-r--r--meta/recipes-devtools/go/go-1.6/syslog.patch62
6 files changed, 245 insertions, 0 deletions
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
new file mode 100644
index 0000000000..1e3a16b319
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/armhf-elf-header.patch
@@ -0,0 +1,23 @@
1Encode arm EABI ( hard/soft ) calling convention in ELF header
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/link/internal/ld/elf.go
6===================================================================
7--- go.orig/src/cmd/link/internal/ld/elf.go
8+++ go/src/cmd/link/internal/ld/elf.go
9@@ -827,7 +827,13 @@
10 // 32-bit architectures
11 case '5':
12 // we use EABI on both linux/arm and freebsd/arm.
13- if HEADTYPE == obj.Hlinux || HEADTYPE == obj.Hfreebsd {
14+ if HEADTYPE == obj.Hlinux {
15+ if Ctxt.Goarm == 7 {
16+ ehdr.flags = 0x5000402 // has entry point, Version5 EABI, hard float
17+ } else {
18+ ehdr.flags = 0x5000202 // has entry point, Version5 EABI, soft float
19+ }
20+ } else if HEADTYPE == obj.Hfreebsd {
21 // We set a value here that makes no indication of which
22 // float ABI the object uses, because this is information
23 // 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
new file mode 100644
index 0000000000..983323ace9
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/fix-cc-handling.patch
@@ -0,0 +1,50 @@
1Accept CC with multiple words in its name
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/go/build.go
6===================================================================
7--- go.orig/src/cmd/go/build.go 2015-07-29 14:48:40.323185807 -0700
8+++ go/src/cmd/go/build.go 2015-07-30 07:37:40.529818586 -0700
9@@ -2805,12 +2805,24 @@
10 return b.ccompilerCmd("CC", defaultCC, objdir)
11 }
12
13+// gccCmd returns a gcc command line prefix
14+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
15+func (b *builder) gccCmdForReal() []string {
16+ return envList("CC", defaultCC)
17+}
18+
19 // gxxCmd returns a g++ command line prefix
20 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
21 func (b *builder) gxxCmd(objdir string) []string {
22 return b.ccompilerCmd("CXX", defaultCXX, objdir)
23 }
24
25+// gxxCmd returns a g++ command line prefix
26+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
27+func (b *builder) gxxCmdForReal() []string {
28+ return envList("CXX", defaultCXX)
29+}
30+
31 // ccompilerCmd returns a command line prefix for the given environment
32 // variable and using the default command when the variable is empty.
33 func (b *builder) ccompilerCmd(envvar, defcmd, objdir string) []string {
34Index: go/src/cmd/go/env.go
35===================================================================
36--- go.orig/src/cmd/go/env.go 2015-07-29 14:48:40.323185807 -0700
37+++ go/src/cmd/go/env.go 2015-07-30 07:40:54.461655721 -0700
38@@ -52,10 +52,9 @@
39
40 if goos != "plan9" {
41 cmd := b.gccCmd(".")
42- env = append(env, envVar{"CC", cmd[0]})
43+ env = append(env, envVar{"CC", strings.Join(b.gccCmdForReal(), " ")})
44 env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
45- cmd = b.gxxCmd(".")
46- env = append(env, envVar{"CXX", cmd[0]})
47+ env = append(env, envVar{"CXX", strings.Join(b.gxxCmdForReal(), " ")})
48 }
49
50 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
new file mode 100644
index 0000000000..2f6156ecd2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/fix-target-cc-for-build.patch
@@ -0,0 +1,17 @@
1Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/make.bash
6===================================================================
7--- go.orig/src/make.bash 2015-07-29 13:28:11.334031696 -0700
8+++ go/src/make.bash 2015-07-29 13:36:55.814465630 -0700
9@@ -158,7 +158,7 @@
10 fi
11
12 echo "##### Building packages and commands for $GOOS/$GOARCH."
13-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
14+CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
15 echo
16
17 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
new file mode 100644
index 0000000000..94670259f2
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/gotooldir.patch
@@ -0,0 +1,30 @@
1Define tooldir in relation to GOTOOLDIR env var
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/go/build/build.go
6===================================================================
7--- go.orig/src/go/build/build.go
8+++ go/src/go/build/build.go
9@@ -1388,7 +1388,7 @@ func init() {
10 }
11
12 // ToolDir is the directory containing build tools.
13-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
14+var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH))
15
16 // IsLocalImport reports whether the import path is
17 // a local import path, like ".", "..", "./foo", or "../foo".
18Index: go/src/cmd/go/build.go
19===================================================================
20--- go.orig/src/cmd/go/build.go
21+++ go/src/cmd/go/build.go
22@@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err
23 }
24
25 cgoExe := tool("cgo")
26- if a.cgo != nil && a.cgo.target != "" {
27+ if a.cgo != nil && a.cgo.target != "" && os.Getenv("GOTOOLDIR") == "" {
28 cgoExe = a.cgo.target
29 }
30 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
new file mode 100644
index 0000000000..afbae02b4e
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
@@ -0,0 +1,63 @@
1Add new option --target-only to build target components
2Separates the host and target pieces of build
3
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5Upstream-Status: Pending
6Index: go/src/make.bash
7===================================================================
8--- go.orig/src/make.bash
9+++ go/src/make.bash
10@@ -143,12 +143,23 @@ if [ "$1" = "--no-clean" ]; then
11 buildall=""
12 shift
13 fi
14-./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
15-# Delay move of dist tool to now, because bootstrap may clear tool directory.
16-mv cmd/dist/dist "$GOTOOLDIR"/dist
17-echo
18
19-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
20+do_host_build="yes"
21+do_target_build="yes"
22+if [ "$1" = "--target-only" ]; then
23+ do_host_build="no"
24+ shift
25+elif [ "$1" = "--host-only" ]; then
26+ do_target_build="no"
27+ shift
28+fi
29+
30+if [ "$do_host_build" = "yes" ]; then
31+ ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
32+ # Delay move of dist tool to now, because bootstrap may clear tool directory.
33+ mv cmd/dist/dist "$GOTOOLDIR"/dist
34+ echo
35+
36 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
37 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
38 # use the host compiler, CC, from `cmd/dist/dist env` instead.
39@@ -157,11 +168,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
40 echo
41 fi
42
43-echo "##### Building packages and commands for $GOOS/$GOARCH."
44-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
45-echo
46+if [ "$do_target_build" = "yes" ]; then
47+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}"
48+ echo "##### Building packages and commands for $GOOS/$GOARCH."
49+ if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a "$do_host_build" = "yes" ]; then
50+ rm -rf ./host-tools
51+ mkdir ./host-tools
52+ mv "$GOTOOLDIR"/* ./host-tools
53+ GOTOOLDIR="$PWD/host-tools"
54+ fi
55+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL}
56+ echo
57
58-rm -f "$GOTOOLDIR"/go_bootstrap
59+ rm -f "$GOTOOLDIR"/go_bootstrap
60+fi
61
62 if [ "$1" != "--no-banner" ]; then
63 "$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
new file mode 100644
index 0000000000..29be06f1bd
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.6/syslog.patch
@@ -0,0 +1,62 @@
1Add timeouts to logger
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
7--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
8+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
9@@ -33,6 +33,9 @@
10 const severityMask = 0x07
11 const facilityMask = 0xf8
12
13+var writeTimeout = 1 * time.Second
14+var connectTimeout = 1 * time.Second
15+
16 const (
17 // Severity.
18
19@@ -100,6 +103,7 @@
20 type serverConn interface {
21 writeString(p Priority, hostname, tag, s, nl string) error
22 close() error
23+ setWriteDeadline(t time.Time) error
24 }
25
26 type netConn struct {
27@@ -273,7 +277,11 @@
28 nl = "\n"
29 }
30
31- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
33+ if err != nil {
34+ return 0, err
35+ }
36+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
37 if err != nil {
38 return 0, err
39 }
40@@ -305,6 +313,10 @@
41 return n.conn.Close()
42 }
43
44+func (n *netConn) setWriteDeadline(t time.Time) error {
45+ return n.conn.SetWriteDeadline(t)
46+}
47+
48 // NewLogger creates a log.Logger whose output is written to
49 // the system log service with the specified priority. The logFlag
50 // argument is the flag set passed through to log.New to create
51diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
52--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
53+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
54@@ -19,7 +19,7 @@
55 logPaths := []string{"/dev/log", "/var/run/syslog"}
56 for _, network := range logTypes {
57 for _, path := range logPaths {
58- conn, err := net.Dial(network, path)
59+ conn, err := net.DialTimeout(network, path, connectTimeout)
60 if err != nil {
61 continue
62 } else {