generic-poky/documentation/ref-manual/eclipse/html/poky-ref-manual/ref-classes-externalsrc.html

73 lines
4.6 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>7.20. Using External Source - externalsrc.bbclass</title>
<link rel="stylesheet" type="text/css" href="../book.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="The Yocto Project Reference Manual">
<link rel="up" href="ref-classes.html" title="Chapter 7. Classes">
<link rel="prev" href="ref-classes-useradd.html" title="7.19. Adding Users - useradd.bbclass">
<link rel="next" href="ref-classes-others.html" title="7.21. Other Classes">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" title="7.20. Using External Source - externalsrc.bbclass">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="ref-classes-externalsrc"></a>7.20. Using External Source - <code class="filename">externalsrc.bbclass</code>
</h2></div></div></div>
<p>
You can use this class to build software from source code that is external to the
OpenEmbedded build system.
In other words, your source code resides in an external tree outside of the Yocto Project.
Building software from an external source tree means that the normal fetch, unpack, and
patch process is not used.
</p>
<p>
To use the class, you need to define the
<a class="link" href="ref-variables-glos.html#var-S" title="S"><code class="filename">S</code></a> variable to point to the directory that contains the source files.
You also need to have your recipe inherit the <code class="filename">externalsrc.bbclass</code> class.
</p>
<p>
This class expects the source code to support recipe builds that use the
<a class="link" href="ref-variables-glos.html#var-B" title="B"><code class="filename">B</code></a> variable to point to the directory in
which the OpenEmbedded build system places the generated objects built from the recipes.
By default, the <code class="filename">B</code> directory is set to the following, which is separate from the
Source Directory (<code class="filename">S</code>):
</p>
<pre class="literallayout">
${WORKDIR}/${BPN}-{PV}/
</pre>
<p>
See the glossary entries for the
<a class="link" href="ref-variables-glos.html#var-WORKDIR" title="WORKDIR"><code class="filename">WORKDIR</code></a>,
<a class="link" href="ref-variables-glos.html#var-BPN" title="BPN"><code class="filename">BPN</code></a>,
<a class="link" href="ref-variables-glos.html#var-PV" title="PV"><code class="filename">PV</code></a>,
<a class="link" href="ref-variables-glos.html#var-S" title="S"><code class="filename">S</code></a>, and
<a class="link" href="ref-variables-glos.html#var-B" title="B"><code class="filename">B</code></a> for more information.
</p>
<p>
You can build object files in the external tree by setting the
<code class="filename">B</code> variable equal to <code class="filename">"${S}"</code>.
However, this practice does not work well if you use the source for more than one variant
(i.e., "natives" such as <code class="filename">quilt-native</code>,
or "crosses" such as <code class="filename">gcc-cross</code>).
So, be sure there are no "native", "cross", or "multilib" variants of the recipe.
</p>
<p>
If you do want to build different variants of a recipe, you can use the
<a class="link" href="ref-variables-glos.html#var-BBCLASSEXTEND" title="BBCLASSEXTEND"><code class="filename">BBCLASSEXTEND</code></a> variable.
When you do, the <a class="link" href="ref-variables-glos.html#var-B" title="B"><code class="filename">B</code></a> variable must support the
recipe's ability to build variants in different working directories.
Most autotools-based recipes support separating these directories.
The OpenEmbedded build system defaults to using separate directories for <code class="filename">gcc</code>
and some kernel recipes.
Alternatively, you can make sure that separate recipes exist that each
use the <code class="filename">BBCLASSEXTEND</code> variable to build each variant.
The separate recipes can inherit a single target recipe.
</p>
<p>
For information on how to use this class, see the
"<a class="link" href="../dev-manual/building-software-from-an-external-source.html" target="_self">Building
Software from an External Source</a>" section in the Yocto Project Development Manual.
</p>
</div></body>
</html>