--- /dev/null
+###############################################################################
+# IPFire.org - An Open Source Firewall Solution #
+# Copyright (C) - IPFire Development Team <info@ipfire.org> #
+###############################################################################
+
+name = zlib-ng
+version = 2.2.4
+release = 1
+
+groups = System/Libraries
+url = https://github.com/zlib-ng/zlib-ng
+license = zlib
+summary = zlib replacement with optimizations for "next generation" systems
+
+description
+ zlib-ng is a replacement for zlib which incorporates improvements
+ from various sources.
+end
+
+source_dl = %{github_url}
+
+# This package is compatible with zlib in version 1.3.1
+zlib_version = 1.3.1
+
+build
+ requires
+ cmake
+ end
+
+ build
+ mkdir -pv build build-compat
+
+ # Build the regular version
+ pushd build
+ %{cmake} .. \
+ -DWITH_GTEST=OFF
+ %{make_build}
+ popd
+
+ # Build the drop-in replacement
+ pushd build-compat
+ %{cmake} .. \
+ -DWITH_GTEST=OFF \
+ -DZLIB_COMPAT=ON \
+ -DWITH_NEW_STRATEGIES=OFF
+ %{make_build}
+ popd
+ end
+
+ test
+ pushd build
+ make test
+ popd
+
+ pushd build-compat
+ make test
+ popd
+ end
+
+ install
+ pushd build
+ %{make_install}
+ popd
+
+ pushd build-compat
+ %{make_install}
+ popd
+ end
+end
+
+packages
+ package %{name}
+
+ package %{name}-compat
+ summary = Compatibility library of zlib-ng
+
+ provides = zlib = %{zlib_version}
+ obsoletes = zlib <= %{zlib_version}
+ conflicts = zlib
+
+ files
+ %{libdir}/libz.so.*
+ end
+ end
+
+ package %{name}-devel
+ template DEVEL
+
+ files += %{libdir}/cmake/zlib-ng
+ end
+
+ package %{name}-compat-devel
+ summary = Development headers to the legacy version of zlib
+
+ requires = %{name}-compat = %{thisver}
+ provides = zlib-devel = %{zlib_version}
+ obsoletes = zlib-devel <= %{zlib_version}
+ conflicts = zlib-devel
+
+ files
+ %{includedir}
+ !%{includedir}/*-ng*
+ %{libdir}/cmake/ZLIB
+ %{libdir}/libz.so
+ %{libdir}/pkgconfig/zlib.pc
+ end
+ end
+
+ package %{name}-debuginfo
+ template DEBUGINFO
+ end
+end
+++ /dev/null
-###############################################################################
-# IPFire.org - An Open Source Firewall Solution #
-# Copyright (C) - IPFire Development Team <info@ipfire.org> #
-###############################################################################
-
-name = zlib
-version = 1.3.1
-release = 1
-
-groups = System/Libraries
-url = https://zlib.net/
-license = zlib
-summary = The zlib compression and decompression library.
-
-description
- Zlib is a general-purpose, patent-free, lossless data compression
- library which is used by many different programs.
-end
-
-source_dl = https://zlib.net/
-
-# Enable PIC build.
-CFLAGS += -fPIC -DPIC
-
-build
- configure_options = \
- --prefix=%{prefix} \
- --libdir=%{libdir}
-
- test
- make check
- end
-
- install_cmds
- mkdir -pv %{BUILDROOT}%{includedir} %{BUILDROOT}%{libdir}
- cp -pfv zconf.h zlib.h %{BUILDROOT}%{includedir}
- end
-end
-
-packages
- package %{name}
-
- package %{name}-devel
- template DEVEL
- end
-
- package %{name}-debuginfo
- template DEBUGINFO
- end
-end