summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2023-01-13 18:30:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-10 11:03:36 +0000
commit35d919672abe323c290335c3f1b73e936e11d469 (patch)
treedb97b49882c3aa2ed8486577da6ff37415c10af1 /documentation
parent4681a9e6ce67745197a2ae56d7ffd2a42e3ebce3 (diff)
downloadpoky-35d919672abe323c290335c3f1b73e936e11d469.tar.gz
ref-manual: document Rust classes
(From yocto-docs rev: 3f3f0ad23f31fb5bb7b550dbe18bbedb1449b3ca) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r--documentation/ref-manual/classes.rst78
1 files changed, 78 insertions, 0 deletions
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index 0cb507b500..b5443c0d0a 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -254,8 +254,68 @@ When inherited globally, prints statistics at the end of the build on
254sstate re-use. In order to function, this class requires the 254sstate re-use. In order to function, this class requires the
255:ref:`ref-classes-buildstats` class be enabled. 255:ref:`ref-classes-buildstats` class be enabled.
256 256
257.. _ref-classes-cargo:
258
259``cargo``
260=========
261
262The :ref:`ref-classes-cargo` class allows to compile Rust language programs
263using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package
264manager, allowing to fetch package dependencies and build your program.
265
266Using this class makes it very easy to build Rust programs. All you need
267is to use the :term:`SRC_URI` variable to point to a source repository
268which can be built by Cargo, typically one that was created by the
269``cargo new`` command, containing a ``Cargo.toml`` file and a ``src``
270subdirectory.
271
272You will find a simple example in the
273:oe_git:`rust-hello-world_git.bb </openembedded-core/tree/meta/recipes-extended/rust-example/rust-hello-world_git.bb>`
274recipe. A more complex example, with package dependencies, is the
275:oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>`
276recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__
277tool.
278
279This class inherits the :ref:`ref-classes-cargo_common` class.
280
281.. _ref-classes-cargo_common:
282
283``cargo_common``
284================
285
286The :ref:`ref-classes-cargo_common` class is an internal class
287that is not intended to be used directly.
288
289An exception is the "rust" recipe, to build the Rust compiler and runtime
290library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo`
291class. This is why this class was introduced.
292
257.. _ref-classes-ccache: 293.. _ref-classes-ccache:
258 294
295.. _ref-classes-cargo-update-recipe-crates:
296
297``cargo-update-recipe-crates``
298===============================
299
300The :ref:`ref-classes-cargo-update-recipe-crates` class allows
301recipe developers to update the list of Cargo crates in :term:`SRC_URI`
302by reading the ``Cargo.lock`` file in the source tree.
303
304To do so, create a recipe for your program, for example using
305:doc:`devtool </ref-manual/devtool-reference>`,
306make it inherit the :ref:`ref-classes-cargo` and
307:ref:`ref-classes-cargo-update-recipe-crates` and run::
308
309 bitbake -c update_crates recipe
310
311This creates a ``recipe-crates.inc`` file that you can include in your
312recipe::
313
314 require ${BPN}-crates.inc
315
316That's also something you can achieve by using the
317`cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool.
318
259``ccache`` 319``ccache``
260========== 320==========
261 321
@@ -2493,6 +2553,24 @@ For information on how root filesystem images are created, see the
2493":ref:`overview-manual/concepts:image generation`" 2553":ref:`overview-manual/concepts:image generation`"
2494section in the Yocto Project Overview and Concepts Manual. 2554section in the Yocto Project Overview and Concepts Manual.
2495 2555
2556.. _ref-classes-rust:
2557
2558``rust``
2559========
2560
2561The :ref:`ref-classes-rust` class is an internal class which is just used
2562in the "rust" recipe, to build the Rust compiler and runtime
2563library. Except for this recipe, it is not intended to be used directly.
2564
2565.. _ref-classes-rust-common:
2566
2567``rust-common``
2568===============
2569
2570The :ref:`ref-classes-rust-common` class is an internal class to the
2571:ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
2572intended to be used directly.
2573
2496.. _ref-classes-sanity: 2574.. _ref-classes-sanity:
2497 2575
2498``sanity`` 2576``sanity``