summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch
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/split-host-and-target-build.patch
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/split-host-and-target-build.patch')
-rw-r--r--meta/recipes-devtools/go/go-1.6/split-host-and-target-build.patch63
1 files changed, 63 insertions, 0 deletions
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