File podofo.spec of Package podofo

#
# 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_5

Name:           podofo
Version:        0.9.5
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
Patch0:         0001-fix-a-crash-when-passing-a-PDF-file-with-an-encryption-dictionary-ref.patch
Patch1:         0002-fix-stack-overflow-crash-when-XRef-record-references-itself.patch
Patch2:         0003-Fix-for-CVE-2017-5852-with-added-error-code.patch
Patch3:         0004-Fix-for-CVE-2017-5854.patch
Patch4:         0005-Fix-for-CVE-2017-5886.patch
Patch5:         0006-Extend-fix-for-CVE-2017-5852.patch
Patch6:         0007-Fix-CVE-2017-5853-signed-integer-overflow-and-CVE-2017-6844-buffer-overflow.patch
Patch7:         0008-Fix-infinite-loop-in-GetPageNumber-if-Parent-chain-contains-a-loop.patch
Patch8:         0009-Fix-CVE-2017-7379-encoding-array-too-short-to-encode-decode-code-point-0xffff.patch
Patch9:         0010-Fix-CVE-2017-5855-CVE-2018-5296-NULL-pointer-dereference-in-PoDoFo-PdfParser-ReadXRefSubsection.patch
Patch10:        0011-Fix-CVE-2017-6840-Out-of-bounds-read-in-ColorChanger-GetColorFromStack.patch
Patch11:        0012-Correct-fix-for-CVE-2017-6840-Too-strict-check-for-given-arguments.patch
Patch12:        0013-Fix-CVE-2017-6847-NULL-pointer-dereference-when-reading-XObject-without-BBox.patch
Patch13:        0014-Fix-CVE-2017-7378-Out-of-bounds-read-in-PdfPainter-ExpandTabs.patch
Patch14:        0015-Fix-CVE-2017-7380-NULL-dereference-in-PdfPage-GetFromResources.patch
Patch15:        0016-Fix-CVE-2017-7994-NULL-dereference-in-TextExtractor-ExtractText.patch
Patch16:        0017-Fix-a-memory-leak-on-document-load-exception-in-podofotxtextract.patch
Patch17:        0018-Fix-for-CVE-2017-8787-Read-out-of-buffer-size-in-PdfXRefStreamParserObject-ReadXRefStreamEntry.patch
Patch18:        0019-Changes-needed-to-compile-podofo.patch
Patch19:        0020-Fix-regression-from-0007.patch
Patch20:        0021-Fix-a-build-break-with-OpenSSL-1.1.0f-configured-with-disable-deprecated-option.patch
Patch21:        0022-Correct-boundary-comparison-in-PdfListField::GetItemDisplayText.patch
Patch22:        0023-Correct-in-parameter-test-in-PdfMemoryOutputStream-Write.patch
Patch23:        0024-Fix-CVE-2017-8054-Detect-cycles-in-PdfPagesTree.patch
Patch24:        0025-Related-to-CVE-2018-5308.patch
Patch25:        0026-Revert-part-of-0024.patch
Patch26:        0027-Correction-for-reverted-part-of-CVE-2017-8054-fix-in-0027.patch
Patch27:        0028-Fix-for-CVE-2018-5295-Integer-overflow-at-PdfXRefStreamParserObject-ParseStream.patch
Patch28:        0029-Try-to-address-an-eventual-use-after-free-in-PdfObject.patch
Patch29:        0030-Fix-CVE-2017-6845-Do-not-disable-PODOFO_RAISE_LOGIC_IF-for-Release-builds.patch
Patch30:        0031-Fix-clamping-avoiding-crashes-in-PdfPagesTree-InsertPage.patch
Patch31:        0032-Fix-wrong-use-of-memcpy-instead-of-wmemcpy.patch
Patch32:        0033-Fix-for-CVE-2018-5309-integer-overflow-in-the-PdfObjectStreamParserObject-ReadObjectsFromStream.patch
Patch33:        0034-Fix-for-CVE-2018-8001-heap-based-buffer-over-read-in-UnescapeName.patch
Patch1000:      fix-missing-include.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
BuildRequires:  lua-devel
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
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
%autopatch -p3

# 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"

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 DESTDIR=%{buildroot}
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 COPYING README.html
%{_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
%{_libdir}/pkgconfig/libpodofo-0.pc

%changelog
openSUSE Build Service is sponsored by