summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch')
-rw-r--r--meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch b/meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch
new file mode 100644
index 0000000000..ffd9f2359c
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch
@@ -0,0 +1,92 @@
1From 31e88f06af7ab787d8fe0c1ca625193e1799e167 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Wed, 13 Sep 2017 08:12:04 -0700
4Subject: [PATCH 3/7] make.bash: better separate host and target builds
5
6Fore OE cross-builds, the simple checks in make.bash are
7insufficient for distinguishing host and target build
8environments, so add some options for telling the
9script which parts are being built.
10
11Upstream-Status: Pending
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14Signed-off-by: Matt Madison <matt@madison.systems>
15---
16 src/make.bash | 51 ++++++++++++++++++++++++++++-----------------------
17 1 file changed, 28 insertions(+), 23 deletions(-)
18
19diff --git a/src/make.bash b/src/make.bash
20index dcf3256..9553623 100755
21--- a/src/make.bash
22+++ b/src/make.bash
23@@ -156,13 +156,22 @@ if [ "$1" = "--no-clean" ]; then
24 buildall=""
25 shift
26 fi
27-./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
28+do_host_build="yes"
29+do_target_build="yes"
30+if [ "$1" = "--target-only" ]; then
31+ do_host_build="no"
32+ shift
33+elif [ "$1" = "--host-only" ]; then
34+ do_target_build="no"
35+ shift
36+fi
37
38-# Delay move of dist tool to now, because bootstrap may clear tool directory.
39-mv cmd/dist/dist "$GOTOOLDIR"/dist
40-echo
41+if [ "$do_host_build" = "yes" ]; then
42+ ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap
43+ # Delay move of dist tool to now, because bootstrap may clear tool directory.
44+ mv cmd/dist/dist "$GOTOOLDIR"/dist
45+ echo
46
47-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
48 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
49 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
50 # use the host compiler, CC, from `cmd/dist/dist env` instead.
51@@ -171,24 +180,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
52 echo
53 fi
54
55-echo "##### Building packages and commands for $GOOS/$GOARCH."
56-
57-old_bin_files=$(cd $GOROOT/bin && echo *)
58-
59-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
60-
61-# Check that there are no new files in $GOROOT/bin other than go and gofmt
62-# and $GOOS_$GOARCH (a directory used when cross-compiling).
63-(cd $GOROOT/bin && for f in *; do
64- if ! expr " $old_bin_files go gofmt ${GOOS}_${GOARCH} " : ".* $f " >/dev/null 2>/dev/null; then
65- echo 1>&2 "ERROR: unexpected new file in $GOROOT/bin: $f"
66- exit 1
67- fi
68-done)
69-
70-echo
71-
72-rm -f "$GOTOOLDIR"/go_bootstrap
73+if [ "$do_target_build" = "yes" ]; then
74+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}"
75+ echo "##### Building packages and commands for $GOOS/$GOARCH."
76+ if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a "$do_host_build" = "yes" ]; then
77+ rm -rf ./host-tools
78+ mkdir ./host-tools
79+ mv "$GOTOOLDIR"/* ./host-tools
80+ GOTOOLDIR="$PWD/host-tools"
81+ fi
82+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL}
83+ echo
84+
85+ rm -f "$GOTOOLDIR"/go_bootstrap
86+fi
87
88 if [ "$1" != "--no-banner" ]; then
89 "$GOTOOLDIR"/dist banner
90--
912.7.4
92