summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2017-09-08 18:04:37 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-11 17:30:30 +0100
commit6640f4070e5f3e97e84562a7646e655ee84c0eb5 (patch)
tree7f65f5b8ce0bb9db1498f52523f9808eb57a3a0b /meta
parent7a7f0e846f46c4067be63f9f72e61380f32050ac (diff)
downloadpoky-6640f4070e5f3e97e84562a7646e655ee84c0eb5.tar.gz
go.bbclass: Enable parallel build
The parallel build is based on PARALLEL_MAKE variable but can be overriden setting the GO_PARALLEL_BUILD one. This change is based on the meta-golang[1] layer. Thanks to Matt Madison <matt@madison.systems> for his work on this. 1. https://github.com/madisongh/meta-golang (From OE-Core rev: 7a40ea8fc358aa134ad86862591329f94d0f3718) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/go.bbclass20
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 720a504cd8..f64b07fd82 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -1,11 +1,31 @@
1inherit goarch 1inherit goarch
2 2
3def get_go_parallel_make(d):
4 pm = (d.getVar('PARALLEL_MAKE') or '').split()
5 # look for '-j' and throw other options (e.g. '-l') away
6 # because they might have a different meaning in golang
7 while pm:
8 opt = pm.pop(0)
9 if opt == '-j':
10 v = pm.pop(0)
11 elif opt.startswith('-j'):
12 v = opt[2:].strip()
13 else:
14 continue
15
16 return '-p %d' % int(v)
17
18 return ""
19
20GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"
21
3GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" 22GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
4GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" 23GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
5GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin" 24GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin"
6GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}" 25GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}"
7 26
8export GOBUILDFLAGS ?= "-v" 27export GOBUILDFLAGS ?= "-v"
28GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} "
9 29
10export GOOS = "${TARGET_GOOS}" 30export GOOS = "${TARGET_GOOS}"
11export GOARCH = "${TARGET_GOARCH}" 31export GOARCH = "${TARGET_GOARCH}"