The BuildElement class is a convenience element one can derive from for implementing the most common case of element.
Description of assemble activities¶
This element will perform the following steps to assemble an element:
Stage dependencies¶
The dependencies in the Scope.BUILD
scope will be staged at the root of the sandbox
Integrate dependencies¶
The integration commands taken from the bst public domain of each dependency
will be run in the sandbox to create and update caches. Typically ldconfig
among other things is run in this step.
Stage sources¶
Sources are now staged according to their configuration
into the %{build-root} directory (normally /buildstream/build) inside the sandbox.
Run commands¶
Commands are now run in the sandbox.
Commands are taken from the element configuration specified by the given
BuildElement subclass, which can in turn be
overridden by the user in element declarations (.bst files).
Commands are run in the following order:
configure-commands: Commands to configure how the element will buildbuild-commands: Commands to build the elementinstall-commands: Commands to install the results into%{install-root}strip-commands: Commands to strip debugging symbols installed binaries
In addition to the above command domains, each command list is checked
for a pre- and post- command domain. So for instance, an element
declaration can append or prepend commands without overriding the existing
defaults provided by the element type
Example
config:
pre-configure-commands:
- echo "Do something before default configure-commands"
Working Directory
Note that by default the working directory is where the sources are staged in
%{build-root}, but this can be overridden to build inside of a subdirectory
of the build directory using the command-subdir variable in an element
declaration. e.g.:
variables:
command-subdir: src
The above fragment will cause all commands to be run in the src/ subdirectory
of the staged sources.
Result collection¶
Finally, the resulting build artifact is collected from the the %{install-root}
directory (which is normally configured as /buildstream/install) inside the sandbox.
All build elements must install into the %{install-root} using whatever
semantic the given build system provides to do this. E.g. for standard autotools
packages we simply do make DESTDIR=%{install-root} install.