pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/print/web2c web2c: support for newer poppler, from Arc...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b01bd63b236b
branches:  trunk
changeset: 373347:b01bd63b236b
user:      markd <markd%pkgsrc.org@localhost>
date:      Sun Dec 31 00:44:32 2017 +0000

description:
web2c: support for newer poppler, from ArchLinux

diffstat:

 print/web2c/Makefile                             |   16 +-
 print/web2c/distinfo                             |    4 +-
 print/web2c/patches/patch-pdftexdir_pdftoepdf.cc |  419 +++++++++++++++++++++++
 print/web2c/patches/patch-pdftexdir_pdftosrc.cc  |   97 +++++
 4 files changed, 525 insertions(+), 11 deletions(-)

diffs (truncated from 592 to 300 lines):

diff -r c4422b72092c -r b01bd63b236b print/web2c/Makefile
--- a/print/web2c/Makefile      Sun Dec 31 00:41:19 2017 +0000
+++ b/print/web2c/Makefile      Sun Dec 31 00:44:32 2017 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.64 2017/09/09 17:06:51 tnn Exp $
+# $NetBSD: Makefile,v 1.65 2017/12/31 00:44:32 markd Exp $
 
 DISTNAME=      texlive-20170524-source
 PKGNAME=       web2c-2017
-PKGREVISION=   4
+PKGREVISION=   5
 CATEGORIES=    print
 MASTER_SITES=  ftp://tug.org/historic/systems/texlive/2017/
 EXTRACT_SUFX=  .tar.xz
@@ -15,8 +15,6 @@
 DEPENDS+=      ptexenc>=1.3.4:../../print/ptexenc
 
 EXTRACT_ELEMENTS=      ${DISTNAME}/build-aux \
-                       ${DISTNAME}/libs/poppler \
-                       ${DISTNAME}/libs/xpdf \
                        ${DISTNAME}/texk/web2c
 
 GNU_CONFIGURE= yes
@@ -47,8 +45,8 @@
                        --with-mpfr-includes=${BUILDLINK_PREFIX.mpfr}/include \
                        --with-mpfr-libdir=${BUILDLINK_PREFIX.mpfr}/lib
 CONFIGURE_ARGS+=       --with-system-pixman
-#CONFIGURE_ARGS+=      --with-system-poppler
-#CONFIGURE_ARGS+=      --with-system-xpdf
+CONFIGURE_ARGS+=       --with-system-poppler
+CONFIGURE_ARGS+=       --with-system-xpdf
 CONFIGURE_ARGS+=       --with-system-ptexenc
 CONFIGURE_ARGS+=       --with-system-zlib \
                        --with-zlib-includes=${BUILDLINK_PREFIX.zlib}/include \
@@ -56,8 +54,6 @@
 LIBTOOL_OVERRIDE=      ../*/libtool */libtool
 
 CONFIGURE_DIRS=                ${WRKDIR}/${DISTNAME}/texk/web2c
-CONFIGURE_DIRS+=       ${WRKDIR}/${DISTNAME}/libs/poppler
-CONFIGURE_DIRS+=       ${WRKDIR}/${DISTNAME}/libs/xpdf
 INSTALL_DIRS=  ${WRKDIR}/${DISTNAME}/texk/web2c
 
 .include "../../devel/zlib/buildlink3.mk"
@@ -65,8 +61,8 @@
 .include "../../graphics/png/buildlink3.mk"
 .include "../../math/mpfr/buildlink3.mk"
 .include "../../print/kpathsea/buildlink3.mk"
-#.include "../../print/poppler/buildlink3.mk"
-#.include "../../print/poppler-includes/buildlink3.mk"
+.include "../../print/poppler/buildlink3.mk"
+.include "../../print/poppler-includes/buildlink3.mk"
 .include "../../print/ptexenc/buildlink3.mk"
 .include "../../x11/pixman/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff -r c4422b72092c -r b01bd63b236b print/web2c/distinfo
--- a/print/web2c/distinfo      Sun Dec 31 00:41:19 2017 +0000
+++ b/print/web2c/distinfo      Sun Dec 31 00:44:32 2017 +0000
@@ -1,7 +1,9 @@
-$NetBSD: distinfo,v 1.23 2017/09/09 17:06:51 tnn Exp $
+$NetBSD: distinfo,v 1.24 2017/12/31 00:44:32 markd Exp $
 
 SHA1 (texlive-20170524-source.tar.xz) = 1c1383ddb1b871c6b8ce49a4ae3c1a33d454a7b6
 RMD160 (texlive-20170524-source.tar.xz) = a8430c19fe1727cf308fe03e5838105260c0d71e
 SHA512 (texlive-20170524-source.tar.xz) = 18c18940992ab94ce22e22ccd4ad798253ea14ac2ab296a10ea5e9a8da9f33989f2e2641b42b564d1d5fb53bd371da3e68726b676d706b469016ad146cd19daa
 Size (texlive-20170524-source.tar.xz) = 63483372 bytes
 SHA1 (patch-am) = b7b81b1161a2117e756b25b80f9a676575267bdd
+SHA1 (patch-pdftexdir_pdftoepdf.cc) = c4258903e6369d3471022b96b96a64c014dfea2f
+SHA1 (patch-pdftexdir_pdftosrc.cc) = c428c847f1fc5cbdeefbdddd0c6fa38ef305691f
diff -r c4422b72092c -r b01bd63b236b print/web2c/patches/patch-pdftexdir_pdftoepdf.cc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/web2c/patches/patch-pdftexdir_pdftoepdf.cc  Sun Dec 31 00:44:32 2017 +0000
@@ -0,0 +1,419 @@
+$NetBSD: patch-pdftexdir_pdftoepdf.cc,v 1.3 2017/12/31 00:44:32 markd Exp $
+
+Allow recent poppler - from ArchLinux
+
+--- pdftexdir/pdftoepdf.cc.orig        2016-11-25 18:09:21.000000000 +0000
++++ pdftexdir/pdftoepdf.cc
+@@ -84,31 +84,6 @@ extern integer zround(double);
+ #define MASK_SUPPRESS_PTEX_PAGENUMBER 0x04
+ #define MASK_SUPPRESS_PTEX_INFODICT   0x08
+ 
+-// PdfObject encapsulates the xpdf Object type,
+-// and properly frees its resources on destruction.
+-// Use obj-> to access members of the Object,
+-// and &obj to get a pointer to the object.
+-// It is no longer necessary to call Object::free explicitely.
+-
+-class PdfObject {
+-  public:
+-    PdfObject() {               // nothing
+-    } ~PdfObject() {
+-        iObject.free();
+-    }
+-    Object *operator->() {
+-        return &iObject;
+-    }
+-    Object *operator&() {
+-        return &iObject;
+-    }
+-  private:                     // no copying or assigning
+-    PdfObject(const PdfObject &);
+-    void operator=(const PdfObject &);
+-  public:
+-    Object iObject;
+-};
+-
+ // When copying the Resources of the selected page, all objects are copied
+ // recusively top-down. Indirect objects however are not fetched during
+ // copying, but get a new object number from pdfTeX and then will be
+@@ -212,18 +187,6 @@ static void delete_document(PdfDocument
+     delete pdf_doc;
+ }
+ 
+-// Replacement for
+-//      Object *initDict(Dict *dict1){ initObj(objDict); dict = dict1; return this; }
+-
+-static void initDictFromDict(PdfObject & obj, Dict * dict)
+-{
+-    obj->initDict(xref);
+-    for (int i = 0, l = dict->getLength(); i < l; i++) {
+-        Object obj1;
+-        obj->dictAdd(copyString(dict->getKey(i)), dict->getValNF(i, &obj1));
+-    }
+-}
+-
+ // --------------------------------------------------------------------
+ 
+ static int addEncoding(GfxFont * gfont)
+@@ -320,10 +283,10 @@ static void copyName(char *s)
+ 
+ static void copyDictEntry(Object * obj, int i)
+ {
+-    PdfObject obj1;
++    Object obj1;
+     copyName(obj->dictGetKey(i));
+     pdf_puts(" ");
+-    obj->dictGetValNF(i, &obj1);
++    obj1 = obj->dictGetValNF(i);
+     copyObject(&obj1);
+     pdf_puts("\n");
+ }
+@@ -376,17 +339,17 @@ static void copyStream(Stream * str)
+ static void copyProcSet(Object * obj)
+ {
+     int i, l;
+-    PdfObject procset;
++    Object procset;
+     if (!obj->isArray())
+         pdftex_fail("PDF inclusion: invalid ProcSet array type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/ProcSet [ ");
+     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-        obj->arrayGetNF(i, &procset);
+-        if (!procset->isName())
++        procset = obj->arrayGetNF(i);
++        if (!procset.isName())
+             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
+-                        procset->getTypeName());
+-        copyName(procset->getName());
++                        procset.getTypeName());
++        copyName(procset.getName());
+         pdf_puts(" ");
+     }
+     pdf_puts("]\n");
+@@ -394,10 +357,29 @@ static void copyProcSet(Object * obj)
+ 
+ #define REPLACE_TYPE1C true
+ 
++static bool embeddableFont(Object * fontdesc)
++{
++    Object fontfile, ffsubtype;
++
++    if (!fontdesc->isDict())
++        return false;
++    fontfile = fontdesc->dictLookup("FontFile");
++    if (fontfile.isStream())
++        return true;
++    if (REPLACE_TYPE1C) {
++        fontfile = fontdesc->dictLookup("FontFile3");
++        if (!fontfile.isStream())
++            return false;
++        ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
++        return ffsubtype.isName() && !strcmp(ffsubtype.getName(), "Type1C");
++    }
++    return false;
++}
++
+ static void copyFont(char *tag, Object * fontRef)
+ {
+-    PdfObject fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
+-        fontfile, ffsubtype, stemV;
++    Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
++        stemV;
+     GfxFont *gfont;
+     fd_entry *fd;
+     fm_entry *fontmap;
+@@ -413,33 +395,39 @@ static void copyFont(char *tag, Object *
+     }
+     // Only handle included Type1 (and Type1C) fonts; anything else will be copied.
+     // Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true.
+-    if (!fixedinclusioncopyfont && fontRef->fetch(xref, &fontdict)->isDict()
+-        && fontdict->dictLookup("Subtype", &subtype)->isName()
+-        && !strcmp(subtype->getName(), "Type1")
+-        && fontdict->dictLookup("BaseFont", &basefont)->isName()
+-        && fontdict->dictLookupNF("FontDescriptor", &fontdescRef)->isRef()
+-        && fontdescRef->fetch(xref, &fontdesc)->isDict()
+-        && (fontdesc->dictLookup("FontFile", &fontfile)->isStream()
+-            || (REPLACE_TYPE1C
+-                && fontdesc->dictLookup("FontFile3", &fontfile)->isStream()
+-                && fontfile->streamGetDict()->lookup("Subtype",
+-                                                     &ffsubtype)->isName()
+-                && !strcmp(ffsubtype->getName(), "Type1C")))
+-        && (fontmap = lookup_fontmap(basefont->getName())) != NULL) {
++    fontdict = fontRef->fetch(xref);
++    fontdesc = Object(objNull);
++    if (fontdict.isDict()) {
++        subtype = fontdict.dictLookup("Subtype");
++        basefont = fontdict.dictLookup("BaseFont");
++        fontdescRef = fontdict.dictLookupNF("FontDescriptor");
++        if (fontdescRef.isRef()) {
++            fontdesc = fontdescRef.fetch(xref);
++        }
++    }
++    if (!fixedinclusioncopyfont && fontdict.isDict()
++        && subtype.isName()
++        && !strcmp(subtype.getName(), "Type1")
++        && basefont.isName()
++        && fontdescRef.isRef()
++        && fontdesc.isDict()
++        && embeddableFont(&fontdesc)
++        && (fontmap = lookup_fontmap(basefont.getName())) != NULL) {
+         // round /StemV value, since the PDF input is a float
+         // (see Font Descriptors in PDF reference), but we only store an
+         // integer, since we don't want to change the struct.
+-        fontdesc->dictLookup("StemV", &stemV);
+-        fd = epdf_create_fontdescriptor(fontmap, zround(stemV->getNum()));
+-        if (fontdesc->dictLookup("CharSet", &charset) &&
+-            charset->isString() && is_subsetable(fontmap))
+-            epdf_mark_glyphs(fd, charset->getString()->getCString());
++        stemV = fontdesc.dictLookup("StemV");
++        fd = epdf_create_fontdescriptor(fontmap, zround(stemV.getNum()));
++        charset = fontdesc.dictLookup("CharSet");
++        if (!charset.isNull() &&
++            charset.isString() && is_subsetable(fontmap))
++            epdf_mark_glyphs(fd, charset.getString()->getCString());
+         else
+             embed_whole_font(fd);
+-        addFontDesc(fontdescRef->getRef(), fd);
++        addFontDesc(fontdescRef.getRef(), fd);
+         copyName(tag);
+         gfont = GfxFont::makeFont(xref, tag, fontRef->getRef(),
+-                                  fontdict->getDict());
++                                  fontdict.getDict());
+         pdf_printf(" %d 0 R ", addFont(fontRef->getRef(), fd,
+                                        addEncoding(gfont)));
+     } else {
+@@ -451,24 +439,24 @@ static void copyFont(char *tag, Object *
+ 
+ static void copyFontResources(Object * obj)
+ {
+-    PdfObject fontRef;
++    Object fontRef;
+     int i, l;
+     if (!obj->isDict())
+         pdftex_fail("PDF inclusion: invalid font resources dict type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/Font << ");
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        obj->dictGetValNF(i, &fontRef);
+-        if (fontRef->isRef())
++        fontRef = obj->dictGetValNF(i);
++        if (fontRef.isRef())
+             copyFont(obj->dictGetKey(i), &fontRef);
+-        else if (fontRef->isDict()) {   // some programs generate pdf with embedded font object
++        else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
+             copyName(obj->dictGetKey(i));
+             pdf_puts(" ");
+             copyObject(&fontRef);
+         }
+         else
+             pdftex_fail("PDF inclusion: invalid font in reference type <%s>",
+-                        fontRef->getTypeName());
++                        fontRef.getTypeName());
+     }
+     pdf_puts(">>\n");
+ }
+@@ -557,7 +545,7 @@ static char *convertNumToPDF(double n)
+ 
+ static void copyObject(Object * obj)
+ {
+-    PdfObject obj1;
++    Object obj1;
+     int i, l, c;
+     Ref ref;
+     char *p;
+@@ -601,8 +589,8 @@ static void copyObject(Object * obj)
+     } else if (obj->isArray()) {
+         pdf_puts("[");
+         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {



Home | Main Index | Thread Index | Old Index