Skip to content

Support a static build without requiring external bins (git, archive utils) #924

@polarathene

Description

@polarathene

From the install docs (permalink) requirement listed are:

  • Git - for fetching available versions/tags
  • tar, unzip, gz, xz - for unpacking archives

I believe some Rust based CLI tools that have similar functionality (cargo-binstall perhaps?) are capable of doing all that functionality within Rust.

Would you be open towards removing these external deps? (assuming that doesn't bloat the binary size)

Reference:

NOTE: The utility of this request is perhaps niche given most systems would typically have these deps available. I was interested in producing a minimal OCI image but depending on the base image/distro (if any), adding the required external deps can bring in a bunch of other packages/weight that isn't necessary for proto specifically.


It would seem that to satisfy this request:

  • Adopt a Rust implementation of the git functionality used. Possible candidates:
    • gitoxide_core/gix?
      • Reference: Docs for gix::clone, or friendlier gitoxide_core::repository::clone (EDIT: Nevermind, gitoxide_core appears that it is only intended for internal use by the gix CLI bin).
      • Unfortunately it's a bit low-level with gix directly, would need to engage in upstream for gitoxide_core if wanting to avoid the added verbosity/noise of interacting directly with gix vs current implementation in proto.
    • asyncgit (Repo README is being developed by the gitui CLI project to oxidize their usage of git2 by migrating to gix (git2 provides API via bindings to libgit instead of calling CLI commands like proto does (due to static builds)), however asyncgit doesn't quite seem to have the coverage you'd need yet, and their Cargo.toml shows it still brings in git2 due to the transition (presumably the crate will continue to provide an API to both git2 + gix backends, but could be optimized with feature config to opt-out of git2 deps).
  • starbase_archive would likely need a static feature or similar functionality (this can require some care, I can provide reference/insights from some involvement with zlib-sys). This could then be used (optionally if it makes sense) with proto, where if binary size doesn't go up too much it could be suitable as a default, otherwise compile-time opt-in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions