zlib/zlib.spec

226 lines
6.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package zlib
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%bcond_with profiling
Name: zlib
Version: 1.2.8
Release: 0
Summary: Library implementing the DEFLATE compression algorithm
License: Zlib
Group: Development/Libraries/C and C++
Url: http://www.zlib.net/
Source0: http://zlib.net/zlib-%{version}.tar.gz
Source1: LICENSE
Source2: baselibs.conf
Source3: zlib-rpmlintrc
#PATCH-FIX-SUSE: fate#314093, sent upstream by IBM
Patch0: zlib-1.2.7-improve-longest_match-performance.patch
#PATCH-FIX-SUSE: compiler check of varguments passed to gzprintf
Patch1: zlib-format.patch
# PATCH-FIX-UPSTREAM: security fixes from upstream git
Patch2: zlib-bnc1003577.patch
Patch3: zlib-bnc1003579-part2.patch
Patch4: zlib-bnc1003579.patch
Patch5: zlib-bnc1003580.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
zlib is a general-purpose lossless data-compression library,
implementing an API for the DEFLATE algorithm, the latter of
which is being used by, for example, gzip and the ZIP archive
format.
%package -n libz1
Summary: Library implementing the DEFLATE compression algorithm
Group: System/Libraries
Provides: %{name} = %{version}-%{release}
Obsoletes: %{name} < %{version}-%{release}
%description -n libz1
zlib is a general-purpose lossless data-compression library,
implementing an API for the DEFLATE algorithm, the latter of
which is being used by, for example, gzip and the ZIP archive
format.
%package devel
Summary: Development files for zlib, a data compression library
Group: Development/Languages/C and C++
Requires: glibc-devel
Requires: libz1 = %{version}
%description devel
zlib is a general-purpose lossless data-compression library,
implementing an API for the DEFLATE algorithm, the latter of
which is being used by, for example, gzip and the ZIP archive
format.
This subpackage holds the development headers for the library.
The zlib data format is itself portable across platforms. Unlike the
LZW compression method used in unix compress(1) and in the GIF image
format, the compression method currently used in zlib essentially
never expands the data. (LZW can double or triple the file size in
extreme cases.) zlib's memory footprint is also independent of the
input data and can be reduced, if necessary, at some cost in
compression.
%package devel-static
Summary: Static library for zlib
Group: Development/Languages/C and C++
Requires: %{name}-devel = %{version}
Provides: %{name}-devel:%{_libdir}/libz.a
%description devel-static
zlib is a general-purpose lossless data-compression library,
implementing an API for the DEFLATE algorithm, the latter of
which is being used by, for example, gzip and the ZIP archive
format.
This subpackage contains the static version of the library
used for development.
%package -n libminizip1
Summary: Library for manipulation with .zip archives
Group: System/Libraries
%description -n libminizip1
Minizip is a library for manipulation with files from .zip archives.
%package -n minizip-devel
Summary: Development files for the minizip library
Group: Development/Languages/C and C++
Requires: %{name}-devel = %{version}
Requires: libminizip1 = %{version}
Requires: pkgconfig
%description -n minizip-devel
This package contains the libraries and header files needed for
developing applications which use minizip.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
export LDFLAGS="-Wl,-z,relro,-z,now"
export CFLAGS="%{optflags}"
# For sure not autotools build
CC="cc" ./configure \
--shared \
--prefix=%{_prefix} \
--libdir=/%{_lib}
# Marcus: breaks example64 in 32bit builds, so it's disabled by default
%if %{with profiling}
profiledir=$(mktemp -d)
trap "rm -rf $profiledir" EXIT
make CFLAGS="%{optflags} %{cflags_profile_generate}=$profiledir" %{?_smp_mflags}
time make check %{?_smp_mflags}
make %{?_smp_mflags} clean
make CFLAGS="%{optflags} %{cflags_profile_feedback}=$profiledir" %{?_smp_mflags}
%else
make %{?_smp_mflags}
%endif
# And build minizip
cd contrib/minizip
autoreconf -fvi
%configure \
--disable-static \
--disable-silent-rules
make %{?_smp_mflags}
%check
time make check %{?_smp_mflags}
%install
mkdir -p %{buildroot}%{_libdir}
make DESTDIR=%{buildroot} install %{?_smp_mflags}
# Fix shared library placement/symlinks
ln -s -v /%{_lib}/$(readlink %{buildroot}/%{_lib}/libz.so) %{buildroot}%{_libdir}/libz.so
rm -v %{buildroot}/%{_lib}/libz.so
# Static lib
mv %{buildroot}/%{_lib}/libz.a %{buildroot}%{_libdir}
# Move .pc file to _libdir
mv %{buildroot}/%{_lib}/pkgconfig %{buildroot}%{_libdir}
# manpage
install -m 644 zlib.3 %{buildroot}%{_mandir}/man3
install -m 644 zutil.h %{buildroot}%{_includedir}
# examples
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -r examples/ %{buildroot}%{_docdir}/%{name}/
# Install minizip
cd contrib/minizip
make DESTDIR=%{buildroot} install %{?_smp_mflags}
find %{buildroot} -type f -name "*.la" -delete -print
%post -n libz1 -p /sbin/ldconfig
%postun -n libz1 -p /sbin/ldconfig
%post -n libminizip1 -p /sbin/ldconfig
%postun -n libminizip1 -p /sbin/ldconfig
%files -n libz1
%defattr(-,root,root)
/%{_lib}/libz.so.1.2.*
/%{_lib}/libz.so.1
%files devel
%defattr(-,root,root)
%doc README ChangeLog
%dir %{_docdir}/%{name}/
%dir %{_docdir}/%{name}/examples
%{_docdir}/%{name}/examples/*
%{_mandir}/man3/zlib.3.gz
%{_includedir}/zlib.h
%{_includedir}/zconf.h
%{_includedir}/zutil.h
%{_libdir}/libz.so
%{_libdir}/pkgconfig/zlib.pc
%files -n libminizip1
%defattr(-,root,root)
%doc contrib/minizip/MiniZip64_info.txt contrib/minizip/MiniZip64_Changes.txt
%{_libdir}/libminizip.so.*
%files -n minizip-devel
%defattr(-,root,root)
%dir %{_includedir}/minizip
%{_includedir}/minizip/*.h
%{_libdir}/libminizip.so
%{_libdir}/pkgconfig/minizip.pc
%files devel-static
%defattr(-,root,root)
%{_libdir}/libz.a
%changelog