Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): scons plugin reference #714

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions docs/common/craft-parts/reference/plugins/scons_plugin.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.. _craft_parts_scons_plugin:

SCons plugin
============

The SCons plugin builds projects using SCons_.

After a successful build, this plugin will install the generated
binaries in ``$CRAFT_PART_INSTALL``.

Keywords
--------

In addition to the common :ref:`plugin <part-properties-plugin>` and
:ref:`sources <part-properties-sources>` keywords, this plugin provides the following
plugin-specific keywords:

scons-parameters
~~~~~~~~~~~~~~~~
**Type:** list of strings
**Default:** []

Parameters to pass to SCons for building and installation.

Environment variables
---------------------

This plugin sets ``DESTDIR`` to ``$CRAFT_PART_INSTALL``.

Dependencies
------------

The SCons plugin needs the ``scons`` executable to build, but does not
provision it by itself.

The common means of providing ``scons`` is through a
:ref:`build-packages <build_packages>` entry which for Ubuntu, would be ``scons``.

Another alternative is to define another part with the name ``scons-deps``, and
declare that the part using the ``scons`` plugin comes :ref:`after <after>` the
``scons-deps`` part. In this case, the plugin will assume that this new part will
provide the ``scons`` executable to be used in the build step. This can be useful,
for example, in cases where a specific, unreleased version of ``scons`` is desired
but only possible by either building the tool itself from source or through some
other custom mechanism.


How it works
------------

During the build step the plugin performs the following actions:

* Run ``scons`` with any ``scons-parameters`` that might have been set;
* Run ``scons install`` with any ``scons-parameters`` that might have been set,
the ``DESTDIR`` environment variable would affect the final installation path.

Examples
--------

The following snippet declares a part using the ``scons`` plugin. It
sets the ``scons-parameters`` for a ``prefix`` to be set to
``/usr``. To ``scons`` executable dependency is satisfied with
:ref:`build-packages <build_packages>`:

.. code-block:: yaml

parts:
gpsd:
source: .
plugin: scons
scons-parameters:
- prefix=/usr
build-packages:
- scons


.. _SCons: https://scons.org/

1 change: 1 addition & 0 deletions docs/reference/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ lifecycle.
/common/craft-parts/reference/plugins/nil_plugin.rst
/common/craft-parts/reference/plugins/python_plugin.rst
/common/craft-parts/reference/plugins/rust_plugin.rst
/common/craft-parts/reference/plugins/scons_plugin.rst


When documenting a new plugin, follow the guidelines in :ref:`how_to_document_a_plugin`.
Loading