<br><br><div class="gmail_quote">2011/7/1 Richard Purdie <span dir="ltr"><<a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>></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>
> We're looking to base an embedded development on oe-core in the near<br>
> future, and one of the things we must have is the ability to configure<br>
> features in/out of recipes per distro.<br>
><br>
> At the moment some recipes have a configuration / set of dependencies<br>
> baked in to the recipe. For example, gstreamer has theora, ogg and<br>
> vorbis hard-coded in to it's EXTRA_OECONF and DEPENDS. Currently, you'd<br>
> have to override the DEPENDS and EXTRA_OECONF for the recipe in the<br>
> distro layer - which means moving knowledge about what EXTRA_OECONF<br>
> flags bring in which dependencies outside of the recipe. It seems that<br>
> this metadata is better contained in the recipe.<br>
><br>
> I'm proposing something along the lines of the following:<br>
<br>
</div>This is actually along the lines of what I've been thinking too!<br>
<div><div></div><div class="h5"><br>
> diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass<br>
> index 9930a24..4f1c54f 100644<br>
> --- a/meta/classes/utils.bbclass<br>
> +++ b/meta/classes/utils.bbclass<br>
> @@ -84,6 +84,15 @@ def oe_system(d, cmd, **kwargs):<br>
> kwargs["shell"] = True<br>
> return oe_popen(d, cmd, **kwargs).wait()<br>
><br>
> +def oe_package_feature_switch(feature, switch_on, switch_off,<br>
> dependencies, d):<br>
> + oeconf = d.getVar("EXTRA_OECONF", True)<br>
> + if feature in d.getVar("PACKAGE_FEATURES", True).split():<br>
> + d.setVar("EXTRA_OECONF", oeconf + " " + switch_on)<br>
> + depends = d.getVar("DEPENDS", True)<br>
> + d.setVar("DEPENDS", depends + " " + dependencies)<br>
> + else:<br>
> + d.setVar("EXTRA_OECONF", oeconf + " " + switch_off)<br>
> +<br>
> oe_soinstall() {<br>
> # Purpose: Install shared library file and<br>
> # create the necessary links<br>
> diff --git<br>
> 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>
> 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>
> index f81011f..6fc6405 100644<br>
> --- 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>
> +++ 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>
> @@ -6,10 +6,12 @@ LIC_FILES_CHKSUM =<br>
> "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \<br>
><br>
> file://COPYING.LIB;md5=55ca817ccb7d5b5b66355690e9abc605 \<br>
><br>
> file://gst/ffmpegcolorspace/utils.c;beginline=1;endline=20;md5=9c83a200b8e597b26ca29df20fc6ecd0"<br>
><br>
> -DEPENDS += "virtual/libx11 alsa-lib freetype gnome-vfs liboil libogg<br>
> libvorbis libxv libtheora avahi util-linux tremor"<br>
> +DEPENDS += "virtual/libx11 alsa-lib freetype gnome-vfs liboil libxv<br>
> avahi util-linux tremor"<br>
> RDEPENDS_${PN} += "gnome-vfs-plugin-file gnome-vfs-plugin-http<br>
> gnome-vfs-plugin-ftp \<br>
> gnome-vfs-plugin-sftp"<br>
><br>
> +PACKAGE_FEATURES ?= "ogg vorbis theora"<br>
> +<br>
> SRC_URI += " file://gst-plugins-base-tremor.patch"<br>
><br>
> SRC_URI[md5sum] = "2920af2b3162f3d9fbaa7fabc8ed4d38"<br>
> @@ -21,6 +23,12 @@ inherit gettext<br>
><br>
> EXTRA_OECONF += "--disable-freetypetest --disable-pango"<br>
><br>
> +python () {<br>
> + oe_package_feature_switch("ogg", "--enable-ogg", "--disable-ogg",<br>
> "libogg", d)<br>
> + oe_package_feature_switch("vorbis", "--enable-vorbis",<br>
> "--disable-vorbis", "libvorbis", d)<br>
> + oe_package_feature_switch("theora", "--enable-theora",<br>
> "--disable-theora", "libtheora", d)<br>
> +}<br>
> +<br>
> do_configure_prepend() {<br>
> # This m4 file contains nastiness which conflicts with libtool 2.2.2<br>
> rm -f ${S}/m4/lib-link.m4<br>
><br>
> Then in your layer, you could configure which plugins gstreamer should<br>
> be built with like this:<br>
><br>
> PACKAGE_FEATURES_pn-gst-plugins-base = "ogg theora"<br>
><br>
> Or just filter out the package features that you don't want.<br>
><br>
> With a little extra work, it would also be possible to check the list of<br>
> package features a distro layer requests against those the recipe<br>
> actually implements. Then we could get an early warning when we pull<br>
> 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] = "--enable-ogg, --disable-ogg, libogg"<br>
PACKAGECONFIG[vorbis] = "--enable-vorbis, --disable-vorbis, libvorbis"<br>
PACKAGECONFIG[theora] = "--enable-theora, --disable-theora, libtheora"<br>
<br>
and then in base.bbclass we can simply:<br>
<br>
for flag in (d.getVarFlags("PACKAGECONFIG") or {}):<br>
<manipulate DEPENDS/EXTRA_OECONF><br>
<br>
I'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'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'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>