From 946bff720a0f09e7b6ec717a3f3e2a809a7bbac4 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Wed, 17 Jul 2024 16:22:03 -0600 Subject: [PATCH 1/9] Add VCS field --- zstr.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zstr.spec b/zstr.spec index 5c6a382..22cd3e0 100644 --- a/zstr.spec +++ b/zstr.spec @@ -8,7 +8,8 @@ Summary: A C++ header-only ZLib wrapper License: MIT URL: https://github.com/mateidavid/zstr -Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +VCS : git:%{url}.git +Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: gcc-c++ From 21436f7697c11df1319a9047dfacfd9b6ad58ee2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 10:58:11 +0000 Subject: [PATCH 2/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From bc84761c5d6fb4f42fd15d930ea7b3717dbec8fe Mon Sep 17 00:00:00 2001 From: Jerry James Date: Mon, 23 Sep 2024 11:26:18 -0600 Subject: [PATCH 3/9] Use zlib-ng directly rather than via the compatibility interface --- zstr-zlib-ng.patch | 165 +++++++++++++++++++++++++++++++++++++++++++++ zstr.spec | 8 ++- 2 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 zstr-zlib-ng.patch diff --git a/zstr-zlib-ng.patch b/zstr-zlib-ng.patch new file mode 100644 index 0000000..5c2e9ec --- /dev/null +++ b/zstr-zlib-ng.patch @@ -0,0 +1,165 @@ +--- zstr-1.0.7/CMakeLists.txt.orig 2022-12-06 02:31:27.000000000 -0700 ++++ zstr-1.0.7/CMakeLists.txt 2024-09-18 13:17:30.552013743 -0600 +@@ -16,8 +16,8 @@ endif() + + # -- locate zlib + +-find_package(ZLIB 1.2.3 REQUIRED) # defines imported target ZLIB::ZLIB +-message(STATUS "zstr - found ZLIB (version: ${ZLIB_VERSION_STRING})") ++find_package(zlib-ng 2.1.0 REQUIRED) # defines imported target zlib-ng::zlib ++message(STATUS "zstr - found ZLIB (version: ${zlib-ng_VERSION_STRING})") + + # -- add target + +@@ -27,20 +27,19 @@ add_library(zstr::zstr ALIAS zstr) + # -- set target properties + + target_include_directories(zstr INTERFACE "${PROJECT_SOURCE_DIR}/src") +-target_link_libraries(zstr INTERFACE ZLIB::ZLIB) +-target_compile_features(zstr INTERFACE cxx_std_11) # require c++11 flag ++target_link_libraries(zstr INTERFACE zlib-ng::zlib) + + # -- set cache variables + + # NOTE: these vars are mostly useful to people using cmake < 3.13 +-set(ZSTR_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src;${ZLIB_INCLUDE_DIRS}" CACHE PATH "" FORCE) +-set(ZSTR_LIBRARIES "${ZLIB_LIBRARIES}" CACHE PATH "" FORCE) ++set(ZSTR_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src;${zlib-ng_INCLUDE_DIR}" CACHE PATH "" FORCE) ++set(ZSTR_LIBRARIES "z-ng" CACHE PATH "" FORCE) + + # -- print target summary + + message(STATUS + "zstr - added INTERFACE target 'zstr::zstr' + includes : ${ZSTR_INCLUDE_DIRS} +- libraries: ZLIB::ZLIB ++ libraries: zlib-ng::zlib + features : cxx_std_11" + ) +--- zstr-1.0.7/src/zstr.hpp.orig 2022-12-06 02:31:27.000000000 -0700 ++++ zstr-1.0.7/src/zstr.hpp 2024-09-18 14:09:15.735533320 -0600 +@@ -11,7 +11,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include "strict_fstream.hpp" +@@ -34,7 +34,7 @@ class Exception + : public std::ios_base::failure + { + public: +- static std::string error_to_message(z_stream * zstrm_p, int ret) ++ static std::string error_to_message(zng_stream * zstrm_p, int ret) + { + std::string msg = "zlib: "; + switch (ret) +@@ -76,7 +76,7 @@ public: + return msg; + } + +- Exception(z_stream * zstrm_p, int ret) ++ Exception(zng_stream * zstrm_p, int ret) + : std::ios_base::failure(error_to_message(zstrm_p, ret)) + { + } +@@ -86,7 +86,7 @@ namespace detail + { + + class z_stream_wrapper +- : public z_stream ++ : public zng_stream + { + public: + z_stream_wrapper(bool _is_input, int _level, int _window_bits) +@@ -100,11 +100,11 @@ public: + { + this->avail_in = 0; + this->next_in = nullptr;//Z_NULL +- ret = inflateInit2(this, _window_bits ? _window_bits : 15+32); ++ ret = zng_inflateInit2(this, _window_bits ? _window_bits : 15+32); + } + else + { +- ret = deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : 15+16, 8, Z_DEFAULT_STRATEGY); ++ ret = zng_deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : 15+16, 8, Z_DEFAULT_STRATEGY); + } + if (ret != Z_OK) throw Exception(this, ret); + } +@@ -112,11 +112,11 @@ public: + { + if (is_input) + { +- inflateEnd(this); ++ zng_inflateEnd(this); + } + else + { +- deflateEnd(this); ++ zng_deflateEnd(this); + } + } + private: +@@ -187,15 +187,15 @@ public: + // empty input buffer: refill from the start + in_buff_start = in_buff.get(); + std::streamsize sz = sbuf_p->sgetn(in_buff.get(), static_cast(buff_size)); +- in_buff_end = in_buff_start + sz; ++ in_buff_end = const_cast(in_buff_start) + sz; + if (in_buff_end == in_buff_start) break; // end of input + } + // auto detect if the stream contains text or deflate data + if (auto_detect && ! auto_detect_run) + { + auto_detect_run = true; +- unsigned char b0 = *reinterpret_cast< unsigned char * >(in_buff_start); +- unsigned char b1 = *reinterpret_cast< unsigned char * >(in_buff_start + 1); ++ unsigned char b0 = *reinterpret_cast< const unsigned char * >(in_buff_start); ++ unsigned char b1 = *reinterpret_cast< const unsigned char * >(in_buff_start + 1); + // Ref: + // http://en.wikipedia.org/wiki/Gzip + // http://stackoverflow.com/questions/9050260/what-does-a-zlib-header-look-like +@@ -222,12 +222,12 @@ public: + zstrm_p->avail_in = uint32_t(in_buff_end - in_buff_start); + zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff_free_start); + zstrm_p->avail_out = uint32_t((out_buff.get() + buff_size) - out_buff_free_start); +- int ret = inflate(zstrm_p.get(), Z_NO_FLUSH); ++ int ret = zng_inflate(zstrm_p.get(), Z_NO_FLUSH); + // process return code + if (ret != Z_OK && ret != Z_STREAM_END) throw Exception(zstrm_p.get(), ret); + // update in&out pointers following inflate() + in_buff_start = reinterpret_cast< decltype(in_buff_start) >(zstrm_p->next_in); +- in_buff_end = in_buff_start + zstrm_p->avail_in; ++ in_buff_end = const_cast(in_buff_start) + zstrm_p->avail_in; + out_buff_free_start = reinterpret_cast< decltype(out_buff_free_start) >(zstrm_p->next_out); + assert(out_buff_free_start + zstrm_p->avail_out == out_buff.get() + buff_size); + +@@ -249,7 +249,7 @@ public: + private: + std::streambuf * sbuf_p; + std::unique_ptr in_buff; +- char * in_buff_start; ++ const char * in_buff_start; + char * in_buff_end; + std::unique_ptr out_buff; + std::unique_ptr zstrm_p; +@@ -288,7 +288,7 @@ public: + { + zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff.get()); + zstrm_p->avail_out = uint32_t(buff_size); +- int ret = deflate(zstrm_p.get(), flush); ++ int ret = zng_deflate(zstrm_p.get(), flush); + if (ret != Z_OK && ret != Z_STREAM_END && ret != Z_BUF_ERROR) { + failed = true; + throw Exception(zstrm_p.get(), ret); +@@ -346,7 +346,7 @@ public: + zstrm_p->next_in = nullptr; + zstrm_p->avail_in = 0; + if (deflate_loop(Z_FINISH) != 0) return -1; +- deflateReset(zstrm_p.get()); ++ zng_deflateReset(zstrm_p.get()); + return 0; + } + private: diff --git a/zstr.spec b/zstr.spec index 22cd3e0..48fe96b 100644 --- a/zstr.spec +++ b/zstr.spec @@ -10,10 +10,12 @@ License: MIT URL: https://github.com/mateidavid/zstr VCS : git:%{url}.git Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +# Use zlib-ng directly rather than via the compatibility interface +Patch: %{name}-zlib-ng.patch BuildRequires: cmake BuildRequires: gcc-c++ -BuildRequires: pkgconfig(zlib) +BuildRequires: pkgconfig(zlib-ng) # See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} @@ -34,13 +36,13 @@ is the compression level.} %package devel Summary: A C++ header-only ZLib wrapper BuildArch: noarch -Requires: pkgconfig(zlib) +Requires: pkgconfig(zlib-ng) Provides: %{name}-static = %{version}-%{release} %description devel %_desc %prep -%autosetup +%autosetup -p1 %build %cmake From 108871b15e6126bd1a8f427db4c969e59e1ab624 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 16:53:42 +0000 Subject: [PATCH 4/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 1d22c05693fcf3a2da3db15981c3aa3bc77d6912 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 21:21:24 +0000 Subject: [PATCH 5/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From a5fcbe0b38575b94772026dc679145afd1904be7 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Mon, 20 Oct 2025 12:06:47 -0600 Subject: [PATCH 6/9] Version 1.1.0 --- sources | 2 +- zstr-zlib-ng.patch | 63 +++++++++++++++++++++------------------------- zstr.spec | 22 ++++++++-------- 3 files changed, 40 insertions(+), 47 deletions(-) diff --git a/sources b/sources index 7d2ab3f..b3e4d5b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (zstr-1.0.7.tar.gz) = 3017da244810a45f7111f76f8d0dd988e162f08eab28b7465cad4549d84200fc834975275daf9588d35c6125e6f167c1e2dd5ec18022dac1eceabdc24d24cffe +SHA512 (zstr-1.1.0.tar.gz) = 21778d2b07c30da4fb9ee35832f39b02c95e54478c6610e28cece98908c51bcee6aed0754ec3948b71aa1e671a3d15ff2b555369379dc4583048c76d2b8305e8 diff --git a/zstr-zlib-ng.patch b/zstr-zlib-ng.patch index 5c2e9ec..6dfaf22 100644 --- a/zstr-zlib-ng.patch +++ b/zstr-zlib-ng.patch @@ -1,5 +1,5 @@ ---- zstr-1.0.7/CMakeLists.txt.orig 2022-12-06 02:31:27.000000000 -0700 -+++ zstr-1.0.7/CMakeLists.txt 2024-09-18 13:17:30.552013743 -0600 +--- zstr-1.1.0/CMakeLists.txt.orig 2025-10-20 09:17:37.000000000 -0600 ++++ zstr-1.1.0/CMakeLists.txt 2025-10-20 11:45:56.725568759 -0600 @@ -16,8 +16,8 @@ endif() # -- locate zlib @@ -36,18 +36,18 @@ + libraries: zlib-ng::zlib features : cxx_std_11" ) ---- zstr-1.0.7/src/zstr.hpp.orig 2022-12-06 02:31:27.000000000 -0700 -+++ zstr-1.0.7/src/zstr.hpp 2024-09-18 14:09:15.735533320 -0600 -@@ -11,7 +11,7 @@ - #include - #include - #include +--- zstr-1.1.0/src/zstr.hpp.orig 2025-10-20 09:17:37.000000000 -0600 ++++ zstr-1.1.0/src/zstr.hpp 2025-10-20 11:49:38.553413378 -0600 +@@ -15,7 +15,7 @@ + #ifdef MINIZ + #include + #else -#include +#include + #endif #include #include - #include "strict_fstream.hpp" -@@ -34,7 +34,7 @@ class Exception +@@ -39,7 +39,7 @@ class Exception : public std::ios_base::failure { public: @@ -56,7 +56,7 @@ { std::string msg = "zlib: "; switch (ret) -@@ -76,7 +76,7 @@ public: +@@ -81,7 +81,7 @@ public: return msg; } @@ -65,8 +65,8 @@ : std::ios_base::failure(error_to_message(zstrm_p, ret)) { } -@@ -86,7 +86,7 @@ namespace detail - { +@@ -164,7 +164,7 @@ namespace WindowBits { + } // namespace WindowBits class z_stream_wrapper - : public z_stream @@ -74,21 +74,21 @@ { public: z_stream_wrapper(bool _is_input, int _level, int _window_bits) -@@ -100,11 +100,11 @@ public: +@@ -178,11 +178,11 @@ public: { this->avail_in = 0; this->next_in = nullptr;//Z_NULL -- ret = inflateInit2(this, _window_bits ? _window_bits : 15+32); -+ ret = zng_inflateInit2(this, _window_bits ? _window_bits : 15+32); +- ret = inflateInit2(this, _window_bits ? _window_bits : WindowBits::ZLIB_OR_GZIP::MAX); ++ ret = zng_inflateInit2(this, _window_bits ? _window_bits : WindowBits::ZLIB_OR_GZIP::MAX); } else { -- ret = deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : 15+16, 8, Z_DEFAULT_STRATEGY); -+ ret = zng_deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : 15+16, 8, Z_DEFAULT_STRATEGY); +- ret = deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : WindowBits::GZIP::MAX, 8, Z_DEFAULT_STRATEGY); ++ ret = zng_deflateInit2(this, _level, Z_DEFLATED, _window_bits ? _window_bits : WindowBits::GZIP::MAX, 8, Z_DEFAULT_STRATEGY); } if (ret != Z_OK) throw Exception(this, ret); } -@@ -112,11 +112,11 @@ public: +@@ -190,11 +190,11 @@ public: { if (is_input) { @@ -102,7 +102,7 @@ } } private: -@@ -187,15 +187,15 @@ public: +@@ -323,7 +323,7 @@ public: // empty input buffer: refill from the start in_buff_start = in_buff.get(); std::streamsize sz = sbuf_p->sgetn(in_buff.get(), static_cast(buff_size)); @@ -111,17 +111,7 @@ if (in_buff_end == in_buff_start) break; // end of input } // auto detect if the stream contains text or deflate data - if (auto_detect && ! auto_detect_run) - { - auto_detect_run = true; -- unsigned char b0 = *reinterpret_cast< unsigned char * >(in_buff_start); -- unsigned char b1 = *reinterpret_cast< unsigned char * >(in_buff_start + 1); -+ unsigned char b0 = *reinterpret_cast< const unsigned char * >(in_buff_start); -+ unsigned char b1 = *reinterpret_cast< const unsigned char * >(in_buff_start + 1); - // Ref: - // http://en.wikipedia.org/wiki/Gzip - // http://stackoverflow.com/questions/9050260/what-does-a-zlib-header-look-like -@@ -222,12 +222,12 @@ public: +@@ -349,7 +349,7 @@ public: zstrm_p->avail_in = uint32_t(in_buff_end - in_buff_start); zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff_free_start); zstrm_p->avail_out = uint32_t((out_buff.get() + buff_size) - out_buff_free_start); @@ -130,13 +120,16 @@ // process return code if (ret != Z_OK && ret != Z_STREAM_END) throw Exception(zstrm_p.get(), ret); // update in&out pointers following inflate() - in_buff_start = reinterpret_cast< decltype(in_buff_start) >(zstrm_p->next_in); +@@ -360,7 +360,7 @@ public: + zstrm_p->next_in + #endif + ); - in_buff_end = in_buff_start + zstrm_p->avail_in; + in_buff_end = const_cast(in_buff_start) + zstrm_p->avail_in; out_buff_free_start = reinterpret_cast< decltype(out_buff_free_start) >(zstrm_p->next_out); assert(out_buff_free_start + zstrm_p->avail_out == out_buff.get() + buff_size); -@@ -249,7 +249,7 @@ public: +@@ -382,7 +382,7 @@ public: private: std::streambuf * sbuf_p; std::unique_ptr in_buff; @@ -145,7 +138,7 @@ char * in_buff_end; std::unique_ptr out_buff; std::unique_ptr zstrm_p; -@@ -288,7 +288,7 @@ public: +@@ -424,7 +424,7 @@ public: { zstrm_p->next_out = reinterpret_cast< decltype(zstrm_p->next_out) >(out_buff.get()); zstrm_p->avail_out = uint32_t(buff_size); @@ -154,7 +147,7 @@ if (ret != Z_OK && ret != Z_STREAM_END && ret != Z_BUF_ERROR) { failed = true; throw Exception(zstrm_p.get(), ret); -@@ -346,7 +346,7 @@ public: +@@ -492,7 +492,7 @@ public: zstrm_p->next_in = nullptr; zstrm_p->avail_in = 0; if (deflate_loop(Z_FINISH) != 0) return -1; diff --git a/zstr.spec b/zstr.spec index 48fe96b..1147d21 100644 --- a/zstr.spec +++ b/zstr.spec @@ -2,7 +2,7 @@ %global debug_package %{nil} Name: zstr -Version: 1.0.7 +Version: 1.1.0 Release: %autorelease Summary: A C++ header-only ZLib wrapper @@ -20,18 +20,17 @@ BuildRequires: pkgconfig(zlib-ng) # See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} -%global _desc %{expand: -This C++ header-only library enables the use of C++ standard iostreams -to access ZLib-compressed streams. +%global _desc %{expand:This C++ header-only library enables the use of C++ standard iostreams to +access ZLib-compressed streams. -For input access (decompression), the compression format is -auto-detected, and multiple concatenated compressed streams are -decompressed seamlessly. +For input access (decompression), the compression format is auto-detected, and +multiple concatenated compressed streams are decompressed seamlessly. -For output access (compression), the only parameter exposed by this API -is the compression level.} +For output access (compression), the only parameter exposed by this API is the +compression level.} -%description %_desc +%description +%_desc %package devel Summary: A C++ header-only ZLib wrapper @@ -39,7 +38,8 @@ BuildArch: noarch Requires: pkgconfig(zlib-ng) Provides: %{name}-static = %{version}-%{release} -%description devel %_desc +%description devel +%_desc %prep %autosetup -p1 From 5288b1ba5f994d8bc7cbbf22878123f4a6ac67d3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 17 Jan 2026 21:11:33 +0000 Subject: [PATCH 7/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild From 429d557e7520942e090f869591cee05c25a4a8bb Mon Sep 17 00:00:00 2001 From: Jerry James Date: Tue, 14 Jul 2026 19:34:48 -0600 Subject: [PATCH 8/9] Use the cmake declarative buildsystem --- zstr.spec | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/zstr.spec b/zstr.spec index 1147d21..37676d8 100644 --- a/zstr.spec +++ b/zstr.spec @@ -1,6 +1,9 @@ # There are no ELF objects in this package, so turn off debuginfo generation. %global debug_package %{nil} +# Whether to run tests +%bcond ctest 1 + Name: zstr Version: 1.1.0 Release: %autorelease @@ -13,7 +16,8 @@ Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz # Use zlib-ng directly rather than via the compatibility interface Patch: %{name}-zlib-ng.patch -BuildRequires: cmake +BuildSystem: cmake + BuildRequires: gcc-c++ BuildRequires: pkgconfig(zlib-ng) @@ -44,18 +48,11 @@ Provides: %{name}-static = %{version}-%{release} %prep %autosetup -p1 -%build -%cmake -%cmake_build - %install #%%cmake_install does nothing, so install manually mkdir -p %{buildroot}%{_includedir}/zstr install -m 0644 -p src/*.hpp %{buildroot}%{_includedir}/zstr -%check -%ctest - %files devel %doc README.org %license LICENSE From 398e6832518c2837a9b173714f515d295eca80d0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jul 2026 09:44:09 +0000 Subject: [PATCH 9/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild