pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/print/web2c Fix build with print/poppler-0.76.1



details:   https://anonhg.NetBSD.org/pkgsrc/rev/de7255c12647
branches:  trunk
changeset: 323423:de7255c12647
user:      ryoon <ryoon%pkgsrc.org@localhost>
date:      Fri May 10 19:19:09 2019 +0000

description:
Fix build with print/poppler-0.76.1

Use a patch from upstream and mine.

diffstat:

 print/web2c/distinfo                                        |    6 +-
 print/web2c/patches/patch-pdftexdir_pdftoepdf-newpoppler.cc |  293 +++++++----
 print/web2c/patches/patch-pdftexdir_pdftosrc-newpoppler.cc  |   30 +-
 3 files changed, 211 insertions(+), 118 deletions(-)

diffs (truncated from 413 to 300 lines):

diff -r f8bf9a86dcf8 -r de7255c12647 print/web2c/distinfo
--- a/print/web2c/distinfo      Fri May 10 18:26:46 2019 +0000
+++ b/print/web2c/distinfo      Fri May 10 19:19:09 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.32 2019/02/28 19:34:49 markd Exp $
+$NetBSD: distinfo,v 1.33 2019/05/10 19:19:09 ryoon Exp $
 
 SHA1 (texlive-20180414-source.tar.xz) = 81bdd9999b6ab860d1d3c388cf27062aba960255
 RMD160 (texlive-20180414-source.tar.xz) = 0ff63bbd7f8a0fb6417089f5d1ae1e4124a1dd95
@@ -7,7 +7,7 @@
 SHA1 (patch-Makefile.in) = 28e7ad00f3796b49f92c5cc3eb3c94bdf38b1364
 SHA1 (patch-am) = b7b81b1161a2117e756b25b80f9a676575267bdd
 SHA1 (patch-pdftexdir_pdftex-common.h) = 59f32828de5dd032307467d83e43f21382a39330
-SHA1 (patch-pdftexdir_pdftoepdf-newpoppler.cc) = 5e49877943211d068f7daff190351e13a1b059d3
-SHA1 (patch-pdftexdir_pdftosrc-newpoppler.cc) = 497c4d87ae6882e1488b9e440e011680e7a46f62
+SHA1 (patch-pdftexdir_pdftoepdf-newpoppler.cc) = aff81fbdeb0cfee1f52d98e53507a227ac899ba6
+SHA1 (patch-pdftexdir_pdftosrc-newpoppler.cc) = 91b94d9f77edd349c9b0bd1a5c20c190f1a3e5c1
 SHA1 (patch-pdftexdir_writeenc.c) = daf41fec97d3d3e46063d8cf4c559d96e1ec69bf
 SHA1 (patch-pdftexdir_writet1.c) = 7d00d5d5d3f884bc1f9946cb3fbcaa7f224df9de
diff -r f8bf9a86dcf8 -r de7255c12647 print/web2c/patches/patch-pdftexdir_pdftoepdf-newpoppler.cc
--- a/print/web2c/patches/patch-pdftexdir_pdftoepdf-newpoppler.cc       Fri May 10 18:26:46 2019 +0000
+++ b/print/web2c/patches/patch-pdftexdir_pdftoepdf-newpoppler.cc       Fri May 10 19:19:09 2019 +0000
@@ -1,7 +1,16 @@
-$NetBSD: patch-pdftexdir_pdftoepdf-newpoppler.cc,v 1.4 2019/02/28 19:34:50 markd Exp $
+$NetBSD: patch-pdftexdir_pdftoepdf-newpoppler.cc,v 1.5 2019/05/10 19:19:09 ryoon Exp $
 
 --- pdftexdir/pdftoepdf-newpoppler.cc.orig     2018-04-04 04:08:11.000000000 +0000
 +++ pdftexdir/pdftoepdf-newpoppler.cc
+@@ -22,7 +22,7 @@ This is based on the patch texlive-poppl
+ https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
+ by Arch Linux. A little modifications are made to avoid a crash for
+ some kind of pdf images, such as figure_missing.pdf in gnuplot.
+-The poppler should be 0.59.0 or newer versions.
++The poppler should be 0.76.0 or newer versions.
+ POPPLER_VERSION should be defined.
+ */
+ 
 @@ -120,7 +120,7 @@ struct UsedEncoding {
  
  static InObj *inObjList;
@@ -11,33 +20,50 @@
  
  // --------------------------------------------------------------------
  // Maintain list of open embedded PDF files
-@@ -275,7 +275,7 @@ static int getNewObjectNumber(Ref ref)
- 
- static void copyObject(Object *);
- 
--static void copyName(char *s)
-+static void copyName(const char *s)
- {
-     pdf_puts("/");
-     for (; *s != 0; s++) {
-@@ -310,7 +310,7 @@ static void copyDict(Object * obj)
- static void copyFontDict(Object * obj, InObj * r)
+@@ -290,9 +290,9 @@ static void copyName(char *s)
+ static void copyDictEntry(Object * obj, int i)
  {
-     int i, l;
--    char *key;
-+    const char *key;
-     if (!obj->isDict())
-         pdftex_fail("PDF inclusion: invalid dict type <%s>",
+     Object obj1;
+-    copyName(obj->dictGetKey(i));
++    copyName((char *)obj->dictGetKey(i));
+     pdf_puts(" ");
+-    obj1 = obj->dictGetValNF(i);
++    obj1 = obj->dictGetValNF(i).copy();
+     copyObject(&obj1);
+     pdf_puts("\n");
+ }
+@@ -317,7 +317,7 @@ static void copyFontDict(Object * obj, I
+     pdf_puts("<<\n");
+     assert(r->type == objFont); // FontDescriptor is in fd_tree
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        key = obj->dictGetKey(i);
++        key = (char *)obj->dictGetKey(i);
+         if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0
+             || strncmp("BaseFont", key, strlen("BaseFont")) == 0
+             || strncmp("Encoding", key, strlen("Encoding")) == 0)
+@@ -351,11 +351,11 @@ static void copyProcSet(Object * obj)
                      obj->getTypeName());
-@@ -382,7 +382,7 @@ static bool embeddableFont(Object * font
-     return false;
- }
- 
--static void copyFont(char *tag, Object * fontRef)
-+static void copyFont(const char *tag, Object * fontRef)
- {
-     Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
-         stemV;
+     pdf_puts("/ProcSet [ ");
+     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-        procset = obj->arrayGetNF(i);
++        procset = obj->arrayGetNF(i).copy();
+         if (!procset.isName())
+             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
+                         procset.getTypeName());
+-        copyName(procset.getName());
++        copyName((char *)procset.getName());
+         pdf_puts(" ");
+     }
+     pdf_puts("]\n");
+@@ -406,7 +406,7 @@ static void copyFont(char *tag, Object *
+     if (fontdict.isDict()) {
+         subtype = fontdict.dictLookup("Subtype");
+         basefont = fontdict.dictLookup("BaseFont");
+-        fontdescRef = fontdict.dictLookupNF("FontDescriptor");
++        fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
+         if (fontdescRef.isRef()) {
+             fontdesc = fontdescRef.fetch(xref);
+         }
 @@ -418,7 +418,7 @@ static void copyFont(char *tag, Object *
          && fontdescRef.isRef()
          && fontdesc.isDict()
@@ -56,76 +82,82 @@
          else
              embed_whole_font(fd);
          addFontDesc(fontdescRef.getRef(), fd);
-@@ -467,7 +467,7 @@ static void copyFontResources(Object * o
-     pdf_puts(">>\n");
- }
- 
--static void copyOtherResources(Object * obj, char *key)
-+static void copyOtherResources(Object * obj, const char *key)
- {
-     // copies all other resources (write_epdf handles Fonts and ProcSets),
- 
-@@ -554,8 +554,8 @@ static void copyObject(Object * obj)
-     Object obj1;
-     int i, l, c;
-     Ref ref;
--    char *p;
--    GString *s;
-+    const char *p;
-+    const GString *s;
-     if (obj->isBool()) {
-         pdf_printf("%s", obj->getBool()? "true" : "false");
-     } else if (obj->isInt()) {
-@@ -566,7 +566,7 @@ static void copyObject(Object * obj)
+@@ -452,11 +452,11 @@ static void copyFontResources(Object * o
+                     obj->getTypeName());
+     pdf_puts("/Font << ");
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        fontRef = obj->dictGetValNF(i);
++        fontRef = obj->dictGetValNF(i).copy();
+         if (fontRef.isRef())
+-            copyFont(obj->dictGetKey(i), &fontRef);
++            copyFont((char *)obj->dictGetKey(i), &fontRef);
+         else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
+-            copyName(obj->dictGetKey(i));
++            copyName((char *)obj->dictGetKey(i));
+             pdf_puts(" ");
+             copyObject(&fontRef);
+         }
+@@ -565,8 +565,8 @@ static void copyObject(Object * obj)
+     } else if (obj->isNum()) {
          pdf_printf("%s", convertNumToPDF(obj->getNum()));
      } else if (obj->isString()) {
-         s = obj->getString();
+-        s = obj->getString();
 -        p = s->getCString();
-+        p = s->c_str();
++        s = (GooString *)obj->getString();
++        p = (char *)s->c_str();
          l = s->getLength();
          if (strlen(p) == (unsigned int) l) {
              pdf_puts("(");
-@@ -655,7 +655,7 @@ static void writeRefs()
- static void writeEncodings()
- {
-     UsedEncoding *r, *n;
--    char *glyphNames[256], *s;
-+    const char *glyphNames[256], *s;
-     int i;
-     for (r = encodingList; r != 0; r = r->next) {
-         for (i = 0; i < 256; i++) {
-@@ -685,20 +685,24 @@ static void writeEncodings()
- // get the pagebox according to the pagebox_spec
- static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
- {
-+    const PDFRectangle *ret;
-+
-     if (pagebox_spec == pdfboxspecmedia)
--        return page->getMediaBox();
-+        ret = page->getMediaBox();
-     else if (pagebox_spec == pdfboxspeccrop)
--        return page->getCropBox();
-+        ret = page->getCropBox();
-     else if (pagebox_spec == pdfboxspecbleed)
--        return page->getBleedBox();
-+        ret = page->getBleedBox();
-     else if (pagebox_spec == pdfboxspectrim)
--        return page->getTrimBox();
-+        ret = page->getTrimBox();
-     else if (pagebox_spec == pdfboxspecart)
--        return page->getArtBox();
-+        ret = page->getArtBox();
-     else
-         pdftex_fail("PDF inclusion: unknown value of pagebox spec (%i)",
-                     (int) pagebox_spec);
--    return page->getMediaBox(); // to make the compiler happy
-+    // ret = page->getMediaBox(); // to make the compiler happy
-+
-+    return const_cast<PDFRectangle*>(ret);
+@@ -589,13 +589,13 @@ static void copyObject(Object * obj)
+             pdf_puts(">");
+         }
+     } else if (obj->isName()) {
+-        copyName(obj->getName());
++        copyName((char *)obj->getName());
+     } else if (obj->isNull()) {
+         pdf_puts("null");
+     } else if (obj->isArray()) {
+         pdf_puts("[");
+         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-            obj1 = obj->arrayGetNF(i);
++            obj1 = obj->arrayGetNF(i).copy();
+             if (!obj1.isName())
+                 pdf_puts(" ");
+             copyObject(&obj1);
+@@ -664,12 +664,12 @@ static void writeEncodings()
+                     ("PDF inclusion: CID fonts are not supported"
+                      " (try to disable font replacement to fix this)");
+             }
+-            if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
++            if ((s = (char *)((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
+                 glyphNames[i] = s;
+             else
+                 glyphNames[i] = notdef;
+         }
+-        epdf_write_enc(glyphNames, r->enc_objnum);
++        epdf_write_enc(const_cast<const char**>(glyphNames), r->enc_objnum);
+     }
+     for (r = encodingList; r != 0; r = n) {
+         n = r->next;
+@@ -683,7 +683,7 @@ static void writeEncodings()
  }
  
- 
-@@ -724,8 +728,8 @@ read_pdf_info(char *image_name, char *pa
+ // get the pagebox according to the pagebox_spec
+-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
++static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+ {
+     if (pagebox_spec == pdfboxspecmedia)
+         return page->getMediaBox();
+@@ -715,7 +715,7 @@ read_pdf_info(char *image_name, char *pa
+ {
+     PdfDocument *pdf_doc;
+     Page *page;
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+ #ifdef POPPLER_VERSION
+     int pdf_major_version_found, pdf_minor_version_found;
+ #else
+@@ -724,8 +724,8 @@ read_pdf_info(char *image_name, char *pa
      // initialize
      if (!isInit) {
          globalParams = new GlobalParams();
@@ -136,21 +168,82 @@
      }
      // open PDF file
      pdf_doc = find_add_document(image_name);
-@@ -822,7 +826,7 @@ void write_epdf(void)
-     Object groupDict;
-     bool writeSepGroup = false;
-     Object info;
--    char *key;
-+    const char *key;
-     char s[256];
-     int i, l;
-     int rotate;
-@@ -977,7 +981,7 @@ The changes below seem to work fine. 
+@@ -761,7 +761,7 @@ read_pdf_info(char *image_name, char *pa
+         if (link == 0 || !link->isOk())
+             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+         Ref ref = link->getPageRef();
+-        page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
++        page_num = pdf_doc->doc->getCatalog()->findPage(ref);
+         if (page_num == 0)
+             pdftex_fail("PDF inclusion: destination is not a page <%s>",
+                         page_name);
+@@ -849,7 +849,7 @@ void write_epdf(void)
+     pageObj = xref->fetch(pageRef->num, pageRef->gen);
+     pageDict = pageObj.getDict();
+     rotate = page->getRotate();
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+     // write the Page header
+     pdf_puts("/Type /XObject\n");
+     pdf_puts("/Subtype /Form\n");
+@@ -865,7 +865,7 @@ void write_epdf(void)
+         pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, (int) epdf_selected_page);
+     }
+     if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) {
+-        info = pdf_doc->doc->getDocInfoNF();
++        info = pdf_doc->doc->getDocInfoNF().copy();
+         if (info.isRef()) {



Home | Main Index | Thread Index | Old Index