Use the convention for Rust subprojects that was adopted by Meson 1.5.0
and newer.
Distros would prefer to avoid vendored crate sources, and instead use
local sources from e.g. /usr/share/cargo/registry. While Meson does not
support a local registry, it can be emulated with MESON_PACKAGE_CACHE_DIR.
However, because the distro might not be using the exact version of the
package, but only one that has the same semver, packagers need to add
some hacks to rewrite the wrap files. For example, in Fedora:
export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/"
# So... Meson can't actually find them without tweaks
%define inst_crate_nameversion() %(basename %{cargo_registry}/%{1}-*)
%define rewrite_wrap_file() sed -e "/source.*/d" -e "s/%{1}-.*/%{inst_crate_nameversion %{1}}/" -i subprojects/%{1}.wrap
%rewrite_wrap_file proc-macro2
%rewrite_wrap_file quote
%rewrite_wrap_file syn
%rewrite_wrap_file unicode-ident
%rewrite_wrap_file paste
Having a common convention for the name of Rust wraps makes it possible
to perform this transformation with a script without listing
the wraps one by one, and to share the script across multiple packages
(which will be useful when QEMU starts using Rust in a similar way to Mesa).
For an example of such a script, see
https://lore.kernel.org/r/20250722083507.678542-1-pbonzini@redhat.com/.
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36284>
This is because Android prefers it -- the project likes to make
changes to bionic that have a global effect, and using raw-syscalls
potentially complicates that. This is a backport of:
https://github.com/bytecodealliance/rustix/pull/1478
In addition, nothing in Mesa3D needs the added functionality provided
by raw syscalls.
Test:
meson setup gfxstream-build -Dvulkan-drivers="gfxstream" -Dgallium-drivers="" -Dvirtgpu_kumquat=true -Dopengl=false -Drust_std=2021
still compiles.
Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36116>
Latest tagged release. Fedora uses it, and for it to
work on Android we'll need to latest release so a pure
libc backend can be used.
Reviewed-by: Marcin Radomski <dextero@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35768>
Starting with Rust 1.83 this benign warning is show when compiling the pest dependency:
```
warning: elided lifetime has a name
--> pest/src/iterators/pairs.rs:330:70
|
89 | impl<'i, R: RuleType> Pairs<'i, R> {
| -- lifetime `'i` declared here
...
330 | ) -> Filter<FlatPairs<'i, R>, impl FnMut(&Pair<'i, R>) -> bool + '_> {
| ^^ this elided lifetime gets resolved as `'i`
|
= note: `#[warn(elided_named_lifetimes)]` on by default
```
Meson, at least as of version 1.7.0, unfortunately does not suppress warnings originating in dependencies.
Upstream has resolved the warning in 2.8.0, so update to that.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34368>
Will be used for a simple isaspec implementation in rust.
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: @LingMan
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28869>
These are the package versions currently shipped by Fedora. This allows
using system packages by setting
export MESON_PACKAGE_CACHE_DIR=/usr/share/cargo/registry/
Of course, other distros may place it somewhere else.
Ubuntu matches versions on syn and unicode-ident but is a tiny bit off
on quote and proc-macro2. However, given how far I was able to bump the
versions with only a tiny meson tweak to syn, I think it should work
with the Ubuntu versions as well.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26726>