From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: base.bbclass: Implement PACKAGECONFIG
Date: Thu, 06 Oct 2011 15:18:27 +0100 [thread overview]
Message-ID: <1317910715.6398.84.camel@ted> (raw)
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>
---
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 7cd6efa..f539744 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:
next reply other threads:[~2011-10-06 14:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-06 14:18 Richard Purdie [this message]
2011-10-06 14:24 ` base.bbclass: Implement PACKAGECONFIG Martin Jansa
2011-10-06 14:56 ` Richard Purdie
2011-10-06 14:46 ` Koen Kooi
2011-10-06 15:55 ` Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317910715.6398.84.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox