diff options
-rw-r--r-- | meta/classes/externalsrc.bbclass | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 7e00ef8d12..c759289701 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -8,18 +8,23 @@ | |||
8 | # the build system to build a piece of software rather than the usual fetch/unpack/patch | 8 | # the build system to build a piece of software rather than the usual fetch/unpack/patch |
9 | # process. | 9 | # process. |
10 | # | 10 | # |
11 | # To use, set S to point at the directory you want to use containing the sources | 11 | # To use, add externalsrc to the global inherit and set EXTERNALSRC to point at the |
12 | # e.g. S = "/path/to/my/source/tree" | 12 | # directory you want to use containing the sources e.g. from local.conf for a recipe |
13 | # called "myrecipe" you would do: | ||
13 | # | 14 | # |
14 | # If the class is to work for both target and native versions (or with multilibs/ | 15 | # INHERIT += "externalsrc" |
15 | # cross or other BBCLASSEXTEND variants), its expected that setting B to point to | 16 | # EXTERNALSRC_pn-myrecipe = "/path/to/my/source/tree" |
16 | # where to place the compiled binaries will work (split source and build directories). | 17 | # |
17 | # This is the default but B can be set to S if circumstaces dictate. | 18 | # In order to make this class work for both target and native versions (or with |
19 | # multilibs/cross or other BBCLASSEXTEND variants), B is set to point to a separate | ||
20 | # directory under the work directory (split source and build directories). This is | ||
21 | # the default, but the build directory can be set to the source directory if | ||
22 | # circumstances dictate by setting EXTERNALSRC_BUILD to the same value, e.g.: | ||
23 | # | ||
24 | # EXTERNALSRC_BUILD_pn-myrecipe = "/path/to/my/source/tree" | ||
18 | # | 25 | # |
19 | 26 | ||
20 | SRC_URI = "" | ||
21 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" | 27 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" |
22 | B = "${WORKDIR}/${BPN}-${PV}/" | ||
23 | 28 | ||
24 | def remove_tasks(tasks, deltasks, d): | 29 | def remove_tasks(tasks, deltasks, d): |
25 | for task in tasks: | 30 | for task in tasks: |
@@ -37,17 +42,27 @@ def remove_tasks(tasks, deltasks, d): | |||
37 | d.setVar('__BBTASKS', tasklist) | 42 | d.setVar('__BBTASKS', tasklist) |
38 | 43 | ||
39 | python () { | 44 | python () { |
40 | tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys()) | 45 | externalsrc = d.getVar('EXTERNALSRC', True) |
41 | covered = d.getVar("SRCTREECOVEREDTASKS", True).split() | 46 | if externalsrc: |
42 | 47 | d.setVar('S', externalsrc) | |
43 | for task in tasks: | 48 | externalsrcbuild = d.getVar('EXTERNALSRC_BUILD', True) |
44 | if task.endswith("_setscene"): | 49 | if externalsrcbuild: |
45 | # sstate is never going to work for external source trees, disable it | 50 | d.setVar('B', externalsrcbuild) |
46 | covered.append(task) | ||
47 | else: | 51 | else: |
48 | # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time | 52 | d.setVar('B', '${WORKDIR}/${BPN}-${PV}/') |
49 | d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock") | 53 | d.setVar('SRC_URI', '') |
54 | |||
55 | tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys()) | ||
56 | covered = d.getVar("SRCTREECOVEREDTASKS", True).split() | ||
57 | |||
58 | for task in tasks: | ||
59 | if task.endswith("_setscene"): | ||
60 | # sstate is never going to work for external source trees, disable it | ||
61 | covered.append(task) | ||
62 | else: | ||
63 | # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time | ||
64 | d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock") | ||
50 | 65 | ||
51 | remove_tasks(tasks, covered, d) | 66 | remove_tasks(tasks, covered, d) |
52 | } | 67 | } |
53 | 68 | ||