<title>Building Software from an External Source</title>
<para>
- By default, the OpenEmbedded build system does its work from within the
- <link linkend='build-directory'>Build Directory</link>.
- The build process involves fetching the source files, unpacking them, and then patching them
- if necessary before the build takes place.
+ By default, the OpenEmbedded build system uses the
+ <link linkend='build-directory'>Build Directory</link> to
+ build source code.
+ The build process involves fetching the source files, unpacking
+ them, and then patching them if necessary before the build takes
+ place.
</para>
<para>
- Situations exist where you might want to build software from source files that are external to
- and thus outside of the <link linkend='source-directory'>Source Directory</link>.
- For example, suppose you have a project that includes a new BSP with a heavily customized
- kernel, a very minimal image, and some new user-space recipes.
+ Situations exist where you might want to build software from source
+ files that are external to and thus outside of the
+ OpenEmbedded build system.
+ For example, suppose you have a project that includes a new BSP with
+ a heavily customized kernel.
And, you want to minimize exposing the build system to the
- development team so that they can focus on their project and maintain everyone's workflow
- as much as possible.
- In this case, you want a kernel source directory on the development machine where the
- development occurs.
+ development team so that they can focus on their project and
+ maintain everyone's workflow as much as possible.
+ In this case, you want a kernel source directory on the development
+ machine where the development occurs.
You want the recipe's
<ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink>
- variable to point to the external directory and use it as is, not copy it.
+ variable to point to the external directory and use it as is, not
+ copy it.
</para>
<para>
- To build from software that comes from an external source, all you need to do is
- change your recipe so that it inherits the
+ To build from software that comes from an external source, all you
+ need to do is change your recipe so that it inherits
<ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-externalsrc'><filename>externalsrc.bbclass</filename></ulink>
- class and then sets the
- <ulink url='&YOCTO_DOCS_REF_URL;#var-S'><filename>S</filename></ulink>
+ and then sets the
+ <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTERNALSRC'><filename>EXTERNALSRC</filename></ulink>
variable to point to your external source code.
- Here are the statements to put in your recipe:
+ Here are the statements to put in your
+ <filename>local.conf</filename> file:
<literallayout class='monospaced'>
- inherit externalsrc
- S = "/some/path/to/your/package/source"
+ INHERIT += "externalsrc"
+ EXTERNALSRC_pn-myrecipe = "/some/path/to/your/source/tree"
</literallayout>
</para>
<para>
- It is important to know that the <filename>externalsrc.bbclass</filename> assumes that the
- source directory <filename>S</filename> and the Build Directory
- <ulink url='&YOCTO_DOCS_REF_URL;#var-B'><filename>B</filename></ulink>
- are different even though these directories are the same by default.
- This assumption is important because it supports building different variants of the recipe
- by using the
- <ulink url='&YOCTO_DOCS_REF_URL;#var-BBCLASSEXTEND'><filename>BBCLASSEXTEND</filename></ulink>
- variable.
- You could allow the Build Directory to be the same as the source directory but you would
- not be able to build more than one variant of the recipe.
- Consequently, if you are building multiple variants of the recipe, you need to establish a
- Build Directory that is different than the Source Directory.
+ By default, <filename>externalsrc.bbclass</filename> builds
+ the source code in a directory separate from the external source
+ directory as specified by
+ <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTERNALSRC'><filename>EXTERNALSRC</filename></ulink>.
+ If you need to have the source built in the same directory in
+ which it resides, or some other nominated directory, you can set
+ <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTERNALSRC_BUILD'><filename>EXTERNALSRC_BUILD</filename></ulink>
+ to point to that directory:
+ <literallayout class='monospaced'>
+ EXTERNALSRC_BUILD_pn-myrecipe = "/path/to/my/source/tree"
+ </literallayout>
</para>
</section>