Classes: The separation of common functionality

Often a certain pattern is followed in more than one recipe, or maybe some complex python based functionality is required to achieve the desired end result. This is achieved through the use of classes, which can be found in the classes subdirectory at the top-level of on OE checkout.

Being aware of the available classes and understanding their functionality is important because classes:

A class is used via the inherit method. The following is an example for the curl recipe showing that it uses three classes:

inherit autotools pkgconfig binconfig

In this case it is utilising the services of three separate classes:

autotools

The autotools class is used by programs that use the GNU configuration tools and takes care of the configuration and compilation of the software;

pkgconfig

The pkgconfig class is used to stage the .pc files which are used by the pkg-config program to provide information about the package to other software that wants to link to this software;

binconfig

The binconfig class is used to stage the -config files which are used to provide information about the package to other software that wants to link to this software;

Each class is implemented via the file in the classes subdirectory named .bbclass and these can be examined for further details on a particular class, although sometimes it's not easy to understand everything that's happening. Many of the classes are covered in detail in various sections in this user manual.