summaryrefslogtreecommitdiffstats
path: root/meta/classes/go.bbclass
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-02-12 13:39:58 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-16 18:05:40 +0000
commitfeded5fe2755fc6523c235fd6e82a0972e197c08 (patch)
tree91d80f0b7121167e9e7822ee6a450d56d6a06e60 /meta/classes/go.bbclass
parentc723f7c92a15daba5c8ec1d801ce8debb47d59bf (diff)
downloadpoky-feded5fe2755fc6523c235fd6e82a0972e197c08.tar.gz
utils.py: add parallel make helpers
The code to extract the integer number of parallel build threads and construct a new argument from them has started to be copied in multiple locations, so create two new helper utilities to aid recipes. The first helper (parallel_make()) extracts the integer number of parallel build threads from PARALLEL_MAKE. The second (parallel_make_argument()) does the same and then puts the result back into a format string, optionally clamping it to some maximum value. Additionally, rework the oe-core recipes that were manually doing this to use the new helper utilities. (From OE-Core rev: ccd1142d22b31ed85d8823b1bc9e11ccfd72b61f) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/go.bbclass')
-rw-r--r--meta/classes/go.bbclass19
1 files changed, 1 insertions, 18 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 09b01a84c3..7ecd8c9254 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -1,23 +1,6 @@
1inherit goarch ptest 1inherit goarch ptest
2 2
3def get_go_parallel_make(d): 3GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %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 4
22GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" 5GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"
23GOROOT_class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go" 6GOROOT_class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go"