Name:           podofo
Version:        0.9.6
Release:        1%{?_dist_release}
Summary:        Tools and libraries to work with the PDF file format

Group:          Applications/Publishing

Vendor:         Project Vine
Distribution:   Vine Linux

License:        GPLv2+
URL:            http://podofo.sourceforge.net
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz

# Fix failure to detect FreeType
Patch0:         podofo-0.9.4-freetype.patch
# Don't attempt to copy non-existing testdata dir
Patch1:         podofo_tests.patch
# Fix pkg-config file
Patch2:         podofo_pkgconfig.patch

# Backport patch for CVE-2018-5783
# https://sourceforge.net/p/podofo/code/1949
Patch10:        podofo_CVE-2018-5783.patch
# Backport patch for CVE-2018-11254
# https://sourceforge.net/p/podofo/code/1941
Patch11:        podofo_CVE-2018-11254.patch
# Backport patch for CVE-2018-11255
# https://sourceforge.net/p/podofo/code/1952
Patch12:        podofo_CVE-2018-11255.patch
# Backport patch for CVE-2018-11256
# https://sourceforge.net/p/podofo/code/1938
Patch13:        podofo_CVE-2018-11256.patch
# Backport patch for CVE-2018-12982
# https://sourceforge.net/p/podofo/code/1948
Patch14:        podofo_CVE-2018-12982.patch
# Backport patch for CVE-2018-14320
# https://sourceforge.net/p/podofo/code/1953
Patch15:        podofo_CVE-2018-14320.patch
# Backport patch for CVE-2018-19532
# https://sourceforge.net/p/podofo/code/1950
Patch16:        podofo_CVE-2018-19532.patch
# Backport patch for CVE-2018-20751
# https://sourceforge.net/p/podofo/code/1954
Patch17:        podofo_CVE-2018-20751.patch
# Backport patch for CVE-2019-9199
# https://sourceforge.net/p/podofo/code/1971/
Patch18:        podofo_CVE-2019-9199.patch
# Backport patch for CVE-2019-9687
# https://sourceforge.net/p/podofo/code/1969
Patch19:        podofo_CVE-2019-9687.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:  cmake
BuildRequires:  zlib-devel
BuildRequires:  libjpeg-turbo-devel
BuildRequires:  libtiff-devel
BuildRequires:  libpng-devel
BuildRequires:  freetype2-devel
BuildRequires:  fontconfig-devel
BuildRequires:  cppunit-devel
BuildRequires:  lua-devel
BuildRequires:  doxygen


%description
PoDoFo is a library to work with the PDF file format. The name comes from
the first letter of PDF (Portable Document Format). A few tools to work
with PDF files are already included in the PoDoFo package.

The PoDoFo library is a free, portable C++ library which includes classes
to parse PDF files and modify their contents into memory. The changes can be
written back to disk easily. The parser can also be used to extract
information from a PDF file (for example the parser could be used in a PDF
viewer). Besides parsing PoDoFo includes also very simple classes to create
your own PDF files. All classes are documented so it is easy to start writing
your own application using PoDoFo.


%package libs
Summary:        Runtime library for %{name}
Group:          System Environment/Libraries
License:        LGPLv2+

%description libs
Runtime library for %{name}.


%package devel
Summary:        Development files for %{name} library
Group:          Development/Libraries
License:        LGPLv2+
Requires:       %{name}-libs = %{version}-%{release}

%description devel
Development files and documentation for the %{name} library.


%prep
%autosetup -p1

# disable timestamps in docs
echo "HTML_TIMESTAMP = NO" >> Doxyfile

%build
%cmake -DPODOFO_BUILD_SHARED=1 \
%ifarch x86_64 ppc64 s390x sparc64
-DWANT_LIB64=1 \
%endif
.
%__make %{?_smp_mflags}

# build the docs
doxygen

# set timestamps on generated files to some constant
find doc/html -exec touch -r %{SOURCE0} {} \;


%install
%__rm -rf $RPM_BUILD_ROOT
%__make install DESTDIR=$RPM_BUILD_ROOT


%clean
%__rm -rf $RPM_BUILD_ROOT

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%license COPYING
%{_bindir}/%{name}*
%{_mandir}/man1/%{name}*.1*

%files libs
%defattr(-,root,root,-)
%license COPYING.LIB COPYING.exception
%doc AUTHORS ChangeLog FAQ.html README.html TODO
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%doc doc/html examples
%{_includedir}/%{name}
%{_libdir}/*.so
%{_libdir}/pkgconfig/*


%changelog
* Tue Oct 22 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.9.6-1
- new upstream release.
- dropped Patch0: fixed in upstream.
- dropped Patch1.
- imported Patch0-19 from rawhide.

* Sat Jul 02 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.9.1-3
- rebuild with gcc-5.4.0

* Sat Sep 13 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> 0.9.1-2
- rebuilt with libpng-1.6.12
- changed BuildRequires: libjpeg-devel to libjpeg-turbo-devel
- added Patch1 from Fedora rawhide

* Sun Mar 11 2012 Munehiro Yamamoto <munepi@vinelinux.org> 0.9.1-1
- updated to 0.9.1

* Tue Aug 24 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.8.1-1
- initial build based on Fedora development

* Tue Jun  8 2010 Dan Horák <dan[at]danny.cz> 0.8.1-2
- fix building tests

* Mon Jun  7 2010 Dan Horák <dan[at]danny.cz> 0.8.1-1
- updated to 0.8.1

* Thu Apr 29 2010 Dan Horák <dan[at]danny.cz> 0.8.0-1
- updated to 0.8.0

* Tue Feb 16 2010 Dan Horák <dan[at]danny.cz> 0.7.0-4
- set timestamp on generated docs (#565683)

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Apr 30 2009 Dan Horák <dan[at]danny.cz> 0.7.0-2
- remove BR: openssl-devel, it could be required in the future (but then
    an exception clause will be added to the licenses)
- add missing doc files

* Sun Mar 29 2009 Dan Horák <dan[at]danny.cz> 0.7.0-1
- initial Fedora package
