<br><br><div class="gmail_quote">2011/7/1 Richard Purdie <span dir="ltr">&lt;<a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Thu, 2011-06-30 at 18:10 +0100, Chris Elston wrote:<br>
&gt; We&#39;re looking to base an embedded development on oe-core in the near<br>
&gt; future, and one of the things we must have is the ability to configure<br>
&gt; features in/out of recipes per distro.<br>
&gt;<br>
&gt; At the moment some recipes have a configuration / set of dependencies<br>
&gt; baked in to the recipe.  For example, gstreamer has theora, ogg and<br>
&gt; vorbis hard-coded in to it&#39;s EXTRA_OECONF and DEPENDS.  Currently, you&#39;d<br>
&gt; have to override the DEPENDS and EXTRA_OECONF for the recipe in the<br>
&gt; distro layer - which means moving knowledge about what EXTRA_OECONF<br>
&gt; flags bring in which dependencies outside of the recipe.  It seems that<br>
&gt; this metadata is better contained in the recipe.<br>
&gt;<br>
&gt; I&#39;m proposing something along the lines of the following:<br>
<br>
</div>This is actually along the lines of what I&#39;ve been thinking too!<br>
<div><div></div><div class="h5"><br>
&gt; diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass<br>
&gt; index 9930a24..4f1c54f 100644<br>
&gt; --- a/meta/classes/utils.bbclass<br>
&gt; +++ b/meta/classes/utils.bbclass<br>
&gt; @@ -84,6 +84,15 @@ def oe_system(d, cmd, **kwargs):<br>
&gt;          kwargs[&quot;shell&quot;] = True<br>
&gt;      return oe_popen(d, cmd, **kwargs).wait()<br>
&gt;<br>
&gt; +def oe_package_feature_switch(feature, switch_on, switch_off,<br>
&gt; dependencies, d):<br>
&gt; +    oeconf = d.getVar(&quot;EXTRA_OECONF&quot;, True)<br>
&gt; +    if feature in d.getVar(&quot;PACKAGE_FEATURES&quot;, True).split():<br>
&gt; +        d.setVar(&quot;EXTRA_OECONF&quot;, oeconf + &quot; &quot; + switch_on)<br>
&gt; +        depends = d.getVar(&quot;DEPENDS&quot;, True)<br>
&gt; +        d.setVar(&quot;DEPENDS&quot;, depends + &quot; &quot; + dependencies)<br>
&gt; +    else:<br>
&gt; +        d.setVar(&quot;EXTRA_OECONF&quot;, oeconf + &quot; &quot; + switch_off)<br>
&gt; +<br>
&gt;  oe_soinstall() {<br>
&gt;       # Purpose: Install shared library file and<br>
&gt;       #          create the necessary links<br>
&gt; diff --git<br>
&gt; a/meta/recipes-multimedia/gstreamer/<a href="http://gst-plugins-base_0.10.32.bb" target="_blank">gst-plugins-base_0.10.32.bb</a><br>
&gt; b/meta/recipes-multimedia/gstreamer/<a href="http://gst-plugins-base_0.10.32.bb" target="_blank">gst-plugins-base_0.10.32.bb</a><br>
&gt; index f81011f..6fc6405 100644<br>
&gt; --- a/meta/recipes-multimedia/gstreamer/<a href="http://gst-plugins-base_0.10.32.bb" target="_blank">gst-plugins-base_0.10.32.bb</a><br>
&gt; +++ b/meta/recipes-multimedia/gstreamer/<a href="http://gst-plugins-base_0.10.32.bb" target="_blank">gst-plugins-base_0.10.32.bb</a><br>
&gt; @@ -6,10 +6,12 @@ LIC_FILES_CHKSUM =<br>
&gt; &quot;file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \<br>
&gt;<br>
&gt; file://COPYING.LIB;md5=55ca817ccb7d5b5b66355690e9abc605 \<br>
&gt;<br>
&gt; file://gst/ffmpegcolorspace/utils.c;beginline=1;endline=20;md5=9c83a200b8e597b26ca29df20fc6ecd0&quot;<br>
&gt;<br>
&gt; -DEPENDS += &quot;virtual/libx11 alsa-lib freetype gnome-vfs liboil libogg<br>
&gt; libvorbis libxv libtheora avahi util-linux tremor&quot;<br>
&gt; +DEPENDS += &quot;virtual/libx11 alsa-lib freetype gnome-vfs liboil libxv<br>
&gt; avahi util-linux tremor&quot;<br>
&gt;  RDEPENDS_${PN} += &quot;gnome-vfs-plugin-file gnome-vfs-plugin-http<br>
&gt; gnome-vfs-plugin-ftp \<br>
&gt;               gnome-vfs-plugin-sftp&quot;<br>
&gt;<br>
&gt; +PACKAGE_FEATURES ?= &quot;ogg vorbis theora&quot;<br>
&gt; +<br>
&gt;  SRC_URI += &quot; file://gst-plugins-base-tremor.patch&quot;<br>
&gt;<br>
&gt;  SRC_URI[md5sum] = &quot;2920af2b3162f3d9fbaa7fabc8ed4d38&quot;<br>
&gt; @@ -21,6 +23,12 @@ inherit gettext<br>
&gt;<br>
&gt;  EXTRA_OECONF += &quot;--disable-freetypetest --disable-pango&quot;<br>
&gt;<br>
&gt; +python () {<br>
&gt; +     oe_package_feature_switch(&quot;ogg&quot;, &quot;--enable-ogg&quot;, &quot;--disable-ogg&quot;,<br>
&gt; &quot;libogg&quot;, d)<br>
&gt; +     oe_package_feature_switch(&quot;vorbis&quot;, &quot;--enable-vorbis&quot;,<br>
&gt; &quot;--disable-vorbis&quot;, &quot;libvorbis&quot;, d)<br>
&gt; +     oe_package_feature_switch(&quot;theora&quot;, &quot;--enable-theora&quot;,<br>
&gt; &quot;--disable-theora&quot;, &quot;libtheora&quot;, d)<br>
&gt; +}<br>
&gt; +<br>
&gt;  do_configure_prepend() {<br>
&gt;       # This m4 file contains nastiness which conflicts with libtool 2.2.2<br>
&gt;       rm -f ${S}/m4/lib-link.m4<br>
&gt;<br>
&gt; Then in your layer, you could configure which plugins gstreamer should<br>
&gt; be built with like this:<br>
&gt;<br>
&gt; PACKAGE_FEATURES_pn-gst-plugins-base = &quot;ogg theora&quot;<br>
&gt;<br>
&gt; Or just filter out the package features that you don&#39;t want.<br>
&gt;<br>
&gt; With a little extra work, it would also be possible to check the list of<br>
&gt; package features a distro layer requests against those the recipe<br>
&gt; actually implements.  Then we could get an early warning when we pull<br>
&gt; oe-core and a recipe has stopped implementing a feature.<br>
<br>
</div></div>How about something like the syntax for the recipe:<br>
<br>
PACKAGECONFIG[ogg] = &quot;--enable-ogg, --disable-ogg, libogg&quot;<br>
PACKAGECONFIG[vorbis] = &quot;--enable-vorbis, --disable-vorbis, libvorbis&quot;<br>
PACKAGECONFIG[theora] = &quot;--enable-theora, --disable-theora, libtheora&quot;<br>
<br>
and then in base.bbclass we can simply:<br>
<br>
for flag in (d.getVarFlags(&quot;PACKAGECONFIG&quot;) or {}):<br>
    &lt;manipulate DEPENDS/EXTRA_OECONF&gt;<br>
<br>
I&#39;m also strongly tempted to tie this into the DISTRO_FEATURES variable<br>
instead of individual PACKAGE_FEATURES variables to make it clear how<br>
this is intended to be used.<br>
<br>
If we do this, we are going to need to exercise some measure of control<br>
as someone is going to want an enable/disable option for every config<br>
option for every package. How do we decide which make sense and which<br>
don&#39;t?<br>
<br>
Note that the more options you have, the more combinations there are to<br>
test and the less testing the system likely gets. I would therefore like<br>
to see some kind of natural pressure to only add very useful<br>
DISTRO_FEATURES. Maybe a criteria like it affecting 5 or more recipes?<br>
 </blockquote><div>Good idea.<br>Personally I&#39;d like to also bring footprint into the equation. If a feature drags in lots of additional packages, it is interesting to make it configurable.<br>My favourite example: bluez dragging in all kind of rendering stuff (through DEPENDS) even though the hardware functionality might not be there (e.g. you have BT but not audio).<br>
<br>frans <br></div></div><br>