Skip to content

Commit de0cf03

Browse files
committed
Add rust example recipe
1 parent f8abb04 commit de0cf03

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

docs/_sidebar.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
"maintainer/understanding_conda_forge/staged_recipes",
4747
"maintainer/understanding_conda_forge/feedstocks"
4848
]
49+
},
50+
{
51+
"type": "category",
52+
"label": "Example recipes",
53+
"link": {
54+
"type": "doc",
55+
"id": "maintainer/example_recipes/index"
56+
},
57+
"items": ["maintainer/example_recipes/rust"]
4958
}
5059
]
5160
},
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: 'Example recipes'
3+
---
4+
5+
# Example recipes
6+
7+
import DocCardList from '@theme/DocCardList';
8+
9+
<DocCardList />
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: 'Rust packages'
3+
---
4+
5+
If you want to package a Rust package to conda-forge, you can use this recipe template:
6+
7+
```yaml
8+
context:
9+
name: example-package
10+
version: "0.1.0"
11+
12+
package:
13+
name: ${{ name|lower }}
14+
version: ${{ version }}
15+
16+
source:
17+
url: https://github.com/example-package/${{ name }}/archive/refs/tags/v${{ version }}.tar.gz
18+
sha256: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
19+
20+
build:
21+
script:
22+
- if: unix
23+
then:
24+
- export CARGO_PROFILE_RELEASE_STRIP=symbols
25+
- export CARGO_PROFILE_RELEASE_LTO=fat
26+
- cargo auditable install --locked --no-track --bins --root "$PREFIX" --path .
27+
else:
28+
- set CARGO_PROFILE_RELEASE_STRIP=symbols
29+
- set CARGO_PROFILE_RELEASE_LTO=fat
30+
- cargo auditable install --locked --no-track --bins --root %PREFIX% --path .
31+
- cargo-bundle-licenses --format yaml --output ./THIRDPARTY.yml
32+
number: 0
33+
34+
requirements:
35+
build:
36+
- ${{ compiler('rust') }}
37+
- cargo-bundle-licenses
38+
- cargo-auditable
39+
- ${{ compiler('c') }}
40+
- ${{ stdlib('c') }}
41+
42+
tests:
43+
- script: example-package --help
44+
45+
about:
46+
homepage: https://github.com/example-package/example-package
47+
summary: Summary of the package.
48+
description: |
49+
Description of the package
50+
license: MIT OR Apache-2.0
51+
license_file:
52+
- LICENSE-APACHE
53+
- LICENSE-MIT
54+
- THIRDPARTY.yml
55+
documentation: https://docs.rs/example-package
56+
repository: https://github.com/example-package/example-package
57+
58+
extra:
59+
recipe-maintainers:
60+
- LandoCalrissian
61+
```
62+
63+
This recipe template supports different features:
64+
65+
- `CARGO_PROFILE_RELEASE_STRIP=symbols` in order to reduce the size of the package by removing unnecessary symbols.
66+
- `CARGO_PROFILE_RELEASE_LTO=fat` in order to optimize the binary for better performance.
67+
- `cargo auditable install` in order to ensure the package is auditable.
68+
- Bundle licenses of statically linked libraries.
69+
- Use `--no-track` to not create `$PREFIX/.crates.toml` and `$PREFIX/.crates2.json`.

0 commit comments

Comments
 (0)