Fix the build with poppler-0.83.0.

Thanks to sthen@ for the cmake hack appending -std=c++14.

To be committed right after poppler.

Since rsadowski is afk for some time, I'd like to get at least tests
from calligra users.

Ciao,
        Kili

Index: Makefile
===================================================================
RCS file: /cvs/ports/editors/calligra/Makefile,v
retrieving revision 1.37
diff -u -p -r1.37 Makefile
--- Makefile    10 Nov 2019 15:32:56 -0000      1.37
+++ Makefile    18 Dec 2019 20:05:44 -0000
@@ -19,6 +19,9 @@ DPB_PROPERTIES =      parallel
 MODULES =      devel/kf5 \
                multimedia/phonon
 
+# c++-14; see also patches/patch-CMakeLists_txt
+COMPILER =                     base-clang ports-gcc
+
 SHARED_LIBS =   RtfReader                 50.0 # 0.0
 SHARED_LIBS +=  basicflakes               50.0 # 0.0
 SHARED_LIBS +=  calligrasheetscommon      50.0 # 9.0
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: patches/patch-CMakeLists_txt
diff -N patches/patch-CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-CMakeLists_txt        18 Dec 2019 20:05:44 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+Enforce -std=c++14 *after* -std=c++0x to let it build with poppler.
+From sthen@
+
+Index: CMakeLists.txt
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -950,6 +950,9 @@ set(KOPAGEAPP_INCLUDES ${TEXTLAYOUT_INCLUDES}
+                     ${CMAKE_SOURCE_DIR}/libs/pageapp/commands
+                     ${CMAKE_BINARY_DIR}/libs/pageapp )
+ 
++
++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
++
+ #############################################
+ ####           filter libraries          ####
+ #############################################
Index: patches/patch-filters_karbon_pdf_PdfImport_cpp
===================================================================
RCS file: 
/cvs/ports/editors/calligra/patches/patch-filters_karbon_pdf_PdfImport_cpp,v
retrieving revision 1.1
diff -u -p -r1.1 patch-filters_karbon_pdf_PdfImport_cpp
--- patches/patch-filters_karbon_pdf_PdfImport_cpp      17 Feb 2019 20:38:20 
-0000      1.1
+++ patches/patch-filters_karbon_pdf_PdfImport_cpp      18 Dec 2019 20:05:44 
-0000
@@ -4,10 +4,33 @@ Fix build with poppler 0.73
 https://cgit.kde.org/calligra.git/commit/?id=a615718
 https://cgit.kde.org/calligra.git/commit/?id=fb6bbaf
 
+And with poppler-0.83.
+
 Index: filters/karbon/pdf/PdfImport.cpp
 --- filters/karbon/pdf/PdfImport.cpp.orig
 +++ filters/karbon/pdf/PdfImport.cpp
-@@ -88,9 +88,9 @@ KoFilter::ConversionStatus PdfImport::convert(const QB
+@@ -60,19 +60,17 @@ KoFilter::ConversionStatus PdfImport::convert(const QB
+     }
+ 
+     // read config file
+-    globalParams = new GlobalParams();
++    globalParams = std::make_unique<GlobalParams>();
+     if (! globalParams)
+         return KoFilter::NotImplemented;
+ 
+     GooString * fname = new 
GooString(QFile::encodeName(m_chain->inputFile()).data());
+     PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
+     if (! pdfDoc) {
+-        delete globalParams;
+         return KoFilter::StupidError;
+     }
+ 
+     if (! pdfDoc->isOk()) {
+-        delete globalParams;
+         delete pdfDoc;
+         return KoFilter::StupidError;
+     }
+@@ -88,9 +86,9 @@ KoFilter::ConversionStatus PdfImport::convert(const QB
      SvgOutputDev * dev = new SvgOutputDev(m_chain->outputFile());
      if (dev->isOk()) {
          int rotate = 0;
@@ -20,9 +43,11 @@ Index: filters/karbon/pdf/PdfImport.cpp
          pdfDoc->displayPages(dev, firstPage, lastPage, hDPI, vDPI, rotate, 
useMediaBox, crop, printing);
          dev->dumpContent();
      }
-@@ -101,9 +101,6 @@ KoFilter::ConversionStatus PdfImport::convert(const QB
+@@ -99,11 +97,7 @@ KoFilter::ConversionStatus PdfImport::convert(const QB
+ 
+     delete dev;
      delete pdfDoc;
-     delete globalParams;
+-    delete globalParams;
      globalParams = 0;
 -
 -    // check for memory leaks
Index: patches/patch-filters_karbon_pdf_SvgOutputDev_cpp
===================================================================
RCS file: 
/cvs/ports/editors/calligra/patches/patch-filters_karbon_pdf_SvgOutputDev_cpp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-filters_karbon_pdf_SvgOutputDev_cpp
--- patches/patch-filters_karbon_pdf_SvgOutputDev_cpp   12 Nov 2019 22:05:36 
-0000      1.2
+++ patches/patch-filters_karbon_pdf_SvgOutputDev_cpp   18 Dec 2019 20:05:44 
-0000
@@ -7,7 +7,7 @@ https://cgit.kde.org/calligra.git/commit
 https://cgit.kde.org/calligra.git/commit/?id=05a65f9
 https://cgit.kde.org/calligra.git/commit/?id=3a65c7f
 
-and with poppler-0.82
+And with poppler-0.83
 
 Index: filters/karbon/pdf/SvgOutputDev.cpp
 --- filters/karbon/pdf/SvgOutputDev.cpp.orig
@@ -71,6 +71,24 @@ Index: filters/karbon/pdf/SvgOutputDev.c
  }
  
  void SvgOutputDev::startPage(int pageNum, GfxState *state, XRef */*xref*/)
+@@ -172,7 +172,7 @@ void SvgOutputDev::eoFill(GfxState *state)
+     *d->body << "/>" << endl;
+ }
+ 
+-QString SvgOutputDev::convertPath(GfxPath *path)
++QString SvgOutputDev::convertPath(const GfxPath *path)
+ {
+     if (! path)
+         return QString();
+@@ -180,7 +180,7 @@ QString SvgOutputDev::convertPath(GfxPath *path)
+     QString output;
+ 
+     for (int i = 0; i < path->getNumSubpaths(); ++i) {
+-        GfxSubpath * subpath = path->getSubpath(i);
++        const GfxSubpath * subpath = path->getSubpath(i);
+         if (subpath->getNumPoints() > 0) {
+             output += QString("M%1 
%2").arg(subpath->getX(0)).arg(subpath->getY(0));
+             int j = 1;
 @@ -212,7 +212,7 @@ QString SvgOutputDev::convertMatrix(const QMatrix &mat
             .arg(matrix.dx()) .arg(matrix.dy());
  }
Index: patches/patch-filters_karbon_pdf_SvgOutputDev_h
===================================================================
RCS file: 
/cvs/ports/editors/calligra/patches/patch-filters_karbon_pdf_SvgOutputDev_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-filters_karbon_pdf_SvgOutputDev_h
--- patches/patch-filters_karbon_pdf_SvgOutputDev_h     12 Nov 2019 22:05:36 
-0000      1.2
+++ patches/patch-filters_karbon_pdf_SvgOutputDev_h     18 Dec 2019 20:05:44 
-0000
@@ -4,7 +4,7 @@ Fix build with poppler 0.73
 https://cgit.kde.org/calligra.git/commit/?id=a615718
 https://cgit.kde.org/calligra.git/commit/?id=ab9cb33
 
-and with poppler-0.82
+And with poppler-0.83
 
 Index: filters/karbon/pdf/SvgOutputDev.h
 --- filters/karbon/pdf/SvgOutputDev.h.orig
@@ -44,9 +44,12 @@ Index: filters/karbon/pdf/SvgOutputDev.h
  
      // styles
      virtual void updateAll(GfxState *state);
-@@ -84,7 +84,7 @@ class SvgOutputDev : public OutputDev (public)
+@@ -82,9 +82,9 @@ class SvgOutputDev : public OutputDev (public)
+     /// Dumps content to svg file
+     void dumpContent();
  private:
-     QString convertPath(GfxPath *path);
+-    QString convertPath(GfxPath *path);
++    QString convertPath(const GfxPath *path);
      QString convertMatrix(const QMatrix &matrix);
 -    QString convertMatrix(double * matrix);
 +    QString convertMatrix(const double * matrix);

Reply via email to