|
| 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