summaryrefslogtreecommitdiff
path: root/docs/markdown
diff options
context:
space:
mode:
Diffstat (limited to 'docs/markdown')
-rw-r--r--docs/markdown/Wrap-dependency-system-manual.md21
-rw-r--r--docs/markdown/snippets/wrap.md3
2 files changed, 23 insertions, 1 deletions
diff --git a/docs/markdown/Wrap-dependency-system-manual.md b/docs/markdown/Wrap-dependency-system-manual.md
index 9000c40c7..e1e947479 100644
--- a/docs/markdown/Wrap-dependency-system-manual.md
+++ b/docs/markdown/Wrap-dependency-system-manual.md
@@ -91,6 +91,7 @@ previously reserved to `wrap-file`:
Supported methods:
- `meson` requires `meson.build` file.
- `cmake` requires `CMakeLists.txt` file. [See details](#cmake-wraps).
+ - `cargo` requires `Cargo.toml` file. [See details](#cargo-wraps).
### Specific to wrap-file
- `source_url` - download url to retrieve the wrap-file source archive
@@ -313,6 +314,26 @@ method = cmake
[provide]
foo-bar-1.0 = foo_bar_dep
```
+### Cargo wraps
+
+Cargo subprojects automatically override the `<package_name>-rs` dependency name.
+`package_name` is defined in `[package] name = ...` section of the `Cargo.toml`
+and `-rs` suffix is added. That means the `.wrap` file should have
+`dependency_names = foo-rs` in their `[provide]` section when `Cargo.toml` has
+package name `foo`.
+
+Cargo subprojects require a toml parser. Python >= 3.11 have one built-in, older
+Python versions require either the external `tomli` module or `toml2json` program.
+
+For example, a Cargo project with the package name `foo-bar` would have a wrap
+file like that:
+```ini
+[wrap-file]
+...
+method = cargo
+[provide]
+dependency_names = foo-bar-rs
+```
## Using wrapped projects
diff --git a/docs/markdown/snippets/wrap.md b/docs/markdown/snippets/wrap.md
index 6e03c2e13..3a5521efc 100644
--- a/docs/markdown/snippets/wrap.md
+++ b/docs/markdown/snippets/wrap.md
@@ -1,4 +1,4 @@
-## Automatic fallback to `cmake` subproject
+## Automatic fallback to `cmake` and `cargo` subproject
CMake subprojects have been supported for a while using the `cmake.subproject()`
module method. However until now it was not possible to use a CMake subproject
@@ -10,3 +10,4 @@ key in the wrap file's first section. The method defaults to `meson`.
Supported methods:
- `meson` requires `meson.build` file.
- `cmake` requires `CMakeLists.txt` file. [See details](Wrap-dependency-system-manual.md#cmake-wraps).
+- `cargo` requires `Cargo.toml` file. [See details](Wrap-dependency-system-manual.md#cargo-wraps).