diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch')
| -rw-r--r-- | meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch b/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch new file mode 100644 index 0000000000..b0dd95bbe7 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | Add new option --target-only to build target components | ||
| 2 | Separates the host and target pieces of build | ||
| 3 | |||
| 4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 5 | Upstream-Status: Pending | ||
| 6 | Index: go/src/make.bash | ||
| 7 | =================================================================== | ||
| 8 | --- go.orig/src/make.bash | ||
| 9 | +++ go/src/make.bash | ||
| 10 | @@ -154,13 +154,22 @@ if [ "$1" = "--no-clean" ]; then | ||
| 11 | buildall="" | ||
| 12 | shift | ||
| 13 | fi | ||
| 14 | -./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap | ||
| 15 | +do_host_build="yes" | ||
| 16 | +do_target_build="yes" | ||
| 17 | +if [ "$1" = "--target-only" ]; then | ||
| 18 | + do_host_build="no" | ||
| 19 | + shift | ||
| 20 | +elif [ "$1" = "--host-only" ]; then | ||
| 21 | + do_target_build="no" | ||
| 22 | + shift | ||
| 23 | +fi | ||
| 24 | |||
| 25 | -# Delay move of dist tool to now, because bootstrap may clear tool directory. | ||
| 26 | -mv cmd/dist/dist "$GOTOOLDIR"/dist | ||
| 27 | -echo | ||
| 28 | +if [ "$do_host_build" = "yes" ]; then | ||
| 29 | + ./cmd/dist/dist bootstrap $buildall $GO_DISTFLAGS -v # builds go_bootstrap | ||
| 30 | + # Delay move of dist tool to now, because bootstrap may clear tool directory. | ||
| 31 | + mv cmd/dist/dist "$GOTOOLDIR"/dist | ||
| 32 | + echo | ||
| 33 | |||
| 34 | -if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then | ||
| 35 | echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." | ||
| 36 | # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however, | ||
| 37 | # use the host compiler, CC, from `cmd/dist/dist env` instead. | ||
| 38 | @@ -169,11 +178,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH | ||
| 39 | echo | ||
| 40 | fi | ||
| 41 | |||
| 42 | -echo "##### Building packages and commands for $GOOS/$GOARCH." | ||
| 43 | -CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd | ||
| 44 | -echo | ||
| 45 | +if [ "$do_target_build" = "yes" ]; then | ||
| 46 | + GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}" | ||
| 47 | + echo "##### Building packages and commands for $GOOS/$GOARCH." | ||
| 48 | + if [ "$GOHOSTOS" = "$GOOS" -a "$GOHOSTARCH" = "$GOARCH" -a "$do_host_build" = "yes" ]; then | ||
| 49 | + rm -rf ./host-tools | ||
| 50 | + mkdir ./host-tools | ||
| 51 | + mv "$GOTOOLDIR"/* ./host-tools | ||
| 52 | + GOTOOLDIR="$PWD/host-tools" | ||
| 53 | + fi | ||
| 54 | + GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL} | ||
| 55 | + echo | ||
| 56 | |||
| 57 | -rm -f "$GOTOOLDIR"/go_bootstrap | ||
| 58 | + rm -f "$GOTOOLDIR"/go_bootstrap | ||
| 59 | +fi | ||
| 60 | |||
| 61 | if [ "$1" != "--no-banner" ]; then | ||
| 62 | "$GOTOOLDIR"/dist banner | ||
