[packages/ka5-kitinerary] - fix building with poppler 0.83 - rel 3
baggins
baggins at pld-linux.org
Mon Mar 23 22:17:26 CET 2020
commit f7965bac8099b2dfec159c450cc9e8b69c4e0830
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Mon Mar 23 22:14:56 2020 +0100
- fix building with poppler 0.83
- rel 3
ka5-kitinerary.spec | 4 +-
poppler-0.83.patch | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 196 insertions(+), 1 deletion(-)
---
diff --git a/ka5-kitinerary.spec b/ka5-kitinerary.spec
index 893cbbc..e37ae19 100644
--- a/ka5-kitinerary.spec
+++ b/ka5-kitinerary.spec
@@ -5,12 +5,13 @@
Summary: kitinerary
Name: ka5-%{kaname}
Version: 19.04.1
-Release: 2
+Release: 3
License: GPL v2+/LGPL v2.1+
Group: X11/Libraries
Source0: http://download.kde.org/stable/applications/%{kdeappsver}/src/%{kaname}-%{version}.tar.xz
# Source0-md5: d1e9604ac8dccbb550def3efb1233722
Patch0: poppler-0.82.patch
+Patch1: poppler-0.83.patch
URL: http://www.kde.org/
BuildRequires: Qt5Core-devel >= %{qtver}
BuildRequires: Qt5Gui-devel
@@ -57,6 +58,7 @@ Pliki nagłówkowe dla programistów używających %{kaname}.
%prep
%setup -q -n %{kaname}-%{version}
%patch0 -p1
+%patch1 -p1
%build
install -d build
diff --git a/poppler-0.83.patch b/poppler-0.83.patch
new file mode 100644
index 0000000..7a0bfad
--- /dev/null
+++ b/poppler-0.83.patch
@@ -0,0 +1,193 @@
+diff -urN kitinerary-19.04.1/src/CMakeLists.txt kitinerary-19.04.1-poppler-0.83/src/CMakeLists.txt
+--- kitinerary-19.04.1/src/CMakeLists.txt 2019-04-29 07:13:27.000000000 +0200
++++ kitinerary-19.04.1-poppler-0.83/src/CMakeLists.txt 2020-03-23 22:04:40.513590800 +0100
+@@ -50,6 +50,7 @@
+ locationutil.cpp
+ mergeutil.cpp
+ pdfdocument.cpp
++ popplerglobalparams.cpp
+ qimageluminancesource.cpp
+ qimagepurebinarizer.cpp
+ rct2ticket.cpp
+diff -urN kitinerary-19.04.1/src/pdfdocument.cpp kitinerary-19.04.1-poppler-0.83/src/pdfdocument.cpp
+--- kitinerary-19.04.1/src/pdfdocument.cpp 2020-03-23 22:12:02.086930170 +0100
++++ kitinerary-19.04.1-poppler-0.83/src/pdfdocument.cpp 2020-03-23 22:06:52.540259271 +0100
+@@ -17,13 +17,13 @@
+
+ #include "config-kitinerary.h"
+ #include "pdfdocument.h"
++#include "popplerglobalparams_p.h"
+
+ #include <QDebug>
+ #include <QImage>
+ #include <QScopedValueRollback>
+
+ #ifdef HAVE_POPPLER
+-#include <GlobalParams.h>
+ #include <PDFDoc.h>
+ #include <Stream.h>
+ #include <TextOutputDev.h>
+@@ -81,15 +81,6 @@
+ };
+
+ #ifdef HAVE_POPPLER
+-static std::unique_ptr<GlobalParams> s_globalParams;
+-static GlobalParams* popplerGlobalParams()
+-{
+- if (!s_globalParams) {
+- s_globalParams.reset(new GlobalParams);
+- }
+- return s_globalParams.get();
+-}
+-
+ class ExtractorOutputDevice : public TextOutputDev
+ {
+ public:
+@@ -309,7 +300,7 @@
+ }
+
+ #ifdef HAVE_POPPLER
+- QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
++ PopplerGlobalParams gp;
+
+ #ifdef HAVE_POPPLER_0_69
+ const auto xref = d->m_page->m_doc->m_popplerDoc->getXRef();
+@@ -348,7 +339,7 @@
+ }
+
+ #ifdef HAVE_POPPLER
+- QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
++ PopplerGlobalParams gp;
+ ExtractorOutputDevice device;
+ m_doc->m_popplerDoc->displayPageSlice(&device, m_pageNum + 1, 72, 72, 0, false, true, false, -1, -1, -1, -1);
+ const auto pageRect = m_doc->m_popplerDoc->getPage(m_pageNum + 1)->getCropBox();
+@@ -392,7 +383,7 @@
+ QString PdfPage::textInRect(double left, double top, double right, double bottom) const
+ {
+ #ifdef HAVE_POPPLER
+- QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
++ PopplerGlobalParams gp;
+
+ ExtractorOutputDevice device;
+ d->m_doc->m_popplerDoc->displayPageSlice(&device, d->m_pageNum + 1, 72, 72, 0, false, true, false, -1, -1, -1, -1);
+@@ -439,7 +430,7 @@
+ d->load();
+ QVariantList l;
+ #ifdef HAVE_POPPLER
+- QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
++ PopplerGlobalParams gp;
+ const auto pageRect = d->m_doc->m_popplerDoc->getPage(d->m_pageNum + 1)->getCropBox();
+
+ for (const auto &img : d->m_images) {
+@@ -504,7 +495,7 @@
+ PdfDocument* PdfDocument::fromData(const QByteArray &data, QObject *parent)
+ {
+ #ifdef HAVE_POPPLER
+- QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
++ PopplerGlobalParams gp;
+
+ std::unique_ptr<PdfDocument> doc(new PdfDocument(parent));
+ doc->d->m_pdfData = data;
+diff -urN kitinerary-19.04.1/src/popplerglobalparams.cpp kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams.cpp
+--- kitinerary-19.04.1/src/popplerglobalparams.cpp 1970-01-01 01:00:00.000000000 +0100
++++ kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams.cpp 2020-03-23 22:10:40.633595724 +0100
+@@ -0,0 +1,55 @@
++/*
++ Copyright (C) 2019 Volker Krause <vkrause at kde.org>
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or (at your
++ option) any later version.
++
++ This program is distributed in the hope that it will be useful, but WITHOUT
++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
++ License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <https://www.gnu.org/licenses/>.
++*/
++
++#include "config-kitinerary.h"
++#include "popplerglobalparams_p.h"
++
++#include <qglobal.h>
++
++#ifdef HAVE_POPPLER
++#include <GlobalParams.h>
++
++using namespace KItinerary;
++
++static std::unique_ptr<GlobalParams> s_globalParams;
++
++PopplerGlobalParams::PopplerGlobalParams()
++{
++ if (!s_globalParams) {
++ s_globalParams.reset(new GlobalParams);
++ }
++
++#ifdef HAVE_POPPLER_0_82
++ std::swap(globalParams, m_prev);
++ std::swap(s_globalParams, globalParams);
++#else
++ m_prev.reset(globalParams);
++ globalParams = s_globalParams.get();
++#endif
++}
++
++PopplerGlobalParams::~PopplerGlobalParams()
++{
++#ifdef HAVE_POPPLER_0_82
++ std::swap(s_globalParams, globalParams);
++ std::swap(globalParams, m_prev);
++#else
++ globalParams = m_prev.release();
++#endif
++}
++
++#endif
+diff -urN kitinerary-19.04.1/src/popplerglobalparams_p.h kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams_p.h
+--- kitinerary-19.04.1/src/popplerglobalparams_p.h 1970-01-01 01:00:00.000000000 +0100
++++ kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams_p.h 2020-03-23 22:04:09.146923695 +0100
+@@ -0,0 +1,40 @@
++/*
++ Copyright (C) 2019 Volker Krause <vkrause at kde.org>
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or (at your
++ option) any later version.
++
++ This program is distributed in the hope that it will be useful, but WITHOUT
++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
++ License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <https://www.gnu.org/licenses/>.
++*/
++
++#ifndef KITINERARY_POPPLERGLOBALPARAMS_H
++#define KITINERARY_POPPLERGLOBALPARAMS_H
++
++#include <memory>
++
++class GlobalParams;
++
++namespace KItinerary {
++
++/** RAII wrapper of the globalParams object. */
++class PopplerGlobalParams
++{
++public:
++ PopplerGlobalParams();
++ ~PopplerGlobalParams();
++
++private:
++ std::unique_ptr<GlobalParams> m_prev;
++};
++
++}
++
++#endif // KITINERARY_POPPLERGLOBALPARAMS_H
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/ka5-kitinerary.git/commitdiff/f7965bac8099b2dfec159c450cc9e8b69c4e0830
More information about the pld-cvs-commit
mailing list