]> git.ipfire.org Git - thirdparty/git.git/commit
meson: add infrastructure to build internal Rust library
authorPatrick Steinhardt <ps@pks.im>
Thu, 2 Oct 2025 07:29:26 +0000 (09:29 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Oct 2025 16:32:31 +0000 (09:32 -0700)
commitc184795fc0eaf660b4fc06e7ee63aa9c136ff1aa
tree986108117b8451fcba2a5b11dfdc8c15fcd1138a
parent2462961280690837670d997bde64bd4ebf8ae66d
meson: add infrastructure to build internal Rust library

Add the infrastructure into Meson to build an internal Rust library.
Building the Rust parts of Git are for now entirely optional, as they
are mostly intended as a test balloon for both Git developers, but also
for distributors of Git. So for now, they may contain:

  - New features that are not mission critical to Git and that users can
    easily live without.

  - Alternative implementations of small subsystems.

If these test balloons are successful, we will eventually make Rust a
mandatory dependency for our build process in Git 3.0.

The availability of a Rust toolchain will be auto-detected by Meson at
setup time. This behaviour can be tweaked via the `-Drust=` feature
toggle.

Next to the linkable Rust library, also wire up tests that can be
executed via `meson test`. This allows us to use the native unit testing
capabilities of Rust.

Note that the Rust edition is currently set to 2018. This edition is
supported by Rust 1.49, which is the target for the upcoming gcc-rs
backend. For now we don't use any features of Rust that would require a
newer version, so settling on this old version makes sense so that
gcc-rs may become an alternative backend for compiling Git. If we _do_
want to introduce features that were added in more recent editions of
Rust though we should reevaluate that choice.

Inspired-by: Ezekiel Newren <ezekielnewren@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Cargo.toml [new file with mode: 0644]
meson.build
meson_options.txt
src/cargo-meson.sh [new file with mode: 0755]
src/lib.rs [new file with mode: 0644]
src/meson.build [new file with mode: 0644]