From: Richard W.M. Jones Date: Tue, 13 Dec 2022 21:21:02 +0000 (+0000) Subject: libblkio: Add %build_rustflags X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=7b4d987854bdce1d0b7472e5cdad370650533702;p=fedora-reviews.git libblkio: Add %build_rustflags https://bugzilla.redhat.com/show_bug.cgi?id=2124697#c70 --- diff --git a/libblkio/44652d6c7fe9c61ac417db9dd05ec27e3c6e20f9.patch b/libblkio/44652d6c7fe9c61ac417db9dd05ec27e3c6e20f9.patch new file mode 100644 index 0000000..058a3f5 --- /dev/null +++ b/libblkio/44652d6c7fe9c61ac417db9dd05ec27e3c6e20f9.patch @@ -0,0 +1,43 @@ +From 44652d6c7fe9c61ac417db9dd05ec27e3c6e20f9 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +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 +--- + 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 + diff --git a/libblkio/libblkio.spec b/libblkio/libblkio.spec index 9ecb03e..ad68dd0 100644 --- a/libblkio/libblkio.spec +++ b/libblkio/libblkio.spec @@ -5,7 +5,7 @@ Version: 1.1.1 Summary: Block device I/O library Name: libblkio -Release: 9%{?dist} +Release: 10%{?dist} URL: %{forgeurl} Source0: %{forgesource} License: Apache-2.0 OR MIT @@ -14,6 +14,10 @@ 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 @@ -75,6 +79,7 @@ This package contains development tools for %{name}. sed -e 's/--locked/--offline/' -i src/cargo-build.sh %build +export RUSTFLAGS="%build_rustflags" %{meson} %{meson_build} @@ -99,5 +104,5 @@ sed -e 's/--locked/--offline/' -i src/cargo-build.sh %changelog -* Thu Nov 24 2022 Richard W.M. Jones - 1.1.1-9 +* Tue Dec 13 2022 Richard W.M. Jones - 1.1.1-10 - Initial package