diff options
-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}" |