How to do it...

A sample recipe for the static library example we just saw follows, meta-custom/recipes-example/libhelloworld-static/

DESCRIPTION = "Simple helloworld example static library"                         
SECTION = "libs"                                                                 
LICENSE = "MIT"                                                                  
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 
SRC_URI = "file://hello.c \                                                       
           file://world.c \                                                       
           file://helloworld.h \                                                  
S = "${WORKDIR}"                                                                 
do_compile() {                                                                   
        ${CC} -c hello.c world.c                                                 
        ${AR} -cvq libhelloworld.a hello.o world.o                               
do_install() {                                                                   
        install -d ${D}${includedir}                                             
        install -d ${D}${libdir}                                                 
        install -m 0755 helloworld.h ${D}${includedir}                           
        install -m 0755 libhelloworld.a ${D}${libdir}                            

By default, the configuration in meta/conf/bitbake.conf ...

Get Embedded Linux Development Using Yocto Project Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.