Writing Meta Data (Adding packages)

This page will guide you trough the effort of writing a .bb file or recipe in BitBake speak.

Let's start with the easy stuff, like the package description, license, etc:

DESCRIPTION = "My first application, a really cool app containing lots of foo and bar"
LICENSE = "GPLv2"
HOMEPAGE = "http://www.host.com/foo/"
                

The description and license fields are mandatory, so better check them twice.

The next step is to specify what the package needs to build and run, the so called dependencies:

DEPENDS = "gtk+"
RDEPENDS = "cool-ttf-fonts"
                

The package needs gtk+ to build ('DEPENDS') and requires the 'cool-ttf-fonts' package to run ('RDEPENDS'). OE will add run-time dependencies on libraries on its own via the so called shlibs-code, but you need to specify everything other by yourself, which in this case is the 'cool-ttf-fonts' package.

After entering all this OE will know what to build before trying to build your application, but it doesn't know where to get it yet. So let's add the source location:

SRC_URI = "http://www.host.com/foo/files/${P}.tar.bz2;md5sum=yoursum"
                

This will tell the fetcher to where to download the sources from and it will check the integrity using md5sum if you provided the appropriate yoursum. You can make one by doing

md5sum foo-1.9.tar.bz2

and replacing yoursum with the md5sum on your screen. A typical md5sum will look like this:

a6434b0fc8a54c3dec3d6875bf3be8mtn 

Notice the ${P} variable, that one holds the package name, ${PN} in BitBake speak and the package version, ${PV} in BitBake speak. It's a short way of writing ${PN}-${PV}. Using this notation means you can copy the recipe when a new version is released without having to alter the contents. You do need to check if everything is still correct, because new versions mean new bugs.

Before we can move to the actual building we need to find out which build system the package is using. If we're lucky, we see a configure file in the build tree this is an indicator that we can inherit autotools if we see a .pro file, it might be qmake, which needs inherit qmake. Virtually all gtk apps use autotools:

inherit autotools pkgconfig
                

We are in luck! The package is a well-behaved application using autotools and pkgconfig to configure and build it self.

Lets start the build:

bitbake foo
                

Depending on what you have built before and the speed of your computer this can take a few seconds to a few hours, so be prepared.

.... some time goes by .....

Your screen should now have something like this on it:

NOTE: package foo-1.9-r0: task do_build: completed
NOTE: package foo-1.9: completed
NOTE: build 200605052219: completed
                

All looks well, but wait, let's scroll up:

NOTE: the following files where installed but not shipped:
    /usr/weirdpath/importantfile.foo
                

OE has a standard list of paths which need to be included, but it can't know everything, so we have to tell OE to include that file as well:

FILES_${PN} += "/usr/weirdpath/importantfile.foo"
                

It's important to use += so it will get appended to the standard file-list, not replace the standard one.