diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 14:36:22 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 15:32:53 +0200 |
commit | f4cf9fe05bb3f32fabea4e54dd92d368967a80da (patch) | |
tree | 487180fa9866985ea7b28e625651765d86f515c3 /meta/classes/externalsrc.bbclass | |
download | poky-f4cf9fe05bb3f32fabea4e54dd92d368967a80da.tar.gz |
initial commit for Enea Linux 4.0
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r-- | meta/classes/externalsrc.bbclass | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass new file mode 100644 index 0000000000..2ac62747a2 --- /dev/null +++ b/meta/classes/externalsrc.bbclass | |||
@@ -0,0 +1,53 @@ | |||
1 | # Copyright (C) 2012 Linux Foundation | ||
2 | # Author: Richard Purdie | ||
3 | # Some code and influence taken from srctree.bbclass: | ||
4 | # Copyright (C) 2009 Chris Larson <clarson@kergoth.com> | ||
5 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
6 | # | ||
7 | # externalsrc.bbclass enables use of an existing source tree, usually external to | ||
8 | # the build system to build a piece of software rather than the usual fetch/unpack/patch | ||
9 | # process. | ||
10 | # | ||
11 | # To use, add externalsrc to the global inherit and set EXTERNALSRC to point at the | ||
12 | # directory you want to use containing the sources e.g. from local.conf for a recipe | ||
13 | # called "myrecipe" you would do: | ||
14 | # | ||
15 | # INHERIT += "externalsrc" | ||
16 | # EXTERNALSRC_pn-myrecipe = "/path/to/my/source/tree" | ||
17 | # | ||
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" | ||
25 | # | ||
26 | |||
27 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" | ||
28 | |||
29 | python () { | ||
30 | externalsrc = d.getVar('EXTERNALSRC', True) | ||
31 | if externalsrc: | ||
32 | d.setVar('S', externalsrc) | ||
33 | externalsrcbuild = d.getVar('EXTERNALSRC_BUILD', True) | ||
34 | if externalsrcbuild: | ||
35 | d.setVar('B', externalsrcbuild) | ||
36 | else: | ||
37 | d.setVar('B', '${WORKDIR}/${BPN}-${PV}/') | ||
38 | d.setVar('SRC_URI', '') | ||
39 | |||
40 | tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys()) | ||
41 | |||
42 | for task in tasks: | ||
43 | if task.endswith("_setscene"): | ||
44 | # sstate is never going to work for external source trees, disable it | ||
45 | bb.build.deltask(task, d) | ||
46 | else: | ||
47 | # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time | ||
48 | d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock") | ||
49 | |||
50 | for task in d.getVar("SRCTREECOVEREDTASKS", True).split(): | ||
51 | bb.build.deltask(task, d) | ||
52 | } | ||
53 | |||