https://bugzilla.redhat.com/show_bug.cgi?id=2124697
--- Comment #67 from Stefan Hajnoczi stefanha@redhat.com --- Thanks, Fabio!
The rpm could invoke cargo directly, although the build won't be 100% the same as tested upstream. I think it's preferable to use meson instead of bypassing it.
I think the build is almost correct already because rpm invokes meson with buildtype "plain". That tells meson not to set optimization flags and cargo-build.sh honors that (see case "${meson_optimization}"). They are inherited from the environment.
However, cargo-build.sh currently overrides RUSTFLAGS. Instead, it should use RUSTFLAGS="$RUSTFLAGS ${rustflags[*]}". That way rpm can pass any options via RUSTFLAGS while non-rpm builds can still set compiler flags in cargo-build.sh.
How does that sound?