Module: Mesa Branch: main Commit: 1f1ec1c6bcc2a32a3c1df8c2cc7a2f4e7139b7ec URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f1ec1c6bcc2a32a3c1df8c2cc7a2f4e7139b7ec
Author: LingMan <18294-ling...@users.noreply.gitlab.freedesktop.org> Date: Sat Nov 4 12:51:51 2023 +0100 rusticl: Show an error message if the version of bindgen can't be detected bindgen 0.69.0 broke the `--version` switch, resulting in misleading errors about requiring at least bindgen 0.62 or about unexpected arguments. Ideally the build system would fetch the correct bindgen version automatically like cargo does. Until then, provide a hopefully more helpful error message to the user. Reviewed-by: Karol Herbst <kher...@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26046> --- src/gallium/frontends/rusticl/meson.build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build index bdcc0d15c44..f6c28da414e 100644 --- a/src/gallium/frontends/rusticl/meson.build +++ b/src/gallium/frontends/rusticl/meson.build @@ -115,11 +115,17 @@ rusticl_bindgen_args = [ '--anon-fields-prefix', 'anon_', ] -if find_program('bindgen').version().version_compare('< 0.62') +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.62') error('rusticl requires bindgen 0.62 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 -if find_program('bindgen').version().version_compare('< 0.65') +if bindgen_version.version_compare('< 0.65') rusticl_bindgen_args += [ '--size_t-is-usize', ]