chore: add cargo-binstall metadata for prebuilt binaries#91
Draft
Lomomo wants to merge 1 commit into
Draft
Conversation
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}`).
Owner
|
Hi @Lomomo 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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
[package.metadata.binstall]and arepositoryfield toCargo.tomlsocargo-binstallcan fetch the existing GitHub release binaries directly instead of falling back tocargo install(a from-source build).Without this metadata,
cargo binstall leafeither resolves to the unrelated abandonedleafcrate on crates.io (a 2016 deep-learning framework), or — when invoked viacargo binstall --git https://github.com/RivoLink/leaf leaf— fails to find a matching asset and falls back to compiling from source.After this change:
resolves the right release asset for the host target and installs the prebuilt binary into
~/.cargo/bin/leafin seconds.Changes
repository = "https://github.com/RivoLink/leaf"to[package]so the{ repo }template variable is populated.[package.metadata.binstall]withpkg-fmt = "bin"(release assets are raw binaries, not archives).[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_64aarch64-unknown-linux-{gnu,musl}→leaf-linux-arm64x86_64-apple-darwin→leaf-macos-x86_64aarch64-apple-darwin→leaf-macos-arm64x86_64-pc-windows-msvc→leaf-windows-x86_64.exeTest plan
cargo metadata --no-depsparses the patched manifest without error.cargo binstall --manifest-path . --dry-run --force leafonx86_64-unknown-linux-gnuresolves the asset and reportsThe package leaf v1.19.0 (x86_64-unknown-linux-gnu) has been downloaded from github.com.No runtime behavior changes; this only affects how
cargo-binstallresolves the binary.