diff options
author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2023-01-13 18:30:46 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-10 11:03:36 +0000 |
commit | 35d919672abe323c290335c3f1b73e936e11d469 (patch) | |
tree | db97b49882c3aa2ed8486577da6ff37415c10af1 | |
parent | 4681a9e6ce67745197a2ae56d7ffd2a42e3ebce3 (diff) | |
download | poky-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>
-rw-r--r-- | documentation/ref-manual/classes.rst | 78 |
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 | |||
254 | sstate re-use. In order to function, this class requires the | 254 | sstate 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 | |||
262 | The :ref:`ref-classes-cargo` class allows to compile Rust language programs | ||
263 | using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package | ||
264 | manager, allowing to fetch package dependencies and build your program. | ||
265 | |||
266 | Using this class makes it very easy to build Rust programs. All you need | ||
267 | is to use the :term:`SRC_URI` variable to point to a source repository | ||
268 | which can be built by Cargo, typically one that was created by the | ||
269 | ``cargo new`` command, containing a ``Cargo.toml`` file and a ``src`` | ||
270 | subdirectory. | ||
271 | |||
272 | You 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>` | ||
274 | recipe. A more complex example, with package dependencies, is the | ||
275 | :oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>` | ||
276 | recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ | ||
277 | tool. | ||
278 | |||
279 | This class inherits the :ref:`ref-classes-cargo_common` class. | ||
280 | |||
281 | .. _ref-classes-cargo_common: | ||
282 | |||
283 | ``cargo_common`` | ||
284 | ================ | ||
285 | |||
286 | The :ref:`ref-classes-cargo_common` class is an internal class | ||
287 | that is not intended to be used directly. | ||
288 | |||
289 | An exception is the "rust" recipe, to build the Rust compiler and runtime | ||
290 | library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo` | ||
291 | class. 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 | |||
300 | The :ref:`ref-classes-cargo-update-recipe-crates` class allows | ||
301 | recipe developers to update the list of Cargo crates in :term:`SRC_URI` | ||
302 | by reading the ``Cargo.lock`` file in the source tree. | ||
303 | |||
304 | To do so, create a recipe for your program, for example using | ||
305 | :doc:`devtool </ref-manual/devtool-reference>`, | ||
306 | make 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 | |||
311 | This creates a ``recipe-crates.inc`` file that you can include in your | ||
312 | recipe:: | ||
313 | |||
314 | require ${BPN}-crates.inc | ||
315 | |||
316 | That'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`" |
2494 | section in the Yocto Project Overview and Concepts Manual. | 2554 | section in the Yocto Project Overview and Concepts Manual. |
2495 | 2555 | ||
2556 | .. _ref-classes-rust: | ||
2557 | |||
2558 | ``rust`` | ||
2559 | ======== | ||
2560 | |||
2561 | The :ref:`ref-classes-rust` class is an internal class which is just used | ||
2562 | in the "rust" recipe, to build the Rust compiler and runtime | ||
2563 | library. Except for this recipe, it is not intended to be used directly. | ||
2564 | |||
2565 | .. _ref-classes-rust-common: | ||
2566 | |||
2567 | ``rust-common`` | ||
2568 | =============== | ||
2569 | |||
2570 | The :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 | ||
2572 | intended to be used directly. | ||
2573 | |||
2496 | .. _ref-classes-sanity: | 2574 | .. _ref-classes-sanity: |
2497 | 2575 | ||
2498 | ``sanity`` | 2576 | ``sanity`` |