aboutsummaryrefslogtreecommitdiffstats
path: root/usermanual/chapters/recipes.xml
diff options
context:
space:
mode:
Diffstat (limited to 'usermanual/chapters/recipes.xml')
-rw-r--r--usermanual/chapters/recipes.xml386
1 files changed, 268 insertions, 118 deletions
diff --git a/usermanual/chapters/recipes.xml b/usermanual/chapters/recipes.xml
index 8f9754b0a7..c1ca456fa0 100644
--- a/usermanual/chapters/recipes.xml
+++ b/usermanual/chapters/recipes.xml
@@ -1079,11 +1079,11 @@ ${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"</screen></para>
it's a useful example because it doesn't depend on any of the helper
classes which can sometime hide a lot of what is going on.</para>
- <para>First we'll create the helloworld.c file and a readme file. We'll
- place this in the files subdirectory, which is one of the places that is
- searched for file:// URI's:<screen>mkdir packages/helloworld
-mkdir pacakges/helloworld/files
-cat &gt; pacakges/helloworld/files/helloworld.c
+ <para>First we'll create the myhelloworld.c file and a readme file.
+ We'll place this in the files subdirectory, which is one of the places
+ that is searched for file:// URI's:<screen>mkdir packages/myhelloworld
+mkdir packages/myhelloworld/files
+cat &gt; packages/myhelloworld/files/myhelloworld.c
#include &lt;stdio.h&gt;
int main(int argc, char** argv)
@@ -1092,11 +1092,11 @@ int main(int argc, char** argv)
return 0;
}
^D
-cat &gt; pacakges/helloworld/files/README.txt
-Readme file for helloworld.
+cat &gt; packages/myhelloworld/files/README.txt
+Readme file for myhelloworld.
^D</screen></para>
- <para>Now we have a directory for our recipe, packages/helloworld, and
+ <para>Now we have a directory for our recipe, packages/myhelloworld, and
we've created a files subdirectory in there to store our local files.
We've created two local files, the C source code for our helloworld
program and a readme file. Now we need to create the bitbake
@@ -1104,11 +1104,11 @@ Readme file for helloworld.
<para>First we need the header section, which will contain a description
of the package and the release number. We'll leave the other header
- variables out for now:<screen>DESCRIPTION = "Hello world program"
+ variables out for now:<screen>DESCRIPTION = "My hello world program"
PR = "r0"</screen></para>
<para>Next we need to tell it which files we want to be included in the
- recipe, which we do via file:// URI's and the SRC_URI variable:<screen>SRC_URI = "file://helloworld.c \
+ recipe, which we do via file:// URI's and the SRC_URI variable:<screen>SRC_URI = "file://myhelloworld.c \
file://README.txt"</screen></para>
<para>Note the use of the \ to continue a file and the file of file://
@@ -1119,7 +1119,7 @@ PR = "r0"</screen></para>
the recipe and providing the appropriate commands:</para>
<para><screen>do_compile() {
- ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/helloworld.c -o helloworld
+ ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld
}</screen></para>
<para>Note the:</para>
@@ -1146,9 +1146,9 @@ PR = "r0"</screen></para>
the destination directory so that it'll be packaged up correctly. This
is done via the install task, so we need to define a do_install function
in the recipe to describe how to install the package:<screen>do_install() {
- install -m 0755 -d ${D}${bindir} ${D}${docdir}/helloworld
- install -m 0644 ${S}/helloworld ${D}${bindir}
- install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/helloworld
+ install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld
+ install -m 0644 ${S}/myhelloworld ${D}${bindir}
+ install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld
}</screen></para>
<para>Note the:</para>
@@ -1186,120 +1186,120 @@ PR = "r0"</screen></para>
</itemizedlist>
<para>We'll consider this release 0 and version 0.1 of a program called
- helloworld. So we'll name the recipe helloworld_0.1.bb:<screen>cat &gt; packages/helloworld/helloworld_0.1.bb
+ helloworld. So we'll name the recipe myhelloworld_0.1.bb:<screen>cat &gt; packages/myhelloworld/myhelloworld_0.1.bb
DESCRIPTION = "Hello world program"
PR = "r0"
-SRC_URI = "file://helloworld.c \
+SRC_URI = "file://myhelloworld.c \
file://README.txt"
do_compile() {
- ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/helloworld.c -o helloworld
+ ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/myhelloworld.c -o myhelloworld
}
do_install() {
- install -m 0755 -d ${D}${bindir} ${D}${docdir}/helloworld
- install -m 0644 ${S}/helloworld ${D}${bindir}
- install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/helloworld
+ install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld
+ install -m 0644 ${S}/myhelloworld ${D}${bindir}
+ install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld
}
^D</screen>Now we are ready to build our package, hopefully it'll all work
- since it's such a simple example:<screen>~/oe%&gt; bitbake -b packages/helloworld/helloworld_0.1.bb
-NOTE: package helloworld-0.1: started
-NOTE: package helloworld-0.1-r0: task do_fetch: started
-NOTE: package helloworld-0.1-r0: task do_fetch: completed
-NOTE: package helloworld-0.1-r0: task do_unpack: started
-NOTE: Unpacking /home/lenehan/devel/oe/local-packages/helloworld/files/helloworld.c to /home/lenehan/devel/oe/build/titan-glibc-25/tmp/work/helloworld-0.1-r0/
-NOTE: Unpacking /home/lenehan/devel/oe/local-packages/helloworld/files/README.txt to /home/lenehan/devel/oe/build/titan-glibc-25/tmp/work/helloworld-0.1-r0/
-NOTE: package helloworld-0.1-r0: task do_unpack: completed
-NOTE: package helloworld-0.1-r0: task do_patch: started
-NOTE: package helloworld-0.1-r0: task do_patch: completed
-NOTE: package helloworld-0.1-r0: task do_configure: started
-NOTE: package helloworld-0.1-r0: task do_configure: completed
-NOTE: package helloworld-0.1-r0: task do_compile: started
-NOTE: package helloworld-0.1-r0: task do_compile: completed
-NOTE: package helloworld-0.1-r0: task do_install: started
-NOTE: package helloworld-0.1-r0: task do_install: completed
-NOTE: package helloworld-0.1-r0: task do_package: started
-NOTE: package helloworld-0.1-r0: task do_package: completed
-NOTE: package helloworld-0.1-r0: task do_package_write: started
-NOTE: Not creating empty archive for helloworld-dbg-0.1-r0
-Packaged contents of helloworld into /home/lenehan/devel/oe/build/titan-glibc-25/tmp/deploy/ipk/sh4/helloworld_0.1-r0_sh4.ipk
-Packaged contents of helloworld-doc into /home/lenehan/devel/oe/build/titan-glibc-25/tmp/deploy/ipk/sh4/helloworld-doc_0.1-r0_sh4.ipk
-NOTE: Not creating empty archive for helloworld-dev-0.1-r0
-NOTE: Not creating empty archive for helloworld-locale-0.1-r0
-NOTE: package helloworld-0.1-r0: task do_package_write: completed
-NOTE: package helloworld-0.1-r0: task do_populate_staging: started
-NOTE: package helloworld-0.1-r0: task do_populate_staging: completed
-NOTE: package helloworld-0.1-r0: task do_build: started
-NOTE: package helloworld-0.1-r0: task do_build: completed
-NOTE: package helloworld-0.1: completed
+ since it's such a simple example:<screen>~/oe%&gt; bitbake -b packages/myhelloworld/myhelloworld_0.1.bb
+NOTE: package myhelloworld-0.1: started
+NOTE: package myhelloworld-0.1-r0: task do_fetch: started
+NOTE: package myhelloworld-0.1-r0: task do_fetch: completed
+NOTE: package myhelloworld-0.1-r0: task do_unpack: started
+NOTE: Unpacking /home/lenehan/devel/oe/local-packages/myhelloworld/files/helloworld.c to /home/lenehan/devel/oe/build/titan-glibc-25/tmp/work/myhelloworld-0.1-r0/
+NOTE: Unpacking /home/lenehan/devel/oe/local-packages/myhelloworld/files/README.txt to /home/lenehan/devel/oe/build/titan-glibc-25/tmp/work/myhelloworld-0.1-r0/
+NOTE: package myhelloworld-0.1-r0: task do_unpack: completed
+NOTE: package myhelloworld-0.1-r0: task do_patch: started
+NOTE: package myhelloworld-0.1-r0: task do_patch: completed
+NOTE: package myhelloworld-0.1-r0: task do_configure: started
+NOTE: package myhelloworld-0.1-r0: task do_configure: completed
+NOTE: package myhelloworld-0.1-r0: task do_compile: started
+NOTE: package myhelloworld-0.1-r0: task do_compile: completed
+NOTE: package myhelloworld-0.1-r0: task do_install: started
+NOTE: package myhelloworld-0.1-r0: task do_install: completed
+NOTE: package myhelloworld-0.1-r0: task do_package: started
+NOTE: package myhelloworld-0.1-r0: task do_package: completed
+NOTE: package myhelloworld-0.1-r0: task do_package_write: started
+NOTE: Not creating empty archive for myhelloworld-dbg-0.1-r0
+Packaged contents of myhelloworld into /home/lenehan/devel/oe/build/titan-glibc-25/tmp/deploy/ipk/sh4/myhelloworld_0.1-r0_sh4.ipk
+Packaged contents of myhelloworld-doc into /home/lenehan/devel/oe/build/titan-glibc-25/tmp/deploy/ipk/sh4/myhelloworld-doc_0.1-r0_sh4.ipk
+NOTE: Not creating empty archive for myhelloworld-dev-0.1-r0
+NOTE: Not creating empty archive for myhelloworld-locale-0.1-r0
+NOTE: package myhelloworld-0.1-r0: task do_package_write: completed
+NOTE: package myhelloworld-0.1-r0: task do_populate_staging: started
+NOTE: package myhelloworld-0.1-r0: task do_populate_staging: completed
+NOTE: package myhelloworld-0.1-r0: task do_build: started
+NOTE: package myhelloworld-0.1-r0: task do_build: completed
+NOTE: package myhelloworld-0.1: completed
Build statistics:
Attempted builds: 1
~/oe%&gt;</screen></para>
<para>The package was successfully built, the output consists of two
.ipkg files, which are ready to be installed on the target. One contains
- the binary and the other contains the readme file:<screen>~/oe%&gt; ls -l tmp/deploy/ipk/*/helloworld*
--rw-r--r-- 1 lenehan lenehan 3040 Jan 12 14:46 tmp/deploy/ipk/sh4/helloworld_0.1-r0_sh4.ipk
--rw-r--r-- 1 lenehan lenehan 768 Jan 12 14:46 tmp/deploy/ipk/sh4/helloworld-doc_0.1-r0_sh4.ipk
+ the binary and the other contains the readme file:<screen>~/oe%&gt; ls -l tmp/deploy/ipk/*/myhelloworld*
+-rw-r--r-- 1 lenehan lenehan 3040 Jan 12 14:46 tmp/deploy/ipk/sh4/myhelloworld_0.1-r0_sh4.ipk
+-rw-r--r-- 1 lenehan lenehan 768 Jan 12 14:46 tmp/deploy/ipk/sh4/myhelloworld-doc_0.1-r0_sh4.ipk
~/oe%&gt;</screen></para>
<para>It's worthwhile looking at the working directory to see where
- various files ended up:<screen>~/oe%&gt; find tmp/work/helloworld-0.1-r0
-tmp/work/helloworld-0.1-r0
-tmp/work/helloworld-0.1-r0/helloworld-0.1
-tmp/work/helloworld-0.1-r0/helloworld-0.1/patches
-tmp/work/helloworld-0.1-r0/helloworld-0.1/helloworld
-tmp/work/helloworld-0.1-r0/temp
-tmp/work/helloworld-0.1-r0/temp/run.do_configure.21840
-tmp/work/helloworld-0.1-r0/temp/log.do_stage.21840
-tmp/work/helloworld-0.1-r0/temp/log.do_install.21840
-tmp/work/helloworld-0.1-r0/temp/log.do_compile.21840
-tmp/work/helloworld-0.1-r0/temp/run.do_stage.21840
-tmp/work/helloworld-0.1-r0/temp/log.do_configure.21840
-tmp/work/helloworld-0.1-r0/temp/run.do_install.21840
-tmp/work/helloworld-0.1-r0/temp/run.do_compile.21840
-tmp/work/helloworld-0.1-r0/install
-tmp/work/helloworld-0.1-r0/install/helloworld-locale
-tmp/work/helloworld-0.1-r0/install/helloworld-dbg
-tmp/work/helloworld-0.1-r0/install/helloworld-dev
-tmp/work/helloworld-0.1-r0/install/helloworld-doc
-tmp/work/helloworld-0.1-r0/install/helloworld-doc/usr
-tmp/work/helloworld-0.1-r0/install/helloworld-doc/usr/share
-tmp/work/helloworld-0.1-r0/install/helloworld-doc/usr/share/doc
-tmp/work/helloworld-0.1-r0/install/helloworld-doc/usr/share/doc/helloworld
-tmp/work/helloworld-0.1-r0/install/helloworld-doc/usr/share/doc/helloworld/README.txt
-tmp/work/helloworld-0.1-r0/install/helloworld
-tmp/work/helloworld-0.1-r0/install/helloworld/usr
-tmp/work/helloworld-0.1-r0/install/helloworld/usr/bin
-tmp/work/helloworld-0.1-r0/install/helloworld/usr/bin/helloworld
-tmp/work/helloworld-0.1-r0/image
-tmp/work/helloworld-0.1-r0/image/usr
-tmp/work/helloworld-0.1-r0/image/usr/bin
-tmp/work/helloworld-0.1-r0/image/usr/share
-tmp/work/helloworld-0.1-r0/image/usr/share/doc
-tmp/work/helloworld-0.1-r0/image/usr/share/doc/helloworld
-tmp/work/helloworld-0.1-r0/helloworld.c
-tmp/work/helloworld-0.1-r0/README.txt
+ various files ended up:<screen>~/oe%&gt; find tmp/work/myhelloworld-0.1-r0
+tmp/work/myhelloworld-0.1-r0
+tmp/work/myhelloworld-0.1-r0/myhelloworld-0.1
+tmp/work/myhelloworld-0.1-r0/myhelloworld-0.1/patches
+tmp/work/myhelloworld-0.1-r0/myhelloworld-0.1/myhelloworld
+tmp/work/myhelloworld-0.1-r0/temp
+tmp/work/myhelloworld-0.1-r0/temp/run.do_configure.21840
+tmp/work/myhelloworld-0.1-r0/temp/log.do_stage.21840
+tmp/work/myhelloworld-0.1-r0/temp/log.do_install.21840
+tmp/work/myhelloworld-0.1-r0/temp/log.do_compile.21840
+tmp/work/myhelloworld-0.1-r0/temp/run.do_stage.21840
+tmp/work/myhelloworld-0.1-r0/temp/log.do_configure.21840
+tmp/work/myhelloworld-0.1-r0/temp/run.do_install.21840
+tmp/work/myhelloworld-0.1-r0/temp/run.do_compile.21840
+tmp/work/myhelloworld-0.1-r0/install
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-locale
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-dbg
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-dev
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-doc
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-doc/usr
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-doc/usr/share
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-doc/usr/share/doc
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-doc/usr/share/doc/myhelloworld
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld-doc/usr/share/doc/myhelloworld/README.txt
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld/usr
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld/usr/bin
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld/usr/bin/myhelloworld
+tmp/work/myhelloworld-0.1-r0/image
+tmp/work/myhelloworld-0.1-r0/image/usr
+tmp/work/myhelloworld-0.1-r0/image/usr/bin
+tmp/work/myhelloworld-0.1-r0/image/usr/share
+tmp/work/myhelloworld-0.1-r0/image/usr/share/doc
+tmp/work/myhelloworld-0.1-r0/image/usr/share/doc/myhelloworld
+tmp/work/myhelloworld-0.1-r0/myhelloworld.c
+tmp/work/myhelloworld-0.1-r0/README.txt
~/oe%&gt;</screen>Things to note here are:</para>
<itemizedlist>
<listitem>
<para>The two source files are in <emphasis
- role="bold">tmp/work/helloworld-0.1-r0</emphasis>, which is the
+ role="bold">tmp/work/myhelloworld-0.1-r0</emphasis>, which is the
working directory as specified via the <emphasis
role="bold">${WORKDIR}</emphasis> variable;</para>
</listitem>
<listitem>
<para>There's logs of the various tasks in <emphasis
- role="bold">tmp/work/helloworld-0.1-r0/temp</emphasis> which you can
- look at for more details on what was done in each task;</para>
+ role="bold">tmp/work/myhelloworld-0.1-r0/temp</emphasis> which you
+ can look at for more details on what was done in each task;</para>
</listitem>
<listitem>
<para>There's an image directory at <emphasis
- role="bold">tmp/work/helloworld-0.1-r0/image</emphasis> which
+ role="bold">tmp/work/myhelloworld-0.1-r0/image</emphasis> which
contains just the directories that were to be packaged up. This is
actually the destination directory, as specified via the <emphasis
role="bold">${D}</emphasis> variable. The two files that we
@@ -1311,28 +1311,28 @@ tmp/work/helloworld-0.1-r0/README.txt
<listitem>
<para>The program was actually compiled in the <emphasis
- role="bold">tmp/work/helloworld-0.1-r0/helloworld-0.1</emphasis>
+ role="bold">tmp/work/myhelloworld-0.1-r0/myhelloworld-0.1</emphasis>
directory, this is the source directory as specified via the
<emphasis role="bold">${S}</emphasis> variable.</para>
</listitem>
<listitem>
<para>There's an install directory at <emphasis
- role="bold">tmp/work/helloworld-0.1-r0/install</emphasis> which
+ role="bold">tmp/work/myhelloworld-0.1-r0/install</emphasis> which
contains the packages that were being generated and the files that
- go in the package. So we can see that the helloworld-doc package
+ go in the package. So we can see that the myhelloworld-doc package
contains the single file <emphasis
- role="bold">/usr/share/doc/helloworld/README.txt</emphasis>, the
- helloworld package contains the single file <emphasis
- role="bold">/usr/bin/helloworld</emphasis> and the -dev, -dbg and
+ role="bold">/usr/share/doc/myhelloworld/README.txt</emphasis>, the
+ myhelloworld package contains the single file <emphasis
+ role="bold">/usr/bin/myhelloworld</emphasis> and the -dev, -dbg and
-local packages are all empty.</para>
</listitem>
</itemizedlist>
<para>At this stage it's good to verify that we really did produce a
binary for the target and not for our host system. We can check that
- with the file command:<screen>~/oe%&gt; file tmp/work/helloworld-0.1-r0/install/helloworld/usr/bin/helloworld
-tmp/work/helloworld-0.1-r0/install/helloworld/usr/bin/helloworld: ELF 32-bit LSB executable, Hitachi SH, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), for GNU/Linux 2.4.0, not stripped
+ with the file command:<screen>~/oe%&gt; file tmp/work/myhelloworld-0.1-r0/install/myhelloworld/usr/bin/myhelloworld
+tmp/work/myhelloworld-0.1-r0/install/myhelloworld/usr/bin/myhelloworld: ELF 32-bit LSB executable, Hitachi SH, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), for GNU/Linux 2.4.0, not stripped
~/oe%&gt; file /bin/ls
/bin/ls: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), for GNU/Linux 2.4.0, stripped
~/oe%&gt;</screen>This shows us that the helloworld program is for an SH
@@ -2370,42 +2370,192 @@ addtask unpack_extra after do_unpack before do_patch</screen></para>
<section id="recipes_classes" xreflabel="classes">
<title>Classes: The separation of common functionality</title>
- <para>This section is to be completed.</para>
+ <para>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.</para>
+
+ <para>Being aware of the available classes and understanding their
+ functionality is important because classes:</para>
<itemizedlist>
<listitem>
- <para>What are classes</para>
+ <para>Save developers time being performing actions that they would
+ otherwise need to perform themselves;</para>
</listitem>
<listitem>
- <para>How you use classes</para>
+ <para>Perform a lot of actions in the background making a lot of
+ recipes difficult to understand unless you are aware of classes and
+ how they work;</para>
</listitem>
<listitem>
- <para>Some example - autotools, update-r.d, distutils</para>
+ <para>A lot of detail on how things work can be learnt for looking at
+ how classes are implement.</para>
</listitem>
</itemizedlist>
+
+ <para>A class is used via the inherit method. The following is an example
+ for the <emphasis>curl</emphasis> recipe showing that it uses three
+ classes:<screen>inherit autotools pkgconfig binconfig</screen>In this case
+ it is utilising the services of three separate classes:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term>autotools</term>
+
+ <listitem>
+ <para>The <xref linkend="autotools_class" /> is used by programs
+ that use the GNU configuration tools and takes care of the
+ configuration and compilation of the software;</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>pkgconfig</term>
+
+ <listitem>
+ <para>The <xref linkend="pkgconfig_class" /> is used to stage the
+ <emphasis>.pc</emphasis> files which are used by the <emphasis
+ role="bold">pkg-config</emphasis> program to provide information
+ about the package to other software that wants to link to this
+ software;</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>binconfig</term>
+
+ <listitem>
+ <para>The <xref linkend="binconfig_class" /> is used to stage the
+ <emphasis>&lt;name&gt;-config</emphasis> files which are used to
+ provide information about the package to other software that wants
+ to link to this software;</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Each class is implemented via the file in the <emphasis
+ role="bold">classes</emphasis> subdirectory named <emphasis
+ role="bold">&lt;classname&gt;.bbclass</emphasis> 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.</para>
</section>
<section id="recipes_staging" xreflabel="staging">
<title>Staging: Making includes and libraries available for
building</title>
- <para>This section is to be completed:</para>
+ <para>Staging is the process of making files, such as include files and
+ libraries, available for use by other recipes. This is different to
+ installing because installing is about making things available for
+ packaging and then eventually for use on the target device. Staging on the
+ other hand is about making things available on the host system for use by
+ building later applications.</para>
+
+ <para>Taking bzip2 as an example you can see that it stages a header file
+ and it's library files:<screen>do_stage () {
+ install -m 0644 bzlib.h ${STAGING_INCDIR}/
+ oe_libinstall -a -so libbz2 ${STAGING_LIBDIR}
+}</screen></para>
- <itemizedlist>
- <listitem>
- <para>Why we have staging</para>
- </listitem>
+ <para>The <emphasis>oe_libinstall</emphasis> method used in the bzip2
+ recipe is described in the <xref linkend="recipes_methods" /> section, and
+ it takes care of installing libraries (into the staging area in this
+ case). The staging variables are automatically defined to the correct
+ staging location, in this case the main staging variables are used:</para>
- <listitem>
- <para>How staging is used</para>
- </listitem>
+ <variablelist>
+ <varlistentry>
+ <term>STAGING_INCDIR</term>
- <listitem>
- <para>What does and does not need to be staged</para>
- </listitem>
- </itemizedlist>
+ <listitem>
+ <para>The directory into which staged headers files should be
+ installed. This is the equivalent of the standard <emphasis
+ role="bold">/usr/include</emphasis> directory.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>STAGING_LIBDIR</term>
+
+ <listitem>
+ <para>The directory into which staged library files should be
+ installed. This is the equivalent of the standard <emphasis
+ role="bold">/usr/lib</emphasis> directory.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Additional staging related variables are covered in the <xref
+ linkend="directories_staging" /> section in <xref
+ linkend="chapter_reference" />.</para>
+
+ <para>Looking in the staging area under tmp you can see the result of the
+ bzip2 recipes staging task:<screen>%&gt; find tmp/staging -name '*bzlib*'
+tmp/staging/sh4-linux/include/bzlib.h
+%&gt; find tmp/staging -name '*libbz*'
+tmp/staging/sh4-linux/lib/libbz2.so
+tmp/staging/sh4-linux/lib/libbz2.so.1.0
+tmp/staging/sh4-linux/lib/libbz2.so.1
+tmp/staging/sh4-linux/lib/libbz2.so.1.0.2
+tmp/staging/sh4-linux/lib/libbz2.a</screen></para>
+
+ <para>As well as being used during the stage task the staging related
+ variables are used when building other packages. Looking at the gnupg
+ recipe we see two bzip2 related items:<screen>DEPENDS = "zlib <emphasis
+ role="bold">bzip2</emphasis>"
+...
+EXTRA_OECONF = "--disable-ldap \
+ --with-zlib=${STAGING_LIBDIR}/.. \
+ <emphasis role="bold">--with-bzip2=${STAGING_LIBDIR}/..</emphasis> \
+ --disable-selinux-support"
+</screen></para>
+
+ <para>Bzip2 is referred to in two places in the recipe:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term>DEPENDS</term>
+
+ <listitem>
+ <para>Remember that <emphasis role="bold">DEPENDS</emphasis> defines
+ the list of build time dependencies. In this case the staged headers
+ and libraries from bzip2 are required to build gnupg, and therefore
+ we need to make sure the bzip2 recipe has run and staging the
+ headers and libraries. By adding the <emphasis
+ role="bold">DEPENDS</emphasis> on bzip2 this ensures that this
+ happens.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><emphasis role="bold">EXTRA_OECONF</emphasis></term>
+
+ <listitem>
+ <para>This variable is used by the <xref
+ linkend="autotools_class" /> to provide options to the configure
+ script of the package. In the gnupg case it needs to be told where
+ the bzip2 headers and libraries files are, and this is done via the
+ <emphasis>--with-bzip2</emphasis> option. In this case it needs to
+ the directory which include the lib and include subdirectories.
+ Since OE doesn't define a variable for one level above the include
+ and lib directories <emphasis role="bold">..</emphasis> is used to
+ indicate one directory up. Without this gnupg would search the host
+ system headers and libraries instead of those we have provided in
+ the staging area for the target.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>Remember that staging is used to make things, such as headers and
+ libraries, available to used by other recipes later on. While header and
+ libraries are the most common item requiring staging other items such as
+ the pkgconfig files need to be staged as well, while for native packages
+ the binaries also need to be staged.</para>
</section>
<section id="recipes_autoconf" xreflabel="about autoconf">
@@ -3557,4 +3707,4 @@ which find
<para></para>
</section>
-</chapter>
+</chapter> \ No newline at end of file