[OE-core] base.bbclass: Implement PACKAGECONFIG

Martin Jansa martin.jansa at gmail.com
Thu Oct 6 14:24:27 UTC 2011


On Thu, Oct 06, 2011 at 03:18:27PM +0100, Richard Purdie wrote:
> 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 at katalix.com> but with
> an improved easier to use one line interface.

1) How can user check on target if his package was built with foo enabled?
   - is there some plan to keep this in ipk/deb metadata?
2) Is it possible to force some PACKAGECONFIG enable/disabled from
   DEPENDS/RDEPENDS, ie bar_1.0.bb with foo enabled, depends not only on
   abc recipe but needs abc also with foo enabled.

Regards,

> Signed-off-by: Richard Purdie <richard.purdie at 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:
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20111006/4cffcc89/attachment-0002.sig>


More information about the Openembedded-core mailing list