cargo-dist
Version 0.4.0 (2023-10-25)
This release contains several major features related to package dependencies. cargo-dist can now install dependencies for you in CI, ensure your users have those dependencies in their installers, and provide you insights into what external libraries your package links against! It also enables support for statically-built musl binaries on Linux.
Features
Install custom dependencies
Way back in our very first blog post, we wrote about how users could customize the GitHub CI scripts we output to install custom dependencies. As of cargo-dist 0.4.0, you won't need to do that anymore! System dependencies — that is, dependencies installed via the system's package manager instead of cargo
— can now be specified in your cargo-dist config in Cargo.toml
using a syntax very similar to how your cargo
dependencies are specified. For example:
[workspace.metadata.dist.dependencies.homebrew] cmake = { targets = ["x86_64-apple-darwin"] } libcue = "2.2.1" [workspace.metadata.dist.dependencies.apt] cmake = '*' libcue-dev = { version = "2.2.1-2" }
For more information, see the documentation.
- impl
- @mistydemeo initial impl
- @mistydemeo improve Homebrew integration
Find out what your builds linked against
Complementing the ability to specify system dependencies, we've added a new feature that lets you tell which libraries your Rust programs have dynamically linked against. While most Rust software is statically linked, installing external dependencies may mean that your software links against something on the system; you can visualize which libraries your software uses, and which packages they come from, by viewing the output of the build step in CI.
In addition, cargo-dist now uses this information to choose which dependencies to specify when building system package manager installers such as a Homebrew formula. If cargo-dist detects that your binary links against a package provided by Homebrew, it will ensure that a user who brew install
s your package will also get that other package.
This feature has full support for macOS and Linux. On Windows, we're not able to list which package a system library comes.
- impl
- @mistydemeo initial impl
- @mistydemeo infer dependencies via linkage
- @mistydemeo fetch full name of Homebrew tap
- @mistydemeo improve apt package resolution
musl support
This release adds support for a long-requested feature, creating Linux binaries statically linked against musl instead of glibc. These can be enabled adding the x86_64-unknown-linux-musl
target triple to your list of desired targets.
Note that because these binaries are statically linked, they cannot dynamically link against any other C libraries — including C libraries installed using the system dependency feature mentioned above. If your software links against system libraries, please ensure that a static library is available to the build.
- impl
- @mistydemeo initial impl
- @gankra + @mistydemeo use musl binaries in installers
msvc-crt-static opt-out
cargo-dist has always forced +crt-static on, as it is considered more correct for targetting Windows with the typical statically linked Rust binary. However with the introduction of initial support for chocolatey as a system package manager, it's now very easy for our users to dynamically link other DLLs. Once you do, it once again becomes more correct to dynamically link the windows crt, and to use systems like Visual C(++) Redistributables.
Although we would like to teach cargo-dist to handle redistributables for you, we're starting with a simple escape hatch: if you set msvc-crt-static = false
in [workspace.metadata.dist]
, we'll revert to the typical Rust behaviour of dynamically linking the CRT.