%define major 1 %define libname %mklibname z %{major} %define develname %mklibname z -d %define sdevelname %mklibname z -d -s %define major_ng 2 %define libname_ng %mklibname z-ng %{major_ng} %define develname_ng %mklibname z-ng -d %define sdevelname_ng %mklibname z-ng -d -s # when building for old releases, # set bcond_with replace_zlib # to avoid replacing traditional zlib %bcond_without replace_zlib Name: zlib-ng Version: 2.1.6 Release: %mkrel 1.1 Summary: Zlib replacement with optimizations Group: System/Libraries License: zlib Url: https://github.com/zlib-ng/zlib-ng Source0: https://github.com/zlib-ng/zlib-ng/archive/%{version}/%{name}-%{version}.tar.gz Patch0: zlib-ng-2.1.5-pkgconfig-fix-libtool-mess.patch # (tpg) patches from upstream stable branch # (currently none) BuildRequires: cmake BuildRequires: ninja %description zlib-ng is a zlib replacement that provides optimizations for "next generation" systems. The motivation for this fork was seeing several 3rd party contributions with new optimizations not getting implemented into the official zlib repository. %if %{with replace_zlib} %package -n %{libname} Summary: Zlib replacement with optimizations (compat) Group: System/Libraries Obsoletes: %{_lib}zlib1 < 1.3.2 %description -n %{libname} zlib-ng is a zlib replacement that provides optimizations for "next generation" systems (compat). The motivation for this fork was seeing several 3rd party contributions with new optimizations not getting implemented into the official zlib repository. %package -n %{develname} Summary: Development files for %{name} (compat) Group: Development/C Requires: %{libname} = %{version}-%{release} Provides: zlib-devel = %{version}-%{release} Obsoletes: %{_lib}zlib-devel < 1.3.2 %description -n %{develname} The zlib-devel package contains header files for developing application that use %{name} (compat). %package -n %{sdevelname} Summary: Static libraries for %{name} (compat) Group: Development/C Requires: %{develname} = %{version}-%{release} Provides: zlib-static-devel = %{version}-%{release} Obsoletes: %{_lib}zlib-static-devel < 1.3.2 %description -n %{sdevelname} The zlib-static-devel package contains static libraries for developing application that use %{name} (compat). %endif %package -n %{libname_ng} Summary: Zlib replacement with optimizations Group: System/Libraries %description -n %{libname_ng} zlib-ng is a zlib replacement that provides optimizations for "next generation" systems. The motivation for this fork was seeing several 3rd party contributions with new optimizations not getting implemented into the official zlib repository. %package -n %{develname_ng} Summary: Development files for %{name} Group: Development/C Requires: %{libname_ng} = %{version}-%{release} Provides: zlib-ng-devel = %{version}-%{release} %description -n %{develname_ng} The %{name}-devel package contains header files for developing application that use %{name}. %package -n %{sdevelname_ng} Summary: Static libraries for %{name} Group: Development/C Requires: %{develname_ng} = %{version}-%{release} Provides: zlib-ng-static-devel = %{version}-%{release} %description -n %{sdevelname_ng} The %{name}-static-devel package contains static libraries for developing application that use %{name}. %prep %autosetup -p1 %build # zlib-ng uses nonstandard behavior for BUILD_SHARED_LIBS/BUILD_STATIC_LIBS # BUILD_SHARED_LIBS=ON here means build ONLY shared libs # BUILD_STATIC_LIBS=ON is ignored # BUILD_SHARED_LIBS unset means build both shared and static libs. %if %{with replace_zlib} %define _vpath_builddir %{_target_platform}-build-compat %cmake \ -DWITH_SANITIZERS:BOOL=ON \ -DINSTALL_LIB_DIR=%{_libdir} \ -DZLIB_COMPAT:BOOL=ON \ -DWITH_GTEST:BOOL=OFF \ -UBUILD_SHARED_LIBS \ -G Ninja %cmake_build %endif %define _vpath_builddir %{_target_platform}-build-ng %cmake \ -DWITH_SANITIZERS:BOOL=ON \ -DINSTALL_LIB_DIR=%{_libdir} \ -DZLIB_COMPAT:BOOL=OFF \ -DWITH_GTEST:BOOL=OFF \ -UBUILD_SHARED_LIBS \ -G Ninja %cmake_build %install %if %{with replace_zlib} %define _vpath_builddir %{_target_platform}-build-compat %cmake_install %endif %define _vpath_builddir %{_target_platform}-build-ng %cmake_install %if %{with replace_zlib} %files -n %{libname} %license LICENSE.md %doc README.md %{_libdir}/libz.so.%{major}{,.*} %files -n %{develname} %{_includedir}/zlib.h %{_includedir}/zconf.h %{_includedir}/zlib_name_mangling.h %{_libdir}/libz.so %{_libdir}/pkgconfig/zlib.pc %{_libdir}/cmake/ZLIB/ %files -n %{sdevelname} %{_libdir}/libz.a %endif %files -n %{libname_ng} %license LICENSE.md %doc README.md %{_libdir}/libz-ng.so.%{major_ng}{,.*} %files -n %{develname_ng} %{_includedir}/zlib-ng.h %{_includedir}/zconf-ng.h %{_includedir}/zlib_name_mangling-ng.h %{_libdir}/libz-ng.so %{_libdir}/cmake/zlib-ng/ %{_libdir}/pkgconfig/zlib-ng.pc %files -n %{sdevelname_ng} %{_libdir}/libz-ng.a