zlib/zlib.spec

158 lines
5.2 KiB
RPMSpec

#
# spec file for package zlib
#
# Copyright (c) 2012 SUSE LINUX Products 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.7
Release: 0
Summary: Data Compression Library
License: Zlib
Group: System/Libraries
Url: http://www.zlib.net/
Source0: http://zlib.net/zlib-%{version}.tar.bz2
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
BuildRequires: pkgconfig
#!BuildIgnore: rpmlint-Factory
#!BuildIgnore: post-build-checks
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# bug437293
%ifarch ppc64
Obsoletes: zlib-64bit
%endif
%description
zlib is designed to be a free, general-purpose, legally unencumbered -- that
is, not covered by any patents -- lossless data-compression library for use on
virtually any computer hardware and operating system. 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 -n libz1
Summary: Include Files and Libraries mandatory for Development
Group: Development/Languages/C and C++
Provides: %{name} = %{version}-%{release}
Obsoletes: %{name} < %{version}-%{release}
%description -n libz1
zlib is designed to be a free, general-purpose, legally unencumbered -- that
is, not covered by any patents -- lossless data-compression library for use on
virtually any computer hardware and operating system. 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
Summary: Include Files and Libraries mandatory for Development
Group: Development/Languages/C and C++
Requires: glibc-devel
Requires: libz1 = %{version}
Provides: libz:/usr/include/zlib.h
# bug437293
%ifarch ppc64
Obsoletes: zlib-devel-64bit
%endif
#
%description devel
This package contains all necessary include files and libraries needed
to develop applications that require the provided includes and
libraries.
%package devel-static
Summary: Include Files and Libraries mandatory for Development
Group: Development/Languages/C and C++
Requires: %{name}-devel = %{version}
Provides: %{name}-devel:%{_libdir}/libz.a
%description devel-static
This package contains all necessary include files and libraries needed
to develop applications that require the provided includes and
libraries.
%prep
%setup -q
%patch0 -p1
%build
export LDFLAGS="-Wl,-z,relro,-z,now"
# Marcus: breaks example64 in 32bit builds, so it's disabled by default
%if %{with profiling}
profiledir=$(mktemp -d)
trap "rm -rf $profiledir" EXIT
CC="gcc" ./configure --shared --prefix=%{_prefix} --libdir=/%{_lib}
make CFLAGS="%{optflags} %{cflags_profile_generate}=$profiledir" %{?_smp_mflags}
time make check
make clean
make CFLAGS="%{optflags} %{cflags_profile_feedback}=$profiledir" %{?_smp_mflags}
%else
export CFLAGS="%{optflags}"
CC="gcc" ./configure --shared --prefix=%{_prefix} --libdir=/%{_lib}
make %{?_smp_mflags}
%endif
%check
time make check
%install
mkdir -p %{buildroot}%{_libdir}
make install DESTDIR="%buildroot"
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}
%post -n libz1 -p /sbin/ldconfig
%postun -n libz1 -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
%{_mandir}/man3/zlib.3.gz
%{_includedir}/zlib.h
%{_includedir}/zconf.h
%{_includedir}/zutil.h
%{_libdir}/libz.so
%{_libdir}/pkgconfig/zlib.pc
%files devel-static
%defattr(-,root,root)
%{_libdir}/libz.a
%changelog