diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2017-09-08 18:04:37 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-11 17:30:30 +0100 |
commit | 6640f4070e5f3e97e84562a7646e655ee84c0eb5 (patch) | |
tree | 7f65f5b8ce0bb9db1498f52523f9808eb57a3a0b /meta/classes/go.bbclass | |
parent | 7a7f0e846f46c4067be63f9f72e61380f32050ac (diff) | |
download | poky-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/classes/go.bbclass')
-rw-r--r-- | meta/classes/go.bbclass | 20 |
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 @@ | |||
1 | inherit goarch | 1 | inherit goarch |
2 | 2 | ||
3 | def 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 | |||
20 | GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}" | ||
21 | |||
3 | GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" | 22 | GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" |
4 | GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" | 23 | GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" |
5 | GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin" | 24 | GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin" |
6 | GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}" | 25 | GOBIN_FINAL = "${GOROOT_FINAL}/${GO_BUILD_BINDIR}" |
7 | 26 | ||
8 | export GOBUILDFLAGS ?= "-v" | 27 | export GOBUILDFLAGS ?= "-v" |
28 | GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} " | ||
9 | 29 | ||
10 | export GOOS = "${TARGET_GOOS}" | 30 | export GOOS = "${TARGET_GOOS}" |
11 | export GOARCH = "${TARGET_GOARCH}" | 31 | export GOARCH = "${TARGET_GOARCH}" |