From b3a9c91d9b0d6ed96a5ec2f30328d04703942ef3 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 30 Jul 2024 12:01:23 +0200 Subject: [PATCH] meson: centralize bindgen version check It's entirely duplicated and every rust user also wants to use bindgen anyway. This way bindgen won't show up multiple times in the meson log as well. Part-of: --- meson.build | 13 +++++++++++++ src/gallium/frontends/rusticl/meson.build | 10 ---------- src/nouveau/compiler/meson.build | 15 --------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/meson.build b/meson.build index 1d66214659f..2bf55abe0cf 100644 --- a/meson.build +++ b/meson.build @@ -855,6 +855,19 @@ if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv') if rustc.version().version_compare('< 1.76') error('Mesa requires Rust 1.76.0 or newer') endif + + bindgen_version = find_program('bindgen').version() + if bindgen_version == 'unknown' + error('Failed to detect bindgen version. If you are using bindgen 0.69.0, ' + + 'please either update to 0.69.1 or downgrade to 0.68.1. ' + + 'You can install the latest version for your user with `cargo install bindgen-cli`.') + endif + + if bindgen_version.version_compare('< 0.65') + error('Mesa requires bindgen 0.65 or newer. ' + + 'If your distribution does not ship a recent enough version, ' + + 'you can install the latest version for your user with `cargo install bindgen-cli`.') + endif endif with_clover_spirv = with_gallium_clover and get_option('opencl-spirv') diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build index 004d453c283..612e47bfe88 100644 --- a/src/gallium/frontends/rusticl/meson.build +++ b/src/gallium/frontends/rusticl/meson.build @@ -105,16 +105,6 @@ rusticl_bindgen_args = [ '--anon-fields-prefix', 'anon_', ] -bindgen_version = find_program('bindgen').version() - -if bindgen_version == 'unknown' - error('Failed to detect bindgen version. If you are using bindgen 0.69.0, please either update to 0.69.1 or downgrade to 0.68.1. You can install the latest version for your user with `cargo install bindgen-cli`.') -endif - -if bindgen_version.version_compare('< 0.65') - error('rusticl requires bindgen 0.65 or newer. If your distribution does not ship a recent enough version, you can install the latest version for your user with `cargo install bindgen-cli`.') -endif - rusticl_bindgen_c_args = [ '-fno-builtin-malloc', ] diff --git a/src/nouveau/compiler/meson.build b/src/nouveau/compiler/meson.build index 8819b267222..871e786e6b4 100644 --- a/src/nouveau/compiler/meson.build +++ b/src/nouveau/compiler/meson.build @@ -4,21 +4,6 @@ if meson.version().version_compare('< 1.3.0') error('NVK requires meson 1.3.0 or newer') endif -bindgen_version = find_program('bindgen').version() - -if bindgen_version == 'unknown' - error('Failed to detect bindgen version. If you are using bindgen 0.69.0, ' + - 'please either update to 0.69.1 or downgrade to 0.68.1. You can ' + - 'install the latest version for your user with ' + - '`cargo install bindgen-cli`.') -endif - -if bindgen_version.version_compare('< 0.65') - error('NAK requires bindgen 0.65 or newer. If your distribution does not ' + - 'ship a recent enough version, you can install the latest version ' + - 'for your user with `cargo install bindgen-cli`.') -endif - nak_rust_args = [ '-Aclippy::identity_op', '-Aclippy::len_zero',