From 8739cd82d5d419d6753d65a9de08b9c80cd756b7 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Wed, 10 Jan 2024 17:14:17 +0100 Subject: [PATCH] Update to version 1.1.14; Fixes RHBZ#2257247 --- .gitignore | 1 + ...use-pkg-config-to-link-with-system-z.patch | 40 ++++++++++++------- libz-sys-fix-metadata.diff | 4 +- rust-libz-sys.spec | 10 ++--- rust2rpm.conf | 5 --- rust2rpm.toml | 4 ++ sources | 2 +- 7 files changed, 38 insertions(+), 28 deletions(-) delete mode 100644 rust2rpm.conf create mode 100644 rust2rpm.toml diff --git a/.gitignore b/.gitignore index b2d3b18..e8cc2b0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /libz-sys-1.1.8.crate /libz-sys-1.1.9.crate /libz-sys-1.1.12.crate +/libz-sys-1.1.14.crate diff --git a/0001-unconditionally-use-pkg-config-to-link-with-system-z.patch b/0001-unconditionally-use-pkg-config-to-link-with-system-z.patch index 9afbea6..c0b92f3 100644 --- a/0001-unconditionally-use-pkg-config-to-link-with-system-z.patch +++ b/0001-unconditionally-use-pkg-config-to-link-with-system-z.patch @@ -1,19 +1,19 @@ -From 1d8cd791f014ff2a3e043730eaaaf3b7c5be114f Mon Sep 17 00:00:00 2001 +From 7d6c389b4f3330696e737110bbb9f7c38101da55 Mon Sep 17 00:00:00 2001 From: Fabio Valentini -Date: Sat, 29 Jul 2023 16:48:39 +0200 +Date: Wed, 10 Jan 2024 17:12:19 +0100 Subject: [PATCH] unconditionally use pkg-config to link with system zlib --- - build.rs | 188 ++------------------------------------------------- + build.rs | 197 ++------------------------------------------------- build_zng.rs | 60 ---------------- - 2 files changed, 5 insertions(+), 243 deletions(-) + 2 files changed, 4 insertions(+), 253 deletions(-) delete mode 100644 build_zng.rs diff --git a/build.rs b/build.rs -index 51ebe6b..8d1acf7 100644 +index 1368a12..8d1acf7 100644 --- a/build.rs +++ b/build.rs -@@ -1,187 +1,9 @@ +@@ -1,198 +1,9 @@ -use std::env; -use std::fs; -use std::path::PathBuf; @@ -111,7 +111,7 @@ index 51ebe6b..8d1acf7 100644 - let lib = dst.join("lib"); - - cfg.warnings(false).out_dir(&lib).include("src/zlib"); -- + - cfg.file("src/zlib/adler32.c") - .file("src/zlib/compress.c") - .file("src/zlib/crc32.c") @@ -153,11 +153,26 @@ index 51ebe6b..8d1acf7 100644 - fs::copy("src/zlib/zconf.h", dst.join("include/zconf.h")).unwrap(); - - fs::create_dir_all(lib.join("pkgconfig")).unwrap(); +- let zlib_h = fs::read_to_string(dst.join("include/zlib.h")).unwrap(); +- let version = zlib_h +- .lines() +- .find(|l| l.contains("ZLIB_VERSION")) +- .unwrap() +- .split("\"") +- .nth(1) ++ pkg_config::Config::new() ++ .cargo_metadata(true) ++ .print_system_libs(false) ++ .probe("zlib") + .unwrap(); - fs::write( - lib.join("pkgconfig/zlib.pc"), - fs::read_to_string("src/zlib/zlib.pc.in") - .unwrap() -- .replace("@prefix@", dst.to_str().unwrap()), +- .replace("@prefix@", dst.to_str().unwrap()) +- .replace("@includedir@", "${prefix}/include") +- .replace("@libdir@", "${prefix}/lib") +- .replace("@VERSION@", version), - ) - .unwrap(); - @@ -198,13 +213,8 @@ index 51ebe6b..8d1acf7 100644 - return true; - } - } - +- - false -+ pkg_config::Config::new() -+ .cargo_metadata(true) -+ .print_system_libs(false) -+ .probe("zlib") -+ .unwrap(); } diff --git a/build_zng.rs b/build_zng.rs deleted file mode 100644 @@ -273,5 +283,5 @@ index 2557625..0000000 - build_zlib_ng(&target, false); -} -- -2.41.0 +2.43.0 diff --git a/libz-sys-fix-metadata.diff b/libz-sys-fix-metadata.diff index 6baba85..644269f 100644 --- a/libz-sys-fix-metadata.diff +++ b/libz-sys-fix-metadata.diff @@ -1,5 +1,5 @@ ---- libz-sys-1.1.12/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ libz-sys-1.1.12/Cargo.toml 2023-07-29T14:43:10.223812+00:00 +--- libz-sys-1.1.14/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ libz-sys-1.1.14/Cargo.toml 2024-01-10T16:05:38.163257+00:00 @@ -47,25 +47,12 @@ [build-dependencies.cc] version = "1.0.18" diff --git a/rust-libz-sys.spec b/rust-libz-sys.spec index d121dc7..786e62c 100644 --- a/rust-libz-sys.spec +++ b/rust-libz-sys.spec @@ -1,11 +1,11 @@ -# Generated by rust2rpm 24 +# Generated by rust2rpm 25 %bcond_without check %global debug_package %{nil} %global crate libz-sys Name: rust-libz-sys -Version: 1.1.12 +Version: 1.1.14 Release: %autorelease Summary: Low-level bindings to the system libz library (also known as zlib) @@ -19,7 +19,7 @@ Patch: libz-sys-fix-metadata.diff # * unconditionally use pkg-config to link with system libz Patch: 0001-unconditionally-use-pkg-config-to-link-with-system-z.patch -BuildRequires: rust-packaging >= 21 +BuildRequires: cargo-rpm-macros >= 24 %global _description %{expand: Low-level bindings to the system libz library (also known as zlib).} @@ -79,11 +79,11 @@ use the "stock-zlib" feature of the "%{crate}" crate. %ghost %{crate_instdir}/Cargo.toml %prep -%autosetup -n %{crate}-%{version_no_tilde} -p1 +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep # remove bundled zlib and zlib-ng sources rm -r src/zlib/ rm -r src/zlib-ng/ -%cargo_prep %generate_buildrequires %cargo_generate_buildrequires diff --git a/rust2rpm.conf b/rust2rpm.conf deleted file mode 100644 index c2ea5c0..0000000 --- a/rust2rpm.conf +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -buildrequires = - pkgconfig(zlib) -lib.requires = - pkgconfig(zlib) diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..2704a72 --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,4 @@ +[requires] +build = ["pkgconfig(zlib)"] +lib = ["pkgconfig(zlib)"] + diff --git a/sources b/sources index 89b34c9..9199fac 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libz-sys-1.1.12.crate) = 03daeb5f03193887b692cbe8d631c83ac632f3e92fca4f10e881058fea38d85e11c090de04be9d70d52a22dec669474a0044a3d45d4adeb3a0f39e3398cdac11 +SHA512 (libz-sys-1.1.14.crate) = f02dd44bced6d97a226a51b9bfc85a9b5757cb16f414578dac9889aac8fe2fa1e1a53bc1de6991a0693f183518b53972f4b8d4a42117bab67325ada51b853d6d