File minizip-ng.spec of Package minizip-ng

#
# spec file for package minizip-ng
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define build_flavor %{nil}
%define pkg_name minizip-ng

# TODO
%if "%{build_flavor}" == "compat"
Name:           minizip
%define         soname libminizip1
%define         devname devel-compat
%define         compat_mode ON
%else
Name:           minizip-ng
%define         soname libminizip-ng4
%define         devname devel
%define         compat_mode OFF
%endif

Version:        4.0.10
Release:        1.1
Summary:        Companion library to zlib-ng for reading and writing ZIP files
License:        Zlib
URL:            https://github.com/zlib-ng/minizip-ng
Source:         https://github.com/zlib-ng/minizip-ng/archive/refs/tags/%version.tar.gz
Patch0:         minizip-ng_find_libz-ng.patch
Patch1:         minizip-ng_shared-zstd.patch
BuildRequires:  cmake >= 3.11.0
BuildRequires:  gcc-c++
BuildRequires:  gtest
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(zlib-ng)

%description
%{name} is a ZIP file manipulation library.

It has support for:
* Basic read-write operation on zip archives (adding files and removing
  files) on a high-level and also raw zip entry data
* ZIP64 extension for large files
* Zlib, BZIP2, LZMA, XZ, and ZSTD compression methods
* PKWARE- and Winzip-AES styles password protection
* NTFS timestamp support for UTC last modified, last accessed, and creation dates
* zip archive splitting
* Follow/store symbolic links
* UTF-8, cp437, cp932, cp936 and cp950 filename character set support

%package %{devname}
Summary:        Development files for %{name}
Requires:       %{soname} = %{version}
Requires:       libzstd-devel-static
Requires:       pkgconfig(bzip2)
Requires:       pkgconfig(liblzma)
Requires:       pkgconfig(libzstd)
Requires:       pkgconfig(openssl)

%description %{devname}
This package contains the C header and CMake config files.

%package -n %{soname}
Summary:        Companion library to zlib-ng for reading and writing ZIP files
Group:          System/Libraries

%description -n %{soname}
%{name} is a ZIP file manipulation library.

It has support for:
* Basic read-write operation on zip archives (adding files and removing
  files) on a high-level and also raw zip entry data
* ZIP64 extension for large files
* Zlib, BZIP2, LZMA, XZ, and ZSTD compression methods
* PKWARE- and Winzip-AES styles password protection
* NTFS timestamp support for UTC last modified, last accessed, and creation dates
* zip archive splitting
* Follow/store symbolic links
* UTF-8, cp437, cp932, cp936 and cp950 filename character set support

%prep
%autosetup -p1 -n %{pkg_name}-%{version}
# don't force dependent packages on FindZLIBNG.cmake script, just look up zlib-ng directly
sed -i -e 's:ZLIBNG:zlib-ng:g' CMakeLists.txt

%build
%cmake \
    -DMZ_COMPAT=%{compat_mode} \
    -DSKIP_INSTALL_BINARIES=ON \
    -DMZ_SIGNING=ON  \
    -DMZ_FORCE_FETCH_LIBS=OFF \
    -DMZ_BUILD_TESTS=ON \
    -DMZ_BUILD_UNIT_TESTS=ON

%cmake_build

%install
%cmake_install

%check
cd build && ctest --output-on-failure %{version}

%files %{devname}
%license LICENSE
%{_includedir}/minizip*/
%{_libdir}/cmake/minizip*/
%{_libdir}/libminizip*.so
%{_libdir}/pkgconfig/minizip*.pc
%doc *.md
%doc doc/

%ldconfig_scriptlets -n %{soname}

%files -n %{soname}
%license LICENSE
%{_libdir}/libminizip*.so.*

%changelog
* Fri Jan 19 2024 Hans-Peter Jansen <hpj@urpla.net>
- Remove TODO.multibuild, Factory build chokes on it
* Thu Jan 18 2024 Marcus Rueckert <mrueckert@suse.de>
- Fix the soname of the non-compat package
* Thu Jan 18 2024 Marcus Rueckert <mrueckert@suse.de>
- Enable signing mode again. Passes testsuite now.
* Thu Jan 18 2024 Marcus Rueckert <mrueckert@suse.de>
- Prepare building both the compat mode and the non compat API
  To activate this rename TODO.multibuild to _multibuild.
* Thu Jan 18 2024 Marcus Rueckert <mrueckert@suse.de>
- Update to release 4.0.4
  - Fix unzLocateFile 3rd parameter by @tuliom in #746
  - Silence MZ_COMPAT_VERSION warnings by @brad0 in #751
  - Silence -Wunused-but-set-variable warnings by @brad0 in #752
  - Remove DOS line endings by @brad0 in #753
- Changes from 4.0.3
  - Fix for filenames of the form "x/../y" by @pmqs in #742
  - Check for zero length path in mz_path_has_slash by @pmqs in
    [#741]
  - Match default compression level value in compress streams #726
  - Use ZSTD compression level defaults. #726
  - Fixed possible memory leak if realloc fails.
- Changes from 4.0.2
  - Support compression levels >= 10 and use zstd's internal
    default level. by @mkasick in #730
  - Fix lzma compression level #731 by @gix in #732
  - Get mz_dir_make to test for an empty path by @pmqs in #738
  - Silence warnings about BSD_SOURCE being deprecated.
  - Fixed implicit conversion precision warnings by @NickBrighten
    in #728
  - Fix pkgconfig file for private dependencies by @autoantwort in
    [#729]
* Sat Sep  2 2023 Jan Engelhardt <jengelh@inai.de>
- Update to release 4.0.1
  * Added optional support for AES CBC mode to mz_crypt_aes.
  * Support AAD in AES-GCM
* Mon Aug 28 2023 Hans-Peter Jansen <hpj@urpla.net>
- Place includes under /usr/include/minizip-ng
* Mon Aug 28 2023 Hans-Peter Jansen <hpj@urpla.net>
- Version 3.0.10: initial build
openSUSE Build Service is sponsored by