Re: [PATCH RFC 2/3] rust: implement a test balloon via the "varint" subsystem
- From
Eli Schwartz <eschwartz@gentoo.org>
- Date
- Sep 5, 2025, 13:39 UTC
- Message-ID
- <033d35f5-6158-4402-b7f4-aaf525a3e64d@gentoo.org>
- In-Reply-To
- <aLqXHYb2jZpCKzp7@pks.im>
On 9/5/25 3:54 AM, Patrick Steinhardt wrote:
> On Thu, Sep 04, 2025 at 10:00:45PM -0400, Eli Schwartz wrote:
Show 13 quoted lines
>> If the rust code is defined as a crate, meson can auto-import that crate >> via parsing Cargo.toml, so perhaps this can simply be done by creating a >> >> [lib] >> crate-type = 'cdylib' >> >> and... importing it as a meson subproject. You'd be able to build it >> with cargo build, if you really want to (and the Makefile may have to) >> but Meson would not be limited to this. > > That sounds like a sensible thing to do. Just to clarify, this doesn't > need the experimental Cargo wraps, right? Is there any documentation for > how to set this up?
Experimental cargo wraps are new since 1.3.0
https://mesonbuild.com/Release-notes-for-1-3-0.html#automatic-fallback-to-cmake-and-cargo-subproject https://mesonbuild.com/Wrap-dependency-system-manual.html#cargo-wraps
It operates by synthesizing a virtual `meson.build` file for you via translation of ordinary Cargo.toml. A copy of the synthesized file is written out to ${build_dir}/subprojects/foobar-1-rs/ (or whatever the subproject is named), so you can actually see what a manually written meson.build would look like.
And e.g. tweak it a bit. (Since it's a virtual file, it always writes `meson_version : '>= currentver'` to avoid ever triggering "feature new" warnings, and also stubs out `rust_dependency_map : {}`, but you can delete both.)
-- Eli Schwartz