File libpgf.spec of Package libpgf

#
# spec file for package libpgf
#
# 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/
#


%define so_ver 6

Name:           libpgf
Version:        6.14.12
Release:        0
Summary:        Progressive Graphics File Library
License:        LGPL-2.1+
Group:          Productivity/Graphics/Other
Url:            http://www.libpgf.org/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-src-%{version}.tar.gz
# PATCH-FIX-UPSTREAM libpgf-r147.patch CVE-2015-6673 bnc#943304 boo#941059 asterios.dramis@gmail.com -- Fix use-after-free vulnerability in Decoder.cpp
Patch0:         libpgf-r147.patch
# PATCH-FIX-UPSTREAM libpgf-r148.patch CVE-2015-6673 bnc#943304 boo#941059 asterios.dramis@gmail.com -- Fix use-after-free vulnerability in Decoder.cpp
Patch1:         libpgf-r148.patch
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  graphviz
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
libpgf is a library for working with PGF (Progresive Graphics File) images.

%package devel
Summary:        Development files for the libpgf library
Group:          Development/Libraries/C and C++
Requires:       libpgf%{so_ver} = %{version}

%description devel
This package contains header files and libraries needed for developing programs
using the libpgf library.

%package -n libpgf%{so_ver}
Summary:        Progressive Graphics File Library
Group:          System/Libraries

%description -n libpgf%{so_ver}
libpgf is a library for working with PGF (Progresive Graphics File) images.

%prep
%setup -q -n %{name}
%patch0 -p1
%patch1 -p1

# Add "libpgf-" prefix to all man pages to prevent conflicts with other packages
sed -i 's/\/man\/man3\/\$\$f/\/man\/man3\/libpgf-\$\$f/' doc/Makefile.am

# Fix permissions (fix rpmlint errors "spurious-executable-perm" and "executable-docs")
chmod 644 COPYING README

# Fix rpmlint warning "wrong-file-end-of-line-encoding"
sed -i 's/\r$//' README

# Remove build time references so build-compare can do its work
echo "HTML_TIMESTAMP = NO" >> doc/Doxyfile.in

# Fix end-of-line-encoding (fixes compilation)
sed -i 's/\r$//' configure.ac

%build
sh autogen.sh
%configure --disable-static
make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} DOC_DIR=%{buildroot}%{_docdir}/%{name}-devel/ install

# Install additional documentation
install -pm 0644 COPYING README %{buildroot}%{_docdir}/%{name}-devel/

# Remove libtool config files
rm -f %{buildroot}%{_libdir}/*.la

# Remove unneeded man pages
rm -f %{buildroot}%{_mandir}/man3/libpgf-*rpmbuild*

%fdupes -s %{buildroot}

%post -n libpgf%{so_ver} -p /sbin/ldconfig

%postun -n libpgf%{so_ver} -p /sbin/ldconfig

%files devel
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-devel/
%{_includedir}/libpgf/
%{_libdir}/pkgconfig/libpgf.pc
%{_libdir}/libpgf.so
%{_mandir}/man3/libpgf-*.3%{ext_man}

%files -n libpgf%{so_ver}
%defattr(-,root,root,-)
%{_libdir}/libpgf.so.%{so_ver}*

%changelog
openSUSE Build Service is sponsored by