Merge branch 'ps/rust-balloon'

Dip our toes a bit to (optionally) use Rust implemented helper
called from our C code.

* ps/rust-balloon:
  ci: enable Rust for breaking-changes jobs
  ci: convert "pedantic" job into full build with breaking changes
  BreakingChanges: announce Rust becoming mandatory
  varint: reimplement as test balloon for Rust
  varint: use explicit width for integers
  help: report on whether or not Rust is enabled
  Makefile: introduce infrastructure to build internal Rust library
  Makefile: reorder sources after includes
  meson: add infrastructure to build internal Rust library
This commit is contained in:
Junio C Hamano
2025-10-08 12:17:55 -07:00
20 changed files with 410 additions and 131 deletions

View File

@@ -220,7 +220,7 @@ project('git', 'c',
# learned to define __STDC_VERSION__ with C11 and later. We thus require
# GNU C99 and fall back to C11. Meson only learned to handle the fallback
# with version 1.3.0, so on older versions we use GNU C99 unconditionally.
default_options: meson.version().version_compare('>=1.3.0') ? ['c_std=gnu99,c11'] : ['c_std=gnu99'],
default_options: meson.version().version_compare('>=1.3.0') ? ['rust_std=2018', 'c_std=gnu99,c11'] : ['rust_std=2018', 'c_std=gnu99'],
)
fs = import('fs')
@@ -522,7 +522,6 @@ libgit_sources = [
'usage.c',
'userdiff.c',
'utf8.c',
'varint.c',
'version.c',
'versioncmp.c',
'walker.c',
@@ -1703,6 +1702,17 @@ version_def_h = custom_target(
)
libgit_sources += version_def_h
cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))
rust_option = get_option('rust').disable_auto_if(not cargo.found())
if rust_option.allowed()
subdir('src')
libgit_c_args += '-DWITH_RUST'
else
libgit_sources += [
'varint.c',
]
endif
libgit = declare_dependency(
link_with: static_library('git',
sources: libgit_sources,
@@ -2249,6 +2259,7 @@ summary({
'pcre2': pcre2,
'perl': perl_features_enabled,
'python': target_python.found(),
'rust': rust_option.allowed(),
}, section: 'Auto-detected features', bool_yn: true)
summary({