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-07 11:35:42 +0100 |
commit | 70acc4f45f53a0f163b0301576e576c62dd877f8 (patch) | |
tree | df562a018348e58a1106129cb0d886e84a76d974 | |
parent | ac8e55935f417c4e2dd43ba8e66f6c96be01ec3f (diff) | |
download | poky-70acc4f45f53a0f163b0301576e576c62dd877f8.tar.gz |
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.
(From OE-Core rev: 7a58911f6951abd56db9ebb37f8d6284d91fa514)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 () { | |||
291 | python () { | 291 | python () { |
292 | import exceptions, string, re | 292 | import exceptions, string, re |
293 | 293 | ||
294 | # Handle PACKAGECONFIG | ||
295 | # | ||
296 | # These take the form: | ||
297 | # | ||
298 | # PACKAGECONFIG ?? = "<default options>" | ||
299 | # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends" | ||
300 | pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split() | ||
301 | if pkgconfig: | ||
302 | def appendVar(varname, appends): | ||
303 | if not appends: | ||
304 | return | ||
305 | varname = bb.data.expand(varname, d) | ||
306 | content = d.getVar(varname, False) or "" | ||
307 | content = content + " " + " ".join(appends) | ||
308 | d.setVar(varname, content) | ||
309 | |||
310 | extradeps = [] | ||
311 | extrardeps = [] | ||
312 | extraconf = [] | ||
313 | for flag, flagval in (d.getVarFlags("PACKAGECONFIG") or {}).items(): | ||
314 | if flag == "defaultval": | ||
315 | continue | ||
316 | items = flagval.split(",") | ||
317 | if len(items) == 3: | ||
318 | enable, disable, depend = items | ||
319 | rdepend = "" | ||
320 | elif len(items) == 4: | ||
321 | enable, disable, depend, rdepend = items | ||
322 | if flag in pkgconfig: | ||
323 | extradeps.append(depend) | ||
324 | extrardeps.append(rdepend) | ||
325 | extraconf.append(enable) | ||
326 | else: | ||
327 | extraconf.append(disable) | ||
328 | appendVar('DEPENDS', extradeps) | ||
329 | appendVar('RDEPENDS_${PN}', extrardeps) | ||
330 | appendVar('EXTRA_OECONF', extraconf) | ||
331 | |||
294 | # If PRINC is set, try and increase the PR value by the amount specified | 332 | # If PRINC is set, try and increase the PR value by the amount specified |
295 | princ = bb.data.getVar('PRINC', d, True) | 333 | princ = bb.data.getVar('PRINC', d, True) |
296 | if princ: | 334 | if princ: |