Skip to content

Commit e411d99

Browse files
authored
Merge pull request #2541 from pavelzw/example-recipes
Add rust example recipe
2 parents f8abb04 + b8a7b68 commit e411d99

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-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: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
env:
22+
CARGO_PROFILE_RELEASE_STRIP: symbols
23+
CARGO_PROFILE_RELEASE_LTO: fat
24+
script:
25+
- if: unix
26+
then:
27+
- cargo auditable install --locked --no-track --bins --root "$PREFIX" --path .
28+
else:
29+
- cargo auditable install --locked --no-track --bins --root %PREFIX% --path .
30+
- cargo-bundle-licenses --format yaml --output ./THIRDPARTY.yml
31+
number: 0
32+
33+
requirements:
34+
build:
35+
- ${{ stdlib('c') }}
36+
- ${{ compiler('c') }}
37+
- ${{ compiler('rust') }}
38+
- cargo-bundle-licenses
39+
- cargo-auditable
40+
41+
tests:
42+
- script: example-package --help
43+
44+
about:
45+
homepage: https://github.com/example-package/example-package
46+
summary: Summary of the package.
47+
description: |
48+
Description of the package
49+
license: MIT OR Apache-2.0
50+
license_file:
51+
- LICENSE-APACHE
52+
- LICENSE-MIT
53+
- THIRDPARTY.yml
54+
documentation: https://docs.rs/example-package
55+
repository: https://github.com/example-package/example-package
56+
57+
extra:
58+
recipe-maintainers:
59+
- LandoCalrissian
60+
```
61+
62+
This recipe template supports different features:
63+
64+
- `CARGO_PROFILE_RELEASE_STRIP=symbols` in order to reduce the size of the package by removing unnecessary symbols.
65+
- `CARGO_PROFILE_RELEASE_LTO=fat` in order to optimize the binary for better performance.
66+
- `cargo auditable install` in order to ensure the package is auditable.
67+
- Bundle licenses of statically linked libraries.
68+
- Use `--no-track` to not create `$PREFIX/.crates.toml` and `$PREFIX/.crates2.json`.

0 commit comments

Comments
 (0)