Getting ready

The GNU build system, or autotools, is a set of tools whose aim is to create a Makefile for your software in a variety of systems. It's made up of three main tools:

  • Autoconf: This parses the contents of a configure.ac file that describes the source code to be built and creates a configure script. This script will then be used to generate the final Makefile.
  • Automake: This parses the contents of a Makefile.am file and converts it into a Makefile.in file. This is then used by the configure script generated earlier to obtain a config.status script that gets automatically executed to obtain the final Makefile.
  • Libtools: This manages the creation of both static and dynamic libraries.

Before looking into autotools-based recipes, let's see how to use the Yocto SDK to build an autotools-based package, for example, the GNU hello sample. Let's fetch and extract the code:

$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
$ tar xvf hello-2.10.tar.gz

Once the code has been prepared, we need to set up the compilation environment as usual:

$ source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linuxgnueabi

Next, we can launch the configure script:

$ ./configure ${CONFIGURE_FLAGS}

The CONFIGURE_FLAGS environment variable is already set up with all that configure needs:

$ echo $CONFIGURE_FLAGS
--target=arm-poky-linux-gnueabi --host=arm-poky-linux-gnueabi --build=x86_64-linux -with-libtool-sysroot=/opt/poky/2.4/sysroots/cortexa8hf-neon-poky-linux-gnueabi

We can now build and install, using the following command:

$ make
$ make install DESTDIR=</path/to/destination/directory>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset