File poppler-qt5.spec of Package poppler.34111

#
# spec file for package poppler-qt5
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define build_qt 0
%define build_qt5 1

Name:           poppler-qt5
%define _name   poppler
Version:        0.24.4
Release:        0
# Actual version of poppler-data:
%define poppler_data_version 0.4.6
%define poppler_soname 44
%define poppler_cpp_soname 0
%define poppler_glib_soname 8
%define poppler_qt4_soname 4
%define poppler_qt5_soname 1
%define poppler_api 0.18
%define poppler_apipkg 0_18
URL:            http://poppler.freedesktop.org/
Summary:        PDF Rendering Library
License:        GPL-2.0-only OR GPL-3.0-only
Group:          System/Libraries
Source:         http://poppler.freedesktop.org/%{_name}-%{version}.tar.xz
Patch0:         poppler-configure-moc-version.patch
Patch1:         poppler-annot-form-transparent-color.patch
Patch2:         poppler-ligatures.patch
Patch3:         poppler-CVE-2015-8868.patch
Patch4:         0001-Fix-memory-leak-and-probably-logic-bug-parsing-broke.patch
Patch5:         0001-Fix-memory-leak-when-reconstructing-broken-files.patch
Patch6:         CVE-2017-9775.patch
Patch7:         CVE-2017-9776.patch
Patch8:         CVE-2017-14517.patch
Patch9:         CVE-2017-14518.patch
Patch10:        CVE-2017-14520.patch
Patch11:        CVE-2017-14977.patch
Patch12:        CVE-2017-15565.patch
Patch13:        CVE-2017-1000456.patch
Patch14:        CVE-2018-10768.patch
Patch15:        0001-Check-for-XRefEntry-existing-before-using-it.patch
Patch16:        CVE-2017-14617.patch
Patch17:        CVE-2019-13283.patch
Patch18:        CVE-2017-18267.patch
Patch19:        poppler-null-XRef.patch
# CVE-2018-13988 [bsc#1102531], buffer overflow in pdfunite
Patch20:        poppler-CVE-2018-13988.patch
# CVE-2018-16646 [bsc#1107597], Infinite recursion in poppler/Parser.cc:Parser::getObj() function
Patch21:        poppler-CVE-2018-16646.patch
# CVE-2018-19060 [bsc#1115185], NULL pointer dereference in goo/GooString.h leads to denial of service
Patch22:        poppler-CVE-2018-19060.patch
# CVE-2018-19059 [bsc#1115186], out-of-bounds read in EmbFile:save2 in FileSpec.cc leading to denial of service
Patch23:        poppler-CVE-2018-19059.patch
# CVE-2018-19058 [bsc#1115187], reachable abort in Object.h leading to denial of service
Patch24:        poppler-CVE-2018-19058.patch
# CVE-2018-19149 [bsc#1115626], NULL pointer dereference in _poppler_attachment_new when called from poppler_annot_file_attachma
Patch25:        poppler-CVE-2018-19149.patch
# CVE-2018-18897 [bsc#1114966], memory leak in GfxColorSpace:setDisplayProfile in GfxState.cc
Patch26:        CVE-2018-20481.patch
Patch27:        poppler-CVE-2018-18897.patch
# CVE-2018-21009 [bsc#1149635], integer overflow in Parser:makeStream in Parser.cc.
Patch28:        poppler-CVE-2018-21009.patch
# CVE-2022-27337 [bsc#1199272], A logic error in the Hints::Hints function can cause denial of service
Patch29:        poppler-CVE-2022-27337.patch
# PATCH-FIX-SUSE bsc#1150039, CVE-2019-16115: fix an uninitialized memory error in GfxUnivariateShading::setupCache, fixed with memset()
Patch30:        poppler-CVE-2019-16115.patch
# CVE-2020-23804 [bsc#1215422], uncontrolled recursion in pdfinfo and pdftops
Patch31:        poppler-CVE-2020-23804.patch
# CVE-2022-37050 [bsc#1214622], denial-of-service via savePageAs in PDFDoc.c
Patch32:        poppler-CVE-2022-37050.patch
# CVE-2022-38349 [bsc#1214618], reachable assertion in Object.h, will lead to denial of service because PDFDoc:replacePageDict in PDFDoc.cc lacks a stream
Patch45:        poppler-CVE-2022-38349.patch
# CVE-2020-36024 [bsc#1214257], NULL Pointer Deference in `FoFiType1C:convertToType1`
Patch46:        poppler-CVE-2020-36024.patch
# CVE-2022-48545 [bsc#1214723], infinite recursion in Catalog:findDestInTree
Patch47:        poppler-CVE-2022-48545.patch
# CVE-2020-36023 [bsc#1214256], Stack-Overflow in `FoFiType1C:cvtGlyph`
Patch48:        poppler-CVE-2020-36023.patch
# CVE-2019-14292 [bsc#1143570], An issue was discovered in Xpdf 4.01.01. There is an out of bounds read in the function GfxPatchMeshShading:parse at GfxState.cc for typeA!=6 case 1.
Patch49:        poppler-CVE-2019-14292.patch
# CVE-2022-37052 [bsc#1214726], reachable assertion due to a failure in markObject()
Patch50:        poppler-CVE-2022-37052.patch
# CVE-2019-9545 [bsc#1128114], denial of service via recursive function call, in JBIG2Stream:readTextRegion() located in JBIG2Stream.cc
Patch51:        poppler-CVE-2019-9545.patch
# bsc#129202 comment 18
Patch52:        poppler-cairo-limit-downsample.patch
# CVE-2018-20662 [bsc#1120956], PDFDoc setup in PDFDoc.cc allows attackers to cause DOS because of a wrong return value from PDFDoc:setup
Patch53:        poppler-CVE-2018-20662.patch
# [bsc#1041783, CVE-2017-7511]
Patch54:        0001-pdfunite-Fix-crash-with-broken-documents.patch
# CVE-2024-4141 [bsc#1223375], Out-of-bounds array write
Patch55:        poppler-CVE-2024-4141.patch
BuildRequires:  gcc-c++
BuildRequires:  gobject-introspection-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libtiff-devel
%if %build_qt
BuildRequires:  libqt4-devel
%endif
%if %build_qt5
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Test)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5Xml)
%endif
%if 0%{?suse_version} >= 1320
BuildRequires:  openjpeg-devel
%endif
BuildRequires:  update-desktop-files
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(cairo) >= 1.10.0
BuildRequires:  pkgconfig(cairo-ft) >= 1.10.0
BuildRequires:  pkgconfig(cairo-pdf)
BuildRequires:  pkgconfig(cairo-ps)
BuildRequires:  pkgconfig(cairo-svg)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gobject-2.0) >= 2.18
BuildRequires:  pkgconfig(lcms2)
BuildRequires:  pkgconfig(libpng)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

%package -n libpoppler%{poppler_soname}
Summary:        PDF Rendering Library
Group:          System/Libraries
Recommends:     poppler-data >= %{poppler_data_version}
# Last appeared in OpenSUSE 10.3:
Provides:       poppler = %{version}
Obsoletes:      poppler < %{version}

%description -n libpoppler%{poppler_soname}
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

%package -n libpoppler-cpp%{poppler_cpp_soname}
Summary:        PDF Rendering Library
Group:          System/Libraries

%description -n libpoppler-cpp%{poppler_cpp_soname}
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

%package -n libpoppler-glib%{poppler_glib_soname}
Summary:        PDF Rendering Library - GLib Wrapper
Group:          System/Libraries
Requires:       libpoppler%{poppler_soname} >= %{version}
# Last appeared in OpenSUSE 10.3:
Provides:       poppler-glib = %{version}
Obsoletes:      poppler-glib < %{version}

%description -n libpoppler-glib%{poppler_glib_soname}
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

%package -n typelib-1_0-Poppler-%{poppler_apipkg}
Summary:        PDF Rendering Library - Introspection bindings
Group:          System/Libraries

%description -n typelib-1_0-Poppler-%{poppler_apipkg}
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

This package provides the GObject Introspection bindings for Poppler.

%if %build_qt

%package -n libpoppler-qt4-%{poppler_qt4_soname}
Summary:        PDF Rendering Library - Qt4 Wrapper
Group:          System/Libraries
Requires:       libpoppler%{poppler_soname} >= %{version}
# Last appeared in OpenSUSE 10.3:
Provides:       poppler-qt4 = %{version}
Obsoletes:      poppler-qt4 < %{version}

%description -n libpoppler-qt4-%{poppler_qt4_soname}
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.
%endif

%if %build_qt5

%package -n libpoppler-qt5-%{poppler_qt5_soname}
Summary:        PDF Rendering Library - Qt5 Wrapper
Group:          System/Libraries
Requires:       libpoppler%{poppler_soname} >= %{version}

%description -n libpoppler-qt5-%{poppler_qt5_soname}
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.
%endif

%package tools
Summary:        PDF Rendering Library Tools
Group:          Productivity/Publishing/PDF
Requires:       libpoppler%{poppler_soname} >= %{version}
# last version in openSUSE 11.1/SLE11
Provides:       xpdf-tools = 3.02
Obsoletes:      xpdf-tools < 3.02
Provides:       pdftools_any

%description tools
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

%package -n libpoppler-devel
Summary:        PDF rendering library
Group:          Development/Libraries/C and C++
Requires:       libpoppler%{poppler_soname} = %{version}
Requires:       libstdc++-devel
# Last appeared in OpenSUSE 10.3:
Provides:       poppler-devel = %{version}
Obsoletes:      poppler-devel < %{version}

%description -n libpoppler-devel
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

%package -n libpoppler-glib-devel
Summary:        PDF rendering library - GLib Wrapper
Group:          Development/Libraries/C and C++
Requires:       libpoppler-glib%{poppler_glib_soname} = %{version}
Requires:       typelib-1_0-Poppler-%{poppler_apipkg} = %{version}
# Last appeared in OpenSUSE 10.3:
Provides:       poppler-devel:%{_libdir}/libpoppler-glib.so
# Last appeared in 11.4
Provides:       libpoppler-doc = %{version}
Obsoletes:      libpoppler-doc < %{version}
# Last appeared in OpenSUSE 10.3:
Provides:       poppler-doc = %{version}
Obsoletes:      poppler-doc < %{version}

%description -n libpoppler-glib-devel
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.

%if %build_qt

%package -n libpoppler-qt4-devel
Summary:        PDF rendering library - Qt4 Wrapper
Group:          Development/Libraries/C and C++
Requires:       libpoppler-devel = %{version}
Requires:       libpoppler-qt4-%{poppler_qt4_soname} = %{version}
Requires:       libqt4-devel
# Last appeared in OpenSUSE 10.3:
Provides:       poppler-devel:%{_libdir}/libpoppler-qt4.so

%description -n libpoppler-qt4-devel
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.
%endif

%if %build_qt5

%package -n libpoppler-qt5-devel
Summary:        PDF rendering library - Qt5 Wrapper
Group:          Development/Libraries/C and C++
Requires:       libpoppler-devel = %{version}
Requires:       libpoppler-qt5-%{poppler_qt5_soname} = %{version}
Requires:       pkgconfig(Qt5Core)
Requires:       pkgconfig(Qt5Gui)
Requires:       pkgconfig(Qt5Widgets)
Requires:       pkgconfig(Qt5Xml)

%description -n libpoppler-qt5-devel
Poppler is a PDF rendering library, forked from the xpdf PDF viewer
developed by Derek Noonburg of Glyph and Cog, LLC.
%endif

%prep
%setup -q -n poppler-%{version}
%patch0
%patch1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1

%build
%if %build_qt5
export MOCQT5='%{_libqt5_bindir}/moc'
export MOCQT52='%{_libqt5_bindir}/moc'
%endif
export CXXFLAGS="%{optflags} -std=c++11"
%configure\
        --disable-silent-rules \
	--enable-xpdf-headers\
	--disable-static\
	--enable-shared\
	--enable-zlib \
%if %build_qt5
	--enable-poppler-qt5 \
	--disable-poppler-qt4 \
	--disable-poppler-glib \
	--disable-poppler-cpp \
%endif
%if %build_qt
	--enable-poppler-qt4 \
	--disable-poppler-qt5 \
	--disable-poppler-glib \
	--disable-poppler-cpp \
%endif
	--disable-gtk-test
make %{?_smp_mflags}

%install
%makeinstall
rm %{buildroot}%{_libdir}/*.la
%if %build_qt || %build_qt5
cd %{buildroot} && find . -type f -o -type l | grep -v qt | xargs rm -v
%endif

%post -n libpoppler%{poppler_soname} -p /sbin/ldconfig

%post -n libpoppler-glib%{poppler_glib_soname} -p /sbin/ldconfig

%if %build_qt

%post -n libpoppler-qt4-%{poppler_qt4_soname} -p /sbin/ldconfig
%endif

%if %build_qt5

%post -n libpoppler-qt5-%{poppler_qt5_soname} -p /sbin/ldconfig
%endif

%postun -n libpoppler%{poppler_soname} -p /sbin/ldconfig

%postun -n libpoppler-glib%{poppler_glib_soname} -p /sbin/ldconfig

%post -n libpoppler-cpp%{poppler_cpp_soname} -p /sbin/ldconfig

%postun -n libpoppler-cpp%{poppler_cpp_soname} -p /sbin/ldconfig

%if %build_qt

%postun -n libpoppler-qt4-%{poppler_qt4_soname} -p /sbin/ldconfig
%endif

%if %build_qt5

%postun -n libpoppler-qt5-%{poppler_qt5_soname} -p /sbin/ldconfig
%endif

%if %build_qt

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

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

%else
%if %build_qt5

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

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

%else

%files -n libpoppler%{poppler_soname}
%defattr (-, root, root)
%license COPYING
%doc AUTHORS ChangeLog NEWS README README-XPDF TODO
%{_libdir}/libpoppler.so.%{poppler_soname}*

%files -n libpoppler-glib%{poppler_glib_soname}
%defattr (-, root, root)
%{_libdir}/libpoppler-glib.so.%{poppler_glib_soname}*

%files -n typelib-1_0-Poppler-%{poppler_apipkg}
%defattr (-, root, root)
%{_libdir}/girepository-1.0/Poppler-%{poppler_api}.typelib

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

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

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

%files -n libpoppler-glib-devel
%defattr (-, root, root)
%{_includedir}/poppler/glib
%{_libdir}/libpoppler-glib.so
%{_libdir}/pkgconfig/poppler-glib.pc
%{_datadir}/gir-1.0/Poppler-%{poppler_api}.gir
%doc %{_datadir}/gtk-doc/html/poppler/

%endif
%endif

%changelog
openSUSE Build Service is sponsored by