This crate contains the logic for resolving the source code of zsh, which is used by the zsh-ffi crate to build against the correct version of zsh. Currently, it does this by downloading the source code from the official zsh repository on GitHub, but in the future, it may also support other sources, such as a local copy of the source code like provided through zsh-dev on Debian-based systems.
zsh(the zsh binary must be available in the system's PATH)make
Add zsh-src as a dependency in your Cargo.toml:
cargo add zsh-srcUse the ZshSource struct to resolve the source code of zsh and get the path to the source code. This is typically used in a build.rs script to tell Cargo to rerun the build script if the source code changes.
use zsh_src::ZshSource;
fn main() -> io::Result<()> {
let ZshSource { source, .. } = resolve()?;
println!("cargo::rerun-if-changed={}", source.display());
Ok(())
}