diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-10-06 23:06:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-10-06 22:43:08 +0100 |
commit | 7a58911f6951abd56db9ebb37f8d6284d91fa514 (patch) | |
tree | c75bfed68ac6f64eec5b211927463b7c13dddb46 /meta/classes | |
parent | 373db49de0e30239fc8c7c3ce74d635fd7d6cd70 (diff) | |
download | openembedded-core-7a58911f6951abd56db9ebb37f8d6284d91fa514.tar.gz openembedded-core-7a58911f6951abd56db9ebb37f8d6284d91fa514.tar.bz2 openembedded-core-7a58911f6951abd56db9ebb37f8d6284d91fa514.zip |
base.bbclass: Implement PACKAGECONFIG
These enabled options to be specified in the form:
PACKAGECONFIG ?? = "<default options>"
PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
So that DEPENDS, RDEPENDS_${PN} and EXTRA_OECONF can be automatically
built from specific options. Those options can easily be customised
by the distro config or the user.
Based on some ideas from Chris Elston <celston@katalix.com> but with
an improved easier to use one line interface.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/base.bbclass | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 7cd6efad1d..f5397446dd 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -291,6 +291,44 @@ do_build () { python () { import exceptions, string, re + # Handle PACKAGECONFIG + # + # These take the form: + # + # PACKAGECONFIG ?? = "<default options>" + # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends" + pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split() + if pkgconfig: + def appendVar(varname, appends): + if not appends: + return + varname = bb.data.expand(varname, d) + content = d.getVar(varname, False) or "" + content = content + " " + " ".join(appends) + d.setVar(varname, content) + + extradeps = [] + extrardeps = [] + extraconf = [] + for flag, flagval in (d.getVarFlags("PACKAGECONFIG") or {}).items(): + if flag == "defaultval": + continue + items = flagval.split(",") + if len(items) == 3: + enable, disable, depend = items + rdepend = "" + elif len(items) == 4: + enable, disable, depend, rdepend = items + if flag in pkgconfig: + extradeps.append(depend) + extrardeps.append(rdepend) + extraconf.append(enable) + else: + extraconf.append(disable) + appendVar('DEPENDS', extradeps) + appendVar('RDEPENDS_${PN}', extrardeps) + appendVar('EXTRA_OECONF', extraconf) + # If PRINC is set, try and increase the PR value by the amount specified princ = bb.data.getVar('PRINC', d, True) if princ: |