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 new file mode 100644 index 0000000..6dfaf22 --- /dev/null +++ b/zstr-zlib-ng.patch @@ -0,0 +1,158 @@ +--- 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 + +-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.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 +@@ -39,7 +39,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) +@@ -81,7 +81,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)) + { + } +@@ -164,7 +164,7 @@ namespace WindowBits { + } // namespace WindowBits + + class z_stream_wrapper +- : public z_stream ++ : public zng_stream + { + public: + z_stream_wrapper(bool _is_input, int _level, int _window_bits) +@@ -178,11 +178,11 @@ public: + { + this->avail_in = 0; + this->next_in = nullptr;//Z_NULL +- 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 : 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); + } +@@ -190,11 +190,11 @@ public: + { + if (is_input) + { +- inflateEnd(this); ++ zng_inflateEnd(this); + } + else + { +- deflateEnd(this); ++ zng_deflateEnd(this); + } + } + private: +@@ -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)); +- 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 +@@ -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); +- 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() +@@ -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); + +@@ -382,7 +382,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; +@@ -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); +- 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); +@@ -492,7 +492,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 5c6a382..37676d8 100644 --- a/zstr.spec +++ b/zstr.spec @@ -1,58 +1,58 @@ # 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.0.7 +Version: 1.1.0 Release: %autorelease 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 +# Use zlib-ng directly rather than via the compatibility interface +Patch: %{name}-zlib-ng.patch + +BuildSystem: cmake -BuildRequires: cmake BuildRequires: gcc-c++ -BuildRequires: pkgconfig(zlib) +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 BuildArch: noarch -Requires: pkgconfig(zlib) +Requires: pkgconfig(zlib-ng) Provides: %{name}-static = %{version}-%{release} -%description devel %_desc +%description devel +%_desc %prep -%autosetup - -%build -%cmake -%cmake_build +%autosetup -p1 %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