Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: document when libgit2 is statically linked #1073

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ stable release as well.
Currently this library requires libgit2 1.7.2 (or newer patch versions). The
source for libgit2 is included in the libgit2-sys crate so there's no need to
pre-install the libgit2 library, the libgit2-sys crate will figure that and/or
build that for you.
build that for you. On the other hand, if an appropriate version of `libgit2`
is present, `git2` will attempt to dynamically link it.

You can enable the Cargo feature `vendored-libgit2` to always compile and
statically link to a copy of libgit2. Sometimes the libgit2 on the system is
required to be found and used even when `vendored-libgit2` is activated. In
this case, you shall set the environment variable `LIBGIT2_NO_VENDOR=1`.
To be more precise, the vendored `libgit2` is linked statically if two
conditions both hold:

- The enviornment variable `LIBGIT2_NO_VENDOR=1` is **not** set
- **and** either a) The Cargo feature `vendored-libgit2` is set or b) an
appropriate version of `libgit2` cannot be found on the system.

In particular, note that the environment variable overrides the Cargo feature.

## Building git2-rs

Expand Down