From 34cbe9632811dcd8726a8c35834e666d2faa5d72 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 5 Jan 2024 13:44:59 -0500 Subject: [PATCH] Update to 1.19.0 Signed-off-by: Benjamin A. Beasley --- .gitignore | 1 + libdeflate-sys-1.19.0-system-libdeflate.patch | 30 ++++++++++ libdeflate-sys-fix-metadata.diff | 11 ++++ rust-libdeflate-sys.spec | 55 ++++++++++--------- rust2rpm.toml | 7 +++ sources | 2 +- 6 files changed, 80 insertions(+), 26 deletions(-) create mode 100644 libdeflate-sys-1.19.0-system-libdeflate.patch create mode 100644 libdeflate-sys-fix-metadata.diff create mode 100644 rust2rpm.toml diff --git a/.gitignore b/.gitignore index dd16a84..635e5a3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /libdeflate-sys-0.7.3.crate /libdeflate-sys-0.7.4.crate /libdeflate-sys-0.7.5.crate +/libdeflate-sys-1.19.0.crate diff --git a/libdeflate-sys-1.19.0-system-libdeflate.patch b/libdeflate-sys-1.19.0-system-libdeflate.patch new file mode 100644 index 0000000..87a49c5 --- /dev/null +++ b/libdeflate-sys-1.19.0-system-libdeflate.patch @@ -0,0 +1,30 @@ +diff -Naur libdeflate-sys-1.19.0-original/build.rs libdeflate-sys-1.19.0/build.rs +--- libdeflate-sys-1.19.0-original/build.rs 2006-07-23 21:21:28.000000000 -0400 ++++ libdeflate-sys-1.19.0/build.rs 2024-01-05 13:37:12.729005469 -0500 +@@ -5,6 +5,15 @@ + fn main() { + let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + ++ if pkg_config::Config::new() ++ .print_system_libs(false) ++ .cargo_metadata(true) ++ .probe("libdeflate") ++ .is_ok() ++ { ++ return; ++ } ++ + let mut build = cc::Build::new(); + + build +diff -Naur libdeflate-sys-1.19.0-original/Cargo.toml.orig libdeflate-sys-1.19.0/Cargo.toml.orig +--- libdeflate-sys-1.19.0-original/Cargo.toml.orig 2006-07-23 21:21:28.000000000 -0400 ++++ libdeflate-sys-1.19.0/Cargo.toml.orig 2024-01-05 13:37:10.360975768 -0500 +@@ -18,6 +18,7 @@ + + [build-dependencies] + cc = "1.0" ++pkg-config = "0.3.9" + + [features] + freestanding = [] diff --git a/libdeflate-sys-fix-metadata.diff b/libdeflate-sys-fix-metadata.diff new file mode 100644 index 0000000..78223dd --- /dev/null +++ b/libdeflate-sys-fix-metadata.diff @@ -0,0 +1,11 @@ +--- libdeflate-sys-1.19.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ libdeflate-sys-1.19.0/Cargo.toml 2024-01-05T18:25:36.554274+00:00 +@@ -38,5 +38,8 @@ + [build-dependencies.cc] + version = "1.0" + ++[build-dependencies.pkg-config] ++version = "0.3.9" ++ + [features] + freestanding = [] diff --git a/rust-libdeflate-sys.spec b/rust-libdeflate-sys.spec index 2d3d38a..7f9823f 100644 --- a/rust-libdeflate-sys.spec +++ b/rust-libdeflate-sys.spec @@ -1,46 +1,48 @@ -# Generated by rust2rpm 20 +# Generated by rust2rpm 25 %bcond_without check %global debug_package %{nil} %global crate libdeflate-sys -Name: rust-%{crate} -Version: 0.7.5 +Name: rust-libdeflate-sys +Version: 1.19.0 Release: %autorelease -Summary: DEFLATE (de)compression exposed as non-streaming buffer operations +Summary: Bindings to libdeflate for DEFLATE -# Upstream license specification: Apache-2.0 -# libdeflate: MIT -License: ASL 2.0 and MIT +License: Apache-2.0 URL: https://crates.io/crates/libdeflate-sys -Source0: %{crates_source} +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# - Add pkg-config dependency for finding the system libdeflate +Patch: libdeflate-sys-fix-metadata.diff +# Use external/system libdeflate when pkgconfig can find it +# https://github.com/adamkewley/libdeflater/pull/30 +# This version applies to the released libdeflate-sys crate. +Patch: libdeflate-sys-1.19.0-system-libdeflate.patch - -ExclusiveArch: %{rust_arches} - -BuildRequires: rust-packaging - -Provides: bundled(libdeflate) = 1.7-1.20201124git4a0bb73 +BuildRequires: cargo-rpm-macros >= 24 %global _description %{expand: -Bindings to libdeflate for DEFLATE (de)compression exposed as non-streaming -buffer operations. Contains bindings for raw deflate, zlib, and gzip data.} +Bindings to libdeflate for DEFLATE (de)compression exposed as non- +streaming buffer operations. Contains bindings for raw deflate, zlib, +and gzip data.} %description %{_description} %package devel Summary: %{summary} BuildArch: noarch +Requires: pkgconfig(libdeflate) %description devel %{_description} This package contains library source intended for building other packages which -use "%{crate}" crate. +use the "%{crate}" crate. %files devel -%license LICENSE libdeflate/COPYING -%doc README.md -%{cargo_registry}/%{crate}-%{version_no_tilde}/ +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/README.md +%{crate_instdir}/ %package -n %{name}+default-devel Summary: %{summary} @@ -49,10 +51,10 @@ BuildArch: noarch %description -n %{name}+default-devel %{_description} This package contains library source intended for building other packages which -use "default" feature of "%{crate}" crate. +use the "default" feature of the "%{crate}" crate. %files -n %{name}+default-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %package -n %{name}+freestanding-devel Summary: %{summary} @@ -61,17 +63,20 @@ BuildArch: noarch %description -n %{name}+freestanding-devel %{_description} This package contains library source intended for building other packages which -use "freestanding" feature of "%{crate}" crate. +use the "freestanding" feature of the "%{crate}" crate. %files -n %{name}+freestanding-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %prep -%autosetup -n %{crate}-%{version_no_tilde} -p1 +%autosetup -n %{crate}-%{version} -p1 +# Remove the bundled copy of libdeflate. +rm -rv libdeflate %cargo_prep %generate_buildrequires %cargo_generate_buildrequires +echo 'pkgconfig(libdeflate)' %build %cargo_build diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..2cfcf02 --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,7 @@ +[requires] +build = [ + "pkgconfig(libdeflate)" +] +lib = [ + "pkgconfig(libdeflate)" +] diff --git a/sources b/sources index 859a30f..ecca502 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libdeflate-sys-0.7.5.crate) = 7193fcf16de76c41d2ee5dd3df9ad99d3131a62c2f98e43535ed0cfd4cc857208b80f6ecee5fda072b08355a2322a74d062730daf9146ff958daf765f07d609b +SHA512 (libdeflate-sys-1.19.0.crate) = 6738a663c11cecc2a3528fe11a26b3f2456df5d52ee79ff358a62ee38ab3d114a63d78d6596c0182a1734fd63c755f1eddb520bee1910761a225d42e1a6556b2