--- /dev/null
+From 44652d6c7fe9c61ac417db9dd05ec27e3c6e20f9 Mon Sep 17 00:00:00 2001
+From: Stefan Hajnoczi <stefanha@redhat.com>
+Date: Mon, 12 Dec 2022 14:58:07 -0500
+Subject: [PATCH] cargo-build.sh: inherit $RUSTFLAGS
+
+When a packaging system like rpm invokes "meson build" in meson 0.64.0
+or later, it can use buildtype "plain" to control compiler flags itself
+via the CFLAGS, CXXFLAGS, and, in our case, RUSTFLAGS environment
+variables.
+
+Don't clobber RUSTFLAGS in src/cargo-build.sh. Simply append our own
+options to RUSTFLAGS. That way src/cargo-build.sh still controls
+compiler options when necessary, but inherits them from the build
+environment (especially in the buildtype "plain" case).
+
+See https://bugzilla.redhat.com/show_bug.cgi?id=2124697#c67 for Fedora
+packaging discussion around this topic.
+
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+---
+ src/cargo-build.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/cargo-build.sh b/src/cargo-build.sh
+index 9879d44..d4785ce 100755
+--- a/src/cargo-build.sh
++++ b/src/cargo-build.sh
+@@ -50,10 +50,10 @@ then
+ fi
+
+ if [[ "${profile}" == "debug" ]] && command -v cargo-clippy >/dev/null; then
+- ( set -x && RUSTFLAGS="${rustflags[*]}" cargo clippy "${args[@]}" --color always \
++ ( set -x && RUSTFLAGS="$RUSTFLAGS ${rustflags[*]}" cargo clippy "${args[@]}" --color always \
+ --locked --all-features --all-targets --workspace -- --deny warnings )
+ fi
+
+-( set -x && RUSTFLAGS="${rustflags[*]}" cargo build "${args[@]}" --color always \
++( set -x && RUSTFLAGS="$RUSTFLAGS ${rustflags[*]}" cargo build "${args[@]}" --color always \
+ --locked )
+ cp "src/target/${profile}/libblkio.so" "src/libblkio.so.${version}"
+--
+GitLab
+
Summary: Block device I/O library
Name: libblkio
-Release: 9%{?dist}
+Release: 10%{?dist}
URL: %{forgeurl}
Source0: %{forgesource}
License: Apache-2.0 OR MIT
# (https://gitlab.com/libblkio/libblkio/-/merge_requests/149)
Patch: 149.patch
+# Upstream commit to use $RUSTFLAGS
+# https://bugzilla.redhat.com/show_bug.cgi?id=2124697#c70
+Patch: 44652d6c7fe9c61ac417db9dd05ec27e3c6e20f9.patch
+
# Basic build requirements.
BuildRequires: gcc, gcc-c++
BuildRequires: make
sed -e 's/--locked/--offline/' -i src/cargo-build.sh
%build
+export RUSTFLAGS="%build_rustflags"
%{meson}
%{meson_build}
%changelog
-* Thu Nov 24 2022 Richard W.M. Jones <rjones@redhat.com> - 1.1.1-9
+* Tue Dec 13 2022 Richard W.M. Jones <rjones@redhat.com> - 1.1.1-10
- Initial package