From f73d43ee40ffe39505e562916de2010f3a944e4b Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 17 May 2024 21:36:53 +0200 Subject: [PATCH] Update to version 1.1.16; Fixes RHBZ#2260523 --- .gitignore | 1 + ...use-pkg-config-to-link-with-system-z.patch | 36 ++++++++++++------- libz-sys-fix-metadata.diff | 4 +-- rust-libz-sys.spec | 8 ++--- rust2rpm.toml | 12 +++++++ sources | 2 +- 6 files changed, 44 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index e8cc2b0..1f5b519 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /libz-sys-1.1.9.crate /libz-sys-1.1.12.crate /libz-sys-1.1.14.crate +/libz-sys-1.1.16.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 c0b92f3..2d1993e 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 7d6c389b4f3330696e737110bbb9f7c38101da55 Mon Sep 17 00:00:00 2001 +From b2c370ea75648dd768ed3605430e45b9c841267e Mon Sep 17 00:00:00 2001 From: Fabio Valentini -Date: Wed, 10 Jan 2024 17:12:19 +0100 +Date: Fri, 17 May 2024 21:30:52 +0200 Subject: [PATCH] unconditionally use pkg-config to link with system zlib --- - build.rs | 197 ++------------------------------------------------- - build_zng.rs | 60 ---------------- - 2 files changed, 4 insertions(+), 253 deletions(-) + build.rs | 209 +-------------------------------------------------- + build_zng.rs | 60 --------------- + 2 files changed, 4 insertions(+), 265 deletions(-) delete mode 100644 build_zng.rs diff --git a/build.rs b/build.rs -index 1368a12..8d1acf7 100644 +index e00ae65..8d1acf7 100644 --- a/build.rs +++ b/build.rs -@@ -1,198 +1,9 @@ +@@ -1,210 +1,9 @@ -use std::env; -use std::fs; -use std::path::PathBuf; @@ -51,7 +51,16 @@ index 1368a12..8d1acf7 100644 - .print_system_libs(false) - .probe("zlib"); - match zlib { -- Ok(_) => return, +- Ok(zlib) => { +- if !zlib.include_paths.is_empty() { +- let paths = zlib +- .include_paths +- .iter() +- .map(|s| s.display().to_string()) +- .collect::>(); +- println!("cargo:include={}", paths.join(",")); +- } +- } - Err(e) => { - println!("cargo-warning={}", e.to_string()) - } @@ -83,11 +92,10 @@ index 1368a12..8d1acf7 100644 - // Apple platforms have libz.1.dylib, and it's usually available even when - // cross compiling (via fat binary or in the target's Xcode SDK) - let cross_compiling = target != host; -- let apple_to_apple = host.contains("-apple-") && target.contains("-apple-"); - if target.contains("msvc") - || target.contains("pc-windows-gnu") - || want_static -- || (cross_compiling && !apple_to_apple) +- || (cross_compiling && !target.contains("-apple-")) - { - return build_zlib(&mut cfg, &target); - } @@ -205,7 +213,11 @@ index 1368a12..8d1acf7 100644 - -fn zlib_installed(cfg: &mut cc::Build) -> bool { - let mut cmd = cfg.get_compiler().to_command(); -- cmd.arg("src/smoke.c").arg("-o").arg("/dev/null").arg("-lz"); +- cmd.arg("src/smoke.c") +- .arg("-g0") +- .arg("-o") +- .arg("/dev/null") +- .arg("-lz"); - - println!("running {:?}", cmd); - if let Ok(status) = cmd.status() { @@ -283,5 +295,5 @@ index 2557625..0000000 - build_zlib_ng(&target, false); -} -- -2.43.0 +2.45.1 diff --git a/libz-sys-fix-metadata.diff b/libz-sys-fix-metadata.diff index 644269f..1789eef 100644 --- a/libz-sys-fix-metadata.diff +++ b/libz-sys-fix-metadata.diff @@ -1,5 +1,5 @@ ---- 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 +--- libz-sys-1.1.16/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ libz-sys-1.1.16/Cargo.toml 2024-05-17T19:32:28.270127+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 786e62c..3c469b7 100644 --- a/rust-libz-sys.spec +++ b/rust-libz-sys.spec @@ -1,11 +1,11 @@ -# Generated by rust2rpm 25 +# Generated by rust2rpm 26 %bcond_without check %global debug_package %{nil} %global crate libz-sys Name: rust-libz-sys -Version: 1.1.14 +Version: 1.1.16 Release: %autorelease Summary: Low-level bindings to the system libz library (also known as zlib) @@ -13,13 +13,14 @@ License: MIT OR Apache-2.0 URL: https://crates.io/crates/libz-sys Source: %{crates_source} # Manually created patch for downstream crate metadata changes -# * drop features for zlib-ng, static linking, and unavailalbe asm optimizations +# * drop features for zlib-ng support and statically linking libz Patch: libz-sys-fix-metadata.diff # * remove code related to building vendored zlib / zlib-ng sources # * unconditionally use pkg-config to link with system libz Patch: 0001-unconditionally-use-pkg-config-to-link-with-system-z.patch BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: pkgconfig(zlib) %global _description %{expand: Low-level bindings to the system libz library (also known as zlib).} @@ -87,7 +88,6 @@ rm -r src/zlib-ng/ %generate_buildrequires %cargo_generate_buildrequires -echo 'pkgconfig(zlib)' %build %cargo_build diff --git a/rust2rpm.toml b/rust2rpm.toml index 2704a72..7daa6b3 100644 --- a/rust2rpm.toml +++ b/rust2rpm.toml @@ -1,4 +1,16 @@ +[package] +cargo-toml-patch-comments = [ + "drop features for zlib-ng support and statically linking libz", +] + [requires] build = ["pkgconfig(zlib)"] lib = ["pkgconfig(zlib)"] +[scripts] +prep.post = [ + "# remove bundled zlib and zlib-ng sources", + "rm -r src/zlib/", + "rm -r src/zlib-ng/", +] + diff --git a/sources b/sources index 9199fac..15354fa 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libz-sys-1.1.14.crate) = f02dd44bced6d97a226a51b9bfc85a9b5757cb16f414578dac9889aac8fe2fa1e1a53bc1de6991a0693f183518b53972f4b8d4a42117bab67325ada51b853d6d +SHA512 (libz-sys-1.1.16.crate) = 1d6b65b5a5293d470cf8ed48293a6f8273828a0cdf096d286e777d438b2c4d076360b5492ee3c2c83b27605d51389e6a3eda7eaebfb09a6041a877a48540aef1