File libpng15.spec of Package libpng15.3389

#
# spec file for package libpng15
#
# Copyright (c) 2013 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/
#


#
%define major   1
%define minor   5
%define micro   22
%define branch  %{major}%{minor}
%define libname libpng%{branch}-%{branch}

Name:           libpng15
Url:            http://www.libpng.org/pub/png/libpng.html
Version:        %{major}.%{minor}.%{micro}
Release:        0
Summary:        Library for the Portable Network Graphics Format (PNG)
License:        Libpng
Group:          System/Libraries
Source:         http://downloads.sourceforge.net/project/libpng/%{name}/%{version}/libpng-%{version}.tar.xz
Source2:        baselibs.conf
Patch0:         libpng15-CVE-2015-8126.patch
Patch1:         libpng15-CVE-2015-8126-complete.patch
Patch2:         libpng15-CVE-2015-8540.patch
Patch3:         libpng15-CVE-2016-10087.patch
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define debug_package_requires %{libname} = %{version}-%{release}

%package -n %{libname}

Summary:        Library for the Portable Network Graphics Format (PNG)
Group:          System/Libraries
# bug437293
%ifarch ppc64
Obsoletes:      libpng-64bit
%endif
#

%description
libpng is the official reference library for the Portable Network
Graphics format (PNG).

%description -n %{libname}
libpng is the official reference library for the Portable Network
Graphics format (PNG).

%prep
%setup -n libpng-%{version}
%patch0
%patch1
%patch2 -p1
%patch3 -p1

%build
# PNG_SAFE_LIMITS_SUPPORTED: http://www.openwall.com/lists/oss-security/2015/01/10/1
export CFLAGS="%optflags -O3 -DPNG_SAFE_LIMITS_SUPPORTED -DPNG_SKIP_SETJMP_CHECK $(getconf LFS_CFLAGS)"
export LDFLAGS="-Wl,-z,relro,-z,now"

%configure \
              --disable-static
make %{?_smp_mflags}

%check
make check

%install
mkdir -p %{buildroot}/%{_libdir}
install .libs/libpng%{branch}.so.%{branch}.%{micro}.0 %{buildroot}/%{_libdir}
ln -s %{branch}.so.%{branch}.%{micro}.0 %{buildroot}/%{_libdir}/libpng%{branch}.so.%{branch} 

%post -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libpng%{branch}.so.*

%changelog