Cope with the old version that is provided in Debian 12 and Ubuntu 22.04. --size_t-is-usize is needed on bindgen <0.61.0 (Debian 12, Ubuntu 22.04), and it was removed in bindgen 0.65.0, so check for it in meson.build.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e08f226ee8a..2a292935a94 100644 --- a/meson.build +++ b/meson.build @@ -74,6 +74,7 @@ endif have_rust = false if not get_option('rust').disabled() and add_languages('rust', required: get_option('rust'), native: false) \ and add_languages('rust', required: get_option('rust'), native: true) + bindgen = find_program('bindgen') rustc = meson.get_compiler('rust') have_rust = true if rustc.version().version_compare('<1.63.0') @@ -3939,6 +3940,9 @@ if have_rust and have_system '--allowlist-file', meson.project_source_root() + '/.*', '--allowlist-file', meson.project_build_root() + '/.*' ] + if bindgen.version().version_compare('<0.65.0') + bindgen_args += ['--size_t-is-usize'] + endif c_enums = [ 'DeviceCategory', 'GpioPolarity', @@ -3974,7 +3978,7 @@ if have_rust and have_system dependencies: common_ss.all_dependencies(), output: 'bindings.rs', include_directories: include_directories('.', 'include'), - bindgen_version: ['>=0.69.4'], + bindgen_version: ['>=0.59.1'], args: bindgen_args, ) subdir('rust') -- 2.46.2