Skip to content

chore: add cargo-binstall metadata for prebuilt binaries#91

Draft
Lomomo wants to merge 1 commit into
RivoLink:mainfrom
Lomomo:add-binstall-metadata
Draft

chore: add cargo-binstall metadata for prebuilt binaries#91
Lomomo wants to merge 1 commit into
RivoLink:mainfrom
Lomomo:add-binstall-metadata

Conversation

@Lomomo
Copy link
Copy Markdown

@Lomomo Lomomo commented May 6, 2026

Summary

Adds [package.metadata.binstall] and a repository field to Cargo.toml so cargo-binstall can fetch the existing GitHub release binaries directly instead of falling back to cargo install (a from-source build).

Without this metadata, cargo binstall leaf either resolves to the unrelated abandoned leaf crate on crates.io (a 2016 deep-learning framework), or — when invoked via cargo binstall --git https://github.com/RivoLink/leaf leaf — fails to find a matching asset and falls back to compiling from source.

After this change:

cargo binstall --git https://github.com/RivoLink/leaf leaf

resolves the right release asset for the host target and installs the prebuilt binary into ~/.cargo/bin/leaf in seconds.

Changes

  • Add repository = "https://github.com/RivoLink/leaf" to [package] so the { repo } template variable is populated.
  • Add [package.metadata.binstall] with pkg-fmt = "bin" (release assets are raw binaries, not archives).
  • Add per-target [package.metadata.binstall.overrides.*] entries mapping each common Rust target triple to the matching release asset:
    • x86_64-unknown-linux-{gnu,musl}leaf-linux-x86_64
    • aarch64-unknown-linux-{gnu,musl}leaf-linux-arm64
    • x86_64-apple-darwinleaf-macos-x86_64
    • aarch64-apple-darwinleaf-macos-arm64
    • x86_64-pc-windows-msvcleaf-windows-x86_64.exe

Test plan

  • cargo metadata --no-deps parses the patched manifest without error.
  • cargo binstall --manifest-path . --dry-run --force leaf on x86_64-unknown-linux-gnu resolves the asset and reports The package leaf v1.19.0 (x86_64-unknown-linux-gnu) has been downloaded from github.com.
  • Maintainer verifies on macOS / Windows targets if desired.

No runtime behavior changes; this only affects how cargo-binstall resolves the binary.

Lets users install via `cargo binstall leaf` (or `cargo binstall --git
https://github.com/RivoLink/leaf leaf`) and fetch the existing release
binaries directly from GitHub instead of falling back to building from
source with `cargo install`.

Adds the `repository` field and per-target `[package.metadata.binstall]`
overrides mapping each Rust target triple to the matching release asset
(`leaf-{linux,macos,windows}-{x86_64,arm64}`).
@RivoLink
Copy link
Copy Markdown
Owner

RivoLink commented May 6, 2026

Hi @Lomomo
Thanks for your interest and for the PR, I really appreciate it.

For now, I’m not planning to add installation via Cargo just yet. I’ve reached out to Michael (the author of the ML project) to see if he can transfer the leaf crate to me, and I’m currently waiting for his response. I’ll give it a few more days before deciding on the next steps.

Thanks again!

@RivoLink RivoLink marked this pull request as draft May 7, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants