%define lib_major 1 %define lib_name %mklibname %{name}%{lib_major} %define devel_name %mklibname %{name} -d %define static_name %mklibname %{name} -d -s %define libminizip %mklibname minizip %{lib_major} %define minizip_devel %mklibname minizip -d %bcond_with minizip %bcond_without dietlibc Summary: The zlib compression and decompression library Name: zlib Version: 1.3.1 Release: %mkrel 3 Group: System/Libraries License: BSD URL: https://www.zlib.net/ Source0: https://www.zlib.net/%{name}-%{version}.tar.gz BuildRequires: util-linux %if %{with dietlibc} BuildRequires: dietlibc-devel %endif %if %{with minizip} BuildRequires: pkgconfig(zlib) %endif %description The zlib compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation), but other algorithms may be added later, which will have the same stream interface. The zlib library is used by many different system programs. %package -n %{lib_name} Summary: The zlib compression and decompression library Group: System/Libraries Requires(pre): filesystem >= 2.1.9-18 Provides: libz = %{version}-%{release} Provides: libz1 = %{version}-%{release} Provides: %{name} = %{version}-%{release} %description -n %{lib_name} The zlib compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation), but other algorithms may be added later, which will have the same stream interface. The zlib library is used by many different system programs. %package -n %{devel_name} Summary: Header files and libraries for developing apps which will use zlib Group: Development/C Requires: %{lib_name} = %{version}-%{release} Provides: libz-devel = %{version}-%{release} Provides: lib%{name}-devel = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} %description -n %{devel_name} The zlib-devel package contains the header files and libraries needed to develop programs that use the zlib compression and decompression library. Install the zlib-devel package if you want to develop applications that will use the zlib library. %package -n %{static_name} Summary: Static libraries for developing apps which will use zlib Group: Development/C Requires: %{devel_name} = %{version}-%{release} Provides: %{name}-static-devel = %{version}-%{release} %description -n %{static_name} The zlib-static-devel package contains the static libraries needed to develop programs that use the zlib compression and decompression library. Install the zlib-static-devel package if you want to develop applications that will use the zlib library statically. %if %{with minizip} %package -n %{libminizip} Summary: Minizip manipulates files from a .zip archive Group: System/Libraries %description -n %{libminizip} Minizip manipulates files from a .zip archive. %package -n %{minizip_devel} Summary: Development files for the minizip library Group: Development/C Requires: %{libminizip} = %{version}-%{release} Requires: zlib-devel = %{version}-%{release} Provides: libminizip-devel = %{version}-%{release} Provides: minizip-devel = %{version}-%{release} %description -n %{minizip_devel} This package contains the libraries and header files needed for developing applications which use minizip. %endif %prep %setup -q %autopatch -p1 %build #(peroyvind): be sure to remove -m64/-m32 flags as they're not overridable RPM_OPT_FLAGS="`echo $RPM_OPT_FLAGS| sed -e 's/-m.. //g'` -O3" mkdir objs cp -a $(ls | grep -v objs) objs/ pushd objs CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="%{?ldflags}" \ ./configure --shared --prefix=%{_prefix} --libdir=%{_libdir} %make_build make test popd %if %{with minizip} pushd contrib/minizip autoreconf --install %configure --enable-static=no %make_build popd %endif %if %{with dietlibc} mkdir objsdietlibc cp -a $(ls | grep -v objs) objsdietlibc/ pushd objsdietlibc CFLAGS="-Os" CC="diet gcc" \ ./configure --prefix=%{_prefix} %make_build libz.a popd %endif %install install -d %{buildroot}%{_prefix} install -d %{buildroot}%{_libdir} make install -C objs prefix=%{buildroot}%{_prefix} libdir=%{buildroot}%{_libdir} %if %{with minizip} pushd contrib/minizip %make_install popd %endif %if %{with dietlibc} install -m644 objsdietlibc/libz.a -D %{buildroot}%{_prefix}/lib/dietlibc/lib-%{_arch}/libz.a %endif %if %{with minizip} rm -fr %{buildroot}%{_libdir}/libminizip.la # https://bugzilla.redhat.com/show_bug.cgi?id=1424609 # https://github.com/madler/zlib/pull/229 rm -fr %{buildroot}%{_includedir}/minizip/crypt.h %endif %files -n %{lib_name} %doc README %{_libdir}/libz.so.%{lib_major}{,.*} %files -n %{devel_name} %doc README ChangeLog doc/algorithm.txt %{_mandir}/man3/zlib.3* %{_libdir}/libz.so %{_libdir}/pkgconfig/zlib.pc %{_includedir}/zconf.h %{_includedir}/zlib.h %files -n %{static_name} %{_libdir}/libz.a %if %{with dietlibc} %{_prefix}/lib/dietlibc/lib-%{_arch}/libz.a %endif %if %{with minizip} %files -n %{libminizip} %{_libdir}/libminizip.so.%{lib_major}{,.*} %files -n %{minizip_devel} %{_libdir}/pkgconfig/minizip.pc %{_libdir}/libminizip.so %{_includedir}/minizip/ %endif