%global test_sha 0d2bfd4af4c76a3bac27ccaff793d9129df7b57a
%global test_date 2009-05-13
 
Name:           poppler
Version:        0.67.0
Release:        7
Summary:        Poppler is a PDF rendering library based on the xpdf-3.0 code base
License:        (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT
URL:            https://poppler.freedesktop.org/
Source0:        https://poppler.freedesktop.org/poppler-%{version}.tar.xz
Source1:        %{name}-test-%{test_date}_%{test_sha}.tar.xz
# https://bugzilla.redhat.com/show_bug.cgi?id=1185007
Patch0:         poppler-0.30.0-rotated-words-selection.patch
Patch1:         0001-Revert-Remove-the-Qt4-frontend.patch
Patch4:         poppler-0.63.0-python3.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1557355
Patch6:         poppler-0.63.0-tiling-patterns.patch
Patch7:         poppler-0.67.0-qt4-const.patch

Patch6000:      poppler-CVE-2018-19149.patch
Patch6001:      poppler_0.26.5_CVE-2019-9200.patch
Patch6002:      CVE-2018-20662-1.patch
Patch6003:      CVE-2018-20662-2.patch
Patch6004:      CVE-2019-9903.patch
Patch6005:      CVE-2019-9631-1.patch
Patch6006:      CVE-2019-9631-2.patch
Patch6007:      CVE-2019-9959.patch
Patch6008:      CVE-2019-11026.patch
Patch6009:      CVE-2018-19058.patch
Patch6010:      CVE-2018-19059.patch
Patch6011:      CVE-2018-20650.patch
Patch6012:      CVE-2019-10872.patch
Patch6013:      backport-CVE-2018-16646.patch
Patch6014:      backport-CVE-2018-18897.patch
Patch6015:      backport-CVE-2018-19060.patch
Patch6016:      backport-CVE-2018-20481.patch
Patch6017:      backport-CVE-2019-14494.patch
Patch6018:      backport-CVE-2019-7310.patch

BuildRequires:  cmake gcc-c++ gettext-devel qt5-qtbase-devel qt-devel cairo-devel fontconfig-devel 
BuildRequires:  freetype-devel gdk-pixbuf2-devel glib2-devel gobject-introspection-devel gtk3-devel
BuildRequires:  gtk-doc lcms2-devel libjpeg-turbo-devel openjpeg2-devel libpng-devel libtiff-devel
BuildRequires:  nss-devel poppler-data-devel git

Requires:       poppler-data 
Obsoletes:      poppler-glib-demos < 0.60.1-1
Provides:       poppler-utils 
Obsoletes:      poppler-utils

%description
Poppler is a free software utility library for rendering Portable Document Format (PDF) documents. \
Its development is supported by freedesktop.org. It is commonly used on Linux systems,and is used by \
the PDF viewers of the open source GNOME and KDE desktop environments.

%package devel
Summary: Provide header files and libraries for poppler
Requires: %{name} = %{version}-%{release}

%description devel
The package provides necessary files and documents for the use of compiling applications based on poppler

%package glib
Summary: Provide glib wrapper for poppler
Requires: %{name} = %{version}-%{release}

%description glib
This package provides glib wrapper for poppler

%package glib-devel
Summary: Provide development files for glib wrapper
Requires: %{name}-glib = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Suggests: %{name}-doc = %{version}-%{release}

%description glib-devel
This package provides development files for glib wrapper

%package glib-doc
Summary: Provide documentation for glib wrapper
BuildArch: noarch

%description glib-doc
This package provides documentation files for glib wrapper

%package qt
Summary: Provides Qt4 wrapper for poppler
Requires: %{name} = %{version}-%{release}
%{?_qt4:Requires: qt4 >= %{_qt4_version}}
Obsoletes: poppler-qt4 < 0.16.0-3
Provides:  poppler-qt4 = %{version}-%{release}

%description qt
This package provides Qt4 wrapper for poppler.

%package qt-devel
Summary: Provides development files for Qt4 wrapper
Requires: %{name}-qt = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Obsoletes: poppler-qt4-devel < 0.16.0-3
Provides: poppler-qt4-devel = %{version}-%{release}
Requires: qt4-devel

%description qt-devel
This package provides development files for Qt4 wrapper.

%package qt5
Summary: Provides Qt5 wrapper for poppler
Requires: %{name} = %{version}-%{release}

%description qt5
This package provides Qt5 wrapper for poppler.

%package qt5-devel
Summary: Provides development files for Qt5 wrapper
Requires: %{name}-qt5 = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Requires: qt5-qtbase-devel

%description qt5-devel
This package provides development files for Qt5 wrapper.

%package cpp
Summary: Provide pure C++ wrapper for poppler
Requires: %{name} = %{version}-%{release}

%description cpp
This package provides pure C++ wrapper for poppler

%package cpp-devel
Summary: Provide development files for C++ wrapper
Requires: %{name}-cpp = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}

%description cpp-devel
This package provides development files for C++ wrapper

%package_help

%prep
%autosetup -n %{name}-%{version} -p1 -S git

%build
mkdir build
cd build
export CC="gcc -fPIC" 
%cmake \
  -DENABLE_CMS=lcms2  -DENABLE_DCTDECODER=libjpeg  -DENABLE_GTK_DOC=ON \
  -DENABLE_LIBOPENJPEG=openjpeg2  -DENABLE_XPDF_HEADERS=ON -DENABLE_ZLIB=OFF \
  ..
unset CC
%make_build

%install
%make_install -C build

%check
%make_build test

export PKG_CONFIG_PATH=%{buildroot}%{_datadir}/pkgconfig:%{buildroot}%{_libdir}/pkgconfig
test "$(pkg-config --modversion poppler)" = "%{version}"
test "$(pkg-config --modversion poppler-cairo)" = "%{version}"
test "$(pkg-config --modversion poppler-cpp)" = "%{version}"
test "$(pkg-config --modversion poppler-glib)" = "%{version}"
test "$(pkg-config --modversion poppler-qt4)" = "%{version}"
test "$(pkg-config --modversion poppler-qt5)" = "%{version}"
test "$(pkg-config --modversion poppler-splash)" = "%{version}"

%ldconfig_scriptlets

%ldconfig_scriptlets glib

%ldconfig_scriptlets qt

%ldconfig_scriptlets qt5

%ldconfig_scriptlets cpp

%files
%defattr(-,root,root)
%license COPYING
%{_bindir}/pdf*
%{_libdir}/libpoppler.so.78*

%files devel 
%defattr(-,root,root)
%{_includedir}/poppler/*.h            
%{_includedir}/poppler/fofi/           
%{_includedir}/poppler/goo/          
%{_includedir}/poppler/splash/            
%{_libdir}/pkgconfig/poppler.pc          
%{_libdir}/pkgconfig/poppler-splash.pc      
%{_libdir}/libpoppler.so                      

%files glib
%defattr(-,root,root)
%{_libdir}/libpoppler-glib.so.8*
%{_libdir}/girepository-1.0/Poppler-0.18.typelib

%files glib-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/poppler-glib.pc
%{_libdir}/pkgconfig/poppler-cairo.pc
%{_libdir}/libpoppler-glib.so
%{_datadir}/gir-1.0/Poppler-0.18.gir
%{_includedir}/poppler/glib/

%files glib-doc
%defattr(-,root,root)
%{_datadir}/gtk-doc/

%files qt  
%defattr(-,root,root)
%{_libdir}/libpoppler-qt4.so.4*

%files qt-devel
%defattr(-,root,root)
%{_libdir}/libpoppler-qt4.so
%{_libdir}/pkgconfig/poppler-qt4.pc
%{_includedir}/poppler/qt4/

%files qt5
%defattr(-,root,root)
%{_libdir}/libpoppler-qt5.so.1*

%files qt5-devel
%defattr(-,root,root)
%{_libdir}/libpoppler-qt5.so
%{_libdir}/pkgconfig/poppler-qt5.pc
%{_includedir}/poppler/qt5/

%files cpp
%defattr(-,root,root)
%{_libdir}/libpoppler-cpp.so.0*

%files cpp-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/poppler-cpp.pc
%{_libdir}/libpoppler-cpp.so
%{_includedir}/poppler/cpp

%files help
%defattr(-,root,root)
%doc README
%{_mandir}/man1/*

%changelog
* Sat Jan 23 2021 wangye <wangye70@huawei.com> - 0.67.0-7
- Type:cves
- Id:NA
- SUG:NA
- DESC:fix CVE-2018-16646 CVE-2018-18897 CVE-2018-19060 CVE-2018-20481 CVE-2019-14494 CVE-2019-7310
 
* Thu Oct 29 2020 yanan <yanan@huawei.com> - 0.67.0-6
- Type:cves
- Id:NA
- SUG:NA
- DESC:fix CVE-2019-10872 

* Mon Jan 20 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.67.0-5
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:fix cves

* Mon Jan 20 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.67.0-4
- Type:cve
- Id:NA
- SUG:NA
- DESC:fix cves

* Mon Oct 14 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.67.0-3
- Type:enhancement
- Id:NA
- SUG:NA
- DESC:Adjust sub-package relationship

* Fri Sep 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.67.0-2
- Package init    
