File podofo.spec of Package podofo.7908

#
# spec file for package podofo
#
# Copyright (c) 2018 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 libver 0_9_2

Name:           podofo
Version:        0.9.2
Release:        0
Summary:        Tools to work with PDF files
License:        GPL-2.0-or-later
Group:          Productivity/Publishing/PDF
Url:            http://podofo.sourceforge.net/
Source0:        http://downloads.sourceforge.net/podofo/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM podofo-0.9.2-soname.patch http://sourceforge.net/apps/mantisbt/podofo/view.php?id=54 asterios.dramis@gmail.com -- Update the soname of the library
Patch0:         podofo-0.9.2-soname.patch
# PATCH-FIX-UPSTREAM remove-internal-findfreetype-references.patch -- fixes build with freetype2 2.5.1 as internal 
# copy is broken. It is also better practice to use cmake's FindPackage modules
Patch1:         remove-internal-findfreetype-references.patch
Patch2:         r1576-Do-not-get-stuck-in-infite-loop-with-broken-page-tables.patch
Patch3:         r1594-Fixed-compilation-on-Apple-platforms.patch
Patch4:         r1600-Get-PoDoFo-build-under-Visual-Studio-2008.patch
Patch5:         r1648-Be-forgiving-when-reading-XRef-stream-content.patch
Patch6:         r1696-Use-cmake-commands-properly.patch
Patch7:         r1701-Compatibility-fix-for-CMake-2.8.patch
Patch8:         r1709-CMake-compatibility-and-TestFilter-build-fixes.patch
Patch9:         r1826-Do-not-force-c++98-standard-for-GNUCXX-compiler.patch
Patch10:        r1791-Fix-build-failure-with-OpenSSL-1.1.patch
Patch11:        r1793-Address-some-of-the-issues-reported-by-CoverityScan.patch
Patch12:        r1833-Fix-a-crash-when-passing-a-PDF-file-.patch
Patch13:        r1834-Fix-stack-overflow-crash-when-XRef-record-references-itself.patch
Patch14:        r1835-Fix-for-CVE-2017-5852.patch
Patch15:        r1836-Fix-for-CVE-2017-5854.patch
Patch16:        r1837-Fix-for-CVE-2017-5886.patch
Patch17:        r1838-Extend-fix-for-CVE-2017-5852.patch
Patch18:        r1840-Fix-CVE-2017-5853-and-CVE-2017-6844.patch
Patch19:        r1842-Fix-CVE-2017-7379-encoding-array-too-short.patch
Patch20:        r1843-Fix-CVE-2017-5855-NULL-pointer-dereference.patch
Patch21:        r1844-Fix-CVE-2017-6840-Out-of-bounds-read.patch
Patch22:        r1845-Correct-fix-for-CVE-2017-6840.patch
Patch23:        r1846-Fix-CVE-2017-6847-NULL-pointer-dereference.patch
Patch24:        r1847-Fix-CVE-2017-7378-Out-of-bounds-read.patch
Patch25:        r1848-Fix-CVE-2017-7380-NULL-dereference.patch
Patch26:        r1849-Fix-CVE-2017-7994-NULL-dereference.patch
Patch27:        r1850-Fix-a-memory-leak-on-document-load-exception-in-podofotxtextract.patch
Patch28:        r1851-Fix-for-CVE-2017-8787-Read-out-of-buffer-size.patch
Patch29:        r1870-Fix-parameter-tested-for-NULL-in-PdfMemoryOutputStream-Write.patch
Patch30:        r1872-Fix-CVE-2017-8054-Detect-cycles-in-PdfPagesTree.patch
Patch31:        r1909-Fix-for-CVE-2018-8001-heap-based-buffer-over-read-in-UnescapeName.patch
BuildRequires:  cmake >= 2.5
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  libcppunit-devel
BuildRequires:  libidn-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
%if 0%{?suse_version} > 1210
BuildRequires:  lua51-devel
%else
BuildRequires:  lua-devel
%endif
BuildRequires:  openssl-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Command line tools for working with PDF files.

%package -n libpodofo%{libver}

Summary:        PDF parsing and creation library
License:        LGPL-2.1-or-later
Group:          System/Libraries

%description -n libpodofo%{libver}
A cross platform PDF parsing and creation library.

%package -n libpodofo-devel
Summary:        Development files for podofo
License:        LGPL-2.1-or-later
Group:          Development/Libraries/Other
Requires:       libpodofo%{libver} = %{version}

%description -n libpodofo-devel
This package contains development files for podofo library.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p0
%patch3 -p3
%patch4 -p0
%patch5 -p0
%patch6 -p0
%patch7 -p0
%patch8 -p0
%patch9 -p0
%patch10 -p0
%patch11 -p0
%patch12 -p0
%patch13 -p0
%patch14 -p0
%patch15 -p0
%patch16 -p0
%patch17 -p0
%patch18 -p0
%patch19 -p0
%patch20 -p0
%patch21 -p0
%patch22 -p0
%patch23 -p0
%patch24 -p0
%patch25 -p0
%patch26 -p0
%patch27 -p0
%patch28 -p0
%patch29 -p0
%patch30 -p0
%patch31 -p0
mv cmake/modules/FindZLIB.cmake cmake/modules/FindCustomZLIB.cmake

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

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
export CXXFLAGS="$CFLAGS -std=c++11"

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPODOFO_BUILD_STATIC=FALSE -DPODOFO_USE_VISIBILITY=1 \
%if "%{_lib}" == "lib64"
-DWANT_LIB64=1 \
%endif
../
make %{?_smp_mflags} VERBOSE=1
cd ..

# Build devel docs
doxygen

%install
pushd build
%makeinstall
popd

# Install devel docs (do it manually to fix also rpmlint warning "files-duplicate" with %%fdupes)
mkdir -p %{buildroot}%{_docdir}/libpodofo-devel
install -pm 0644 AUTHORS COPYING.LIB ChangeLog FAQ.html README.html TODO %{buildroot}%{_docdir}/libpodofo-devel/
cp -a doc/html/ %{buildroot}%{_docdir}/libpodofo-devel/

%fdupes -s %{buildroot}

%post -n libpodofo%{libver} -p /sbin/ldconfig

%postun -n libpodofo%{libver} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc AUTHORS README.html
%license COPYING
%{_bindir}/*
%doc %{_mandir}/man1/podofo*.1%{ext_man}

%files -n libpodofo%{libver}
%defattr(-,root,root,-)
%{_libdir}/libpodofo.so.%{version}

%files -n libpodofo-devel
%defattr(-,root,root,-)
%doc %{_docdir}/libpodofo-devel/
%{_includedir}/podofo/
%{_libdir}/libpodofo.so

%changelog
openSUSE Build Service is sponsored by