diff --git a/zlib-ng-2.1.5.zip b/zlib-ng-2.1.5.zip new file mode 100644 index 0000000000000000000000000000000000000000..f999b303e4ff4cbe26ef608378b33cdf49dc8e31 Binary files /dev/null and b/zlib-ng-2.1.5.zip differ diff --git a/zlib-ng.spec b/zlib-ng.spec new file mode 100644 index 0000000000000000000000000000000000000000..7228f4de0fad1d58b2594f3f4ac38f9814fb39be --- /dev/null +++ b/zlib-ng.spec @@ -0,0 +1,138 @@ +%bcond_without compat + +Name: zlib-ng +Version: 2.1.5 +Release: 1 +Summary: Zlib data compression library for the next generation systems +License: zlib +Url: https://github.com/zlib-ng/zlib-ng +Source0: https://github.com/zlib-ng/zlib-ng/archive/%{version}/%{name}-%{version}.zip + +# Be explicit about the soname in order to avoid unintentional changes. +%global soname libz-ng.so.2 +%global compat_soname libz.so.1 +%global zlib_ver 1.3.0 +%global zlib_obsoletes 1.3 +%global main_dir %_builddir/%{name}-%{version} + +BuildRequires: cmake >= 3.1 +BuildRequires: gcc-c++ + +%description +zlib-ng is a zlib replacement that provides optimizations for "next generation" systems. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains static libraries and header files for +developing application that use %{name}. + + +%if %{with compat} + +%package compat +Summary: Zlib implementation provided by %{name} +Provides: zlib = %{zlib_ver} +Provides: zlib%{?_isa} = %{zlib_ver} +Conflicts: zlib%{?_isa} +Obsoletes: zlib < %{zlib_obsoletes} + +%description compat +zlib-ng is a zlib replacement that provides optimizations for "next generation" systems. +The %{name}-compat package contains the library that is API and binary compatible with zlib. + +%package compat-devel +Summary: Development files for %{name}-compat +Requires: %{name}-compat%{?_isa} = %{version}-%{release} +Provides: zlib-devel = %{zlib_ver} +Provides: zlib-devel%{?_isa} = %{zlib_ver} +Conflicts: zlib-devel%{?_isa} +Obsoletes: zlib-devel < %{zlib_obsoletes} + +%description compat-devel +The %{name}-compat-devel package contains libraries and header files for +developing application that use zlib. + +%endif + +%prep +%autosetup -p1 -n %{name}-%{version} + +%build +cat <<_EOF_ +########################################################################### +# +# Build the default zlib-ng library +# +########################################################################### +_EOF_ + +# zlib-ng uses a different macro for library directory. +%global make_param -DWITH_GTEST=OFF -DWITH_SANITIZERS=ON -DINSTALL_LIB_DIR=%{_libdir} +mkdir -p %{main_dir}/build +cd %{main_dir}/build +%cmake .. %{make_param} +%make_build + +%if %{with compat} +cat <<_EOF_ +########################################################################### +# +# Build the compat mode library +# +########################################################################### +_EOF_ + +# Disable new strategies in order to keep compatibility with zlib. +mkdir -p %{main_dir}/build-compat +cd %{main_dir}/build-compat +%cmake .. %{make_param} -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF +%make_build +%endif + + +%check +make test + +%install +cd %{main_dir}/build +%make_install + +%if %{with compat} +cd %{main_dir}/build-compat +%make_install +%endif + +%files +%{_libdir}/%{soname} +%{_libdir}/libz-ng.so.%{version} +%license LICENSE.md +%doc README.md + +%files devel +%{_includedir}/zconf-ng.h +%{_includedir}/zlib-ng.h +%{_includedir}/zlib_name_mangling-ng.h +%{_libdir}/libz-ng.so +%{_libdir}/pkgconfig/%{name}.pc + +%if %{with compat} + +%files compat +%{_libdir}/%{compat_soname} +%{_libdir}/libz.so.%{zlib_ver}.zlib-ng + +%files compat-devel +%{_includedir}/zconf.h +%{_includedir}/zlib.h +%{_includedir}/zlib_name_mangling.h +%{_libdir}/libz.so +%{_libdir}/pkgconfig/zlib.pc + +%endif + +%changelog +* Thu Jan 4 2024 liqiang - 2.1.5-1 +- Initial commit