build: Rust: Bump minimum Meson and bindgen version

Meson 1.7.0 is required to ensure that generated bindings
are suitable for use with the selected Rust compiler.

Bindgen is bumped to 0.71.1 which has more permissive handling of
`--rust-target`, enabling (almost) any valid Rust version to be
passed as a target; `-nightly` and `-beta*` suffixes are an exception
to this.

This behaviour is expected to improve further with later versions of
Meson; upstream fixes have landed that:

 - pass a stripped version string to bindgen
 - additionally pass an appropriate `--rust-edition` if `rust_std` is
   set (or "nightly" if the compiler is `nightly`).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12680
Bug: https://bugs.gentoo.org/946913
Signed-off-by: Matt Jolly <kangie@gentoo.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33725>
This commit is contained in:
Matt Jolly 2025-02-28 23:27:59 +10:00 committed by Marge Bot
parent c1440cd342
commit 1a698c75ae
4 changed files with 14 additions and 25 deletions

View file

@ -8,7 +8,7 @@
uncollapsed_section_start bindgen "Building bindgen" uncollapsed_section_start bindgen "Building bindgen"
BINDGEN_VER=0.65.1 BINDGEN_VER=0.71.1
CBINDGEN_VER=0.26.0 CBINDGEN_VER=0.26.0
# bindgen # bindgen

View file

@ -8,5 +8,5 @@
rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED
# We need at least 1.4.0 for rusticl # We need at least 1.7.0 for proper rust binding generation
pip3 install 'meson==1.4.0' pip3 install 'meson==1.7.0'

View file

@ -19,20 +19,20 @@ include:
- .gitlab-ci/conditional-build-image-tags.yml - .gitlab-ci/conditional-build-image-tags.yml
variables: variables:
DEBIAN_BASE_TAG: "20250526-barermetal" DEBIAN_BASE_TAG: "20250611-rust"
DEBIAN_BUILD_TAG: "20250515-aarch64" DEBIAN_BUILD_TAG: "20250611-rust"
DEBIAN_TEST_ANDROID_TAG: "20250611-angle-c3" DEBIAN_TEST_ANDROID_TAG: "20250611-angle-c3"
DEBIAN_TEST_GL_TAG: "20250611-piglit-a0a" DEBIAN_TEST_GL_TAG: "20250611-piglit-a0a"
DEBIAN_TEST_VIDEO_TAG: "20250609-helper" DEBIAN_TEST_VIDEO_TAG: "20250609-helper"
DEBIAN_TEST_VK_TAG: "20250611-piglit-a0a" DEBIAN_TEST_VK_TAG: "20250611-piglit-a0a"
ALPINE_X86_64_BUILD_TAG: "20250423-rootfs" ALPINE_X86_64_BUILD_TAG: "20250611-rust"
ALPINE_X86_64_LAVA_SSH_TAG: "20250423-rootfs" ALPINE_X86_64_LAVA_SSH_TAG: "20250423-rootfs"
ALPINE_X86_64_LAVA_TRIGGER_TAG: "20250610-eval" ALPINE_X86_64_LAVA_TRIGGER_TAG: "20250610-eval"
FEDORA_X86_64_BUILD_TAG: "20250423-rootfs" FEDORA_X86_64_BUILD_TAG: "20250611-rust"
KERNEL_TAG: "v6.14-mesa-0e36" KERNEL_TAG: "v6.14-mesa-0e36"
KERNEL_REPO: "gfx-ci/linux" KERNEL_REPO: "gfx-ci/linux"

View file

@ -737,16 +737,9 @@ if with_gallium_rusticl
endif endif
if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv') if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv')
if with_gallium_rusticl # rust.bindgen() does not pass `--rust-target` to bindgen until 1.7.0.
# uses rust.bindgen.output_inline_wrapper needing 1.4.0 if meson.version().version_compare('< 1.7.0')
if meson.version().version_compare('< 1.4.0') error('Mesa Rust support requires Meson 1.7.0 or newer')
error('Rusticl requires meson 1.4.0 or newer')
endif
else
# see https://github.com/mesonbuild/meson/issues/12758 (backported to 1.3.2)
if meson.version().version_compare('< 1.3.2')
error('Mesa Rust support requires meson 1.3.2 or newer')
endif
endif endif
add_languages('rust', required: true) add_languages('rust', required: true)
@ -757,15 +750,11 @@ if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv')
error('Mesa requires Rust 1.78.0 or newer') error('Mesa requires Rust 1.78.0 or newer')
endif endif
# bindgen 0.71 is the first version that knows about `editions`
bindgen_version = find_program('bindgen').version() bindgen_version = find_program('bindgen').version()
if bindgen_version == 'unknown' # unknown covers buggy 0.69.0, 0.71.0
error('Failed to detect bindgen version. If you are using bindgen 0.69.0, ' + if bindgen_version == 'unknown' or bindgen_version.version_compare('< 0.71.1')
'please either update to 0.69.1 or downgrade to 0.68.1. ' + error('Mesa requires bindgen 0.71.1 or newer. ' +
'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, ' + 'If your distribution does not ship a recent enough version, ' +
'you can install the latest version for your user with `cargo install bindgen-cli`.') 'you can install the latest version for your user with `cargo install bindgen-cli`.')
endif endif