Adding systemwide library to BitBake layer

From ElphelWiki
Revision as of 12:17, 5 May 2016 by Mikhail (talk | contribs) (Created page with "=== Adding system-wide library to BitBake layer === System-wide library can be added to BitBake layer through several simple steps. ''libogg'' will be used here as an example. T...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Adding system-wide library to BitBake layer

System-wide library can be added to BitBake layer through several simple steps. libogg will be used here as an example. This library will be added to meta-elphel393 layer and we will apply a couple of patches to it.

The recipe for libogg is already included into poky/meta/recipes-multimedia, but we need to apply some patches. There is no need to copy original recipe for this library as we can add special recipe into custom layer which will append Metadata to original recipe. Such recipes are called append files and they use .bbappend file type suffix. Append file must have the same name as its corresponding recipe. All we need to do is create libogg_1.3.2.bbappend file in meta/meta-elphel393/recipes-multimedia/libogg directory and add the following lines to the file:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:" 

SRC_URI_append +=   "file://framing.c.patch \
                    file://ogg.h.patch"

This file extends the locations so that BitBake could find patches and adds these patches to original recipe. 1.3.2 in the name is the library version and it should match in append file. If corresponding recipe is renamed to update to a newer library version, this .bbappend must be renamed as well.

Next step is appending libogg package to the list of packages in core-image-elphel393 recipe which resides in meta-elphel393/recipes-core/images directory. Append library package to IMAGE_INSTALL_append variable.

IMAGE_INSTALL_append += " python-core \
                         libogg \
                         ...

Now we can compile the library

bitabke libogg -c compile

and add it to roofs

bitbake libogg -c populate_sysroot

Or just launch bitbake libogg and BitBake will compile, package and copy this library to sysroots. The library now can be used in cross-compiled user space application.