From f660f7f0735afb1436c506eb3f8854e9a1141f07 Mon Sep 17 00:00:00 2001 From: ryoon Date: Sat, 11 Jan 2020 00:31:05 +0000 Subject: web2c: Fix build with poppler-0.84.0 --- print/web2c/Makefile | 6 +- print/web2c/distinfo | 7 +- .../patch-pdftexdir_pdftoepdf-poppler0.75.0.cc | 161 ++++++++------------- .../patches/patch-pdftexdir_pdftosrc-newpoppler.cc | 60 +++++--- print/web2c/patches/patch-pdftexdir_utils.c | 14 ++ 5 files changed, 127 insertions(+), 121 deletions(-) create mode 100644 print/web2c/patches/patch-pdftexdir_utils.c diff --git a/print/web2c/Makefile b/print/web2c/Makefile index 0c586f5d94b..0c9de5c1825 100644 --- a/print/web2c/Makefile +++ b/print/web2c/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.90 2019/11/07 12:38:08 wiz Exp $ +# $NetBSD: Makefile,v 1.91 2020/01/11 00:31:05 ryoon Exp $ PKGREVISION= 3 .include "../../print/texlive/Makefile.common" @@ -14,7 +14,7 @@ DEPENDS+= ptexenc>=1.3.7:../../print/ptexenc EXTRACT_ELEMENTS+= ${DISTNAME}/texk/web2c -USE_LANGUAGES= c c++11 +USE_LANGUAGES= c c++14 USE_TOOLS+= gmake lex yacc GNU_CONFIGURE_STRICT= no # texk/web2c/web2c doesn't know the options PKGCONFIG_OVERRIDE= synctexdir/synctex.pc.in @@ -22,6 +22,8 @@ PKGCONFIG_OVERRIDE= synctexdir/synctex.pc.in INFO_FILES= yes WRKSRC= ${WRKDIR}/${DISTNAME}/texk/web2c +#CXXFLAGS+= -fpermissive + CONFIGURE_ARGS+= --disable-luatex CONFIGURE_ARGS+= --disable-luatex53 CONFIGURE_ARGS+= --disable-luajittex diff --git a/print/web2c/distinfo b/print/web2c/distinfo index 9d48284455f..fc4f7511251 100644 --- a/print/web2c/distinfo +++ b/print/web2c/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.34 2019/05/14 13:23:10 adam Exp $ +$NetBSD: distinfo,v 1.35 2020/01/11 00:31:05 ryoon Exp $ SHA1 (texlive-20190410-source.tar.xz) = d700878d3e19b6ad1313791dd5cef4bf0acfd675 RMD160 (texlive-20190410-source.tar.xz) = a0cbe56b19b1f3d064315c37f8b5a4b04f82678b @@ -7,6 +7,7 @@ Size (texlive-20190410-source.tar.xz) = 53783408 bytes SHA1 (patch-Makefile.in) = ec3cc8f935d7365c90aabcd68be431eb706d970e SHA1 (patch-man_Makefile.in) = 8d0cbcd73f113135ea400c0491a4c0cbd0b07c73 SHA1 (patch-pdftexdir_pdftex-common.h) = 0f82056b5431c0a4718ab8609967f2ec9aeca3a9 -SHA1 (patch-pdftexdir_pdftoepdf-poppler0.75.0.cc) = fed92e4cc1fa8086eb70dd44726371e1df64f79f -SHA1 (patch-pdftexdir_pdftosrc-newpoppler.cc) = ce79bc0fc98756493adb1b57724ccb7f7b2821aa +SHA1 (patch-pdftexdir_pdftoepdf-poppler0.75.0.cc) = ac5c44afe5eacd6e7b955ba7acb335f10249d0c3 +SHA1 (patch-pdftexdir_pdftosrc-newpoppler.cc) = ff18cc9bcb0dc665f7981bf06fba753e67117269 +SHA1 (patch-pdftexdir_utils.c) = 989dc2fe8097d4d31ee2ba03885f00da0f1ab39b SHA1 (patch-pdftexdir_writeenc.c) = d2dfedf140c2c2c9143bc701291c09d3a8d3f3a4 diff --git a/print/web2c/patches/patch-pdftexdir_pdftoepdf-poppler0.75.0.cc b/print/web2c/patches/patch-pdftexdir_pdftoepdf-poppler0.75.0.cc index f2e02a7e2f9..c290bcd074c 100644 --- a/print/web2c/patches/patch-pdftexdir_pdftoepdf-poppler0.75.0.cc +++ b/print/web2c/patches/patch-pdftexdir_pdftoepdf-poppler0.75.0.cc @@ -1,97 +1,65 @@ -$NetBSD: patch-pdftexdir_pdftoepdf-poppler0.75.0.cc,v 1.1 2019/05/14 13:23:10 adam Exp $ - -Fix building. +$NetBSD: patch-pdftexdir_pdftoepdf-poppler0.75.0.cc,v 1.2 2020/01/11 00:31:05 ryoon Exp $ --- pdftexdir/pdftoepdf-poppler0.75.0.cc.orig 2019-03-21 06:38:16.000000000 +0000 +++ pdftexdir/pdftoepdf-poppler0.75.0.cc -@@ -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) - { - int i, l; -- char *key; -+ const char *key; - if (!obj->isDict()) - pdftex_fail("PDF inclusion: invalid dict type <%s>", - obj->getTypeName()); -@@ -382,7 +382,7 @@ static bool embeddableFont(Object * font - return false; - } +@@ -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.75.0 or newer versions. ++The poppler should be 0.83.0 or newer versions. + POPPLER_VERSION should be defined. + */ --static void copyFont(char *tag, Object * fontRef) -+static void copyFont(const char *tag, Object * fontRef) - { - Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset, - stemV; -@@ -467,7 +467,7 @@ static void copyFontResources(Object * o - pdf_puts(">>\n"); - } +@@ -669,7 +669,7 @@ static void writeEncodings() + else + glyphNames[i] = notdef; + } +- epdf_write_enc(glyphNames, r->enc_objnum); ++ epdf_write_enc(const_cast(glyphNames), r->enc_objnum); + } + for (r = encodingList; r != 0; r = n) { + n = r->next; +@@ -710,7 +710,7 @@ static const PDFRectangle *get_pagebox(P --static void copyOtherResources(Object * obj, char *key) -+static void copyOtherResources(Object * obj, const char *key) + int + read_pdf_info(char *image_name, char *page_name, int page_num, +- int pagebox_spec, int minor_pdf_version_wanted, ++ int pagebox_spec, /* int major_pdf_version_wanted, */ int minor_pdf_version_wanted, + int pdf_inclusion_errorlevel) { - // 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()) { -@@ -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 const 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(ret); - } - - -@@ -761,7 +765,7 @@ read_pdf_info(char *image_name, char *pa + PdfDocument *pdf_doc; +@@ -723,7 +723,7 @@ read_pdf_info(char *image_name, char *pa + #endif + // initialize + if (!isInit) { +- globalParams = new GlobalParams(); ++ globalParams = std::make_unique(); + globalParams->setErrQuiet(false); + isInit = true; + } +@@ -738,16 +738,16 @@ read_pdf_info(char *image_name, char *pa + #ifdef POPPLER_VERSION + pdf_major_version_found = pdf_doc->doc->getPDFMajorVersion(); + pdf_minor_version_found = pdf_doc->doc->getPDFMinorVersion(); +- if ((pdf_major_version_found > 1) ++ if ((pdf_major_version_found > /* major_pdf_version_wanted */ 1) + || (pdf_minor_version_found > minor_pdf_version_wanted)) { + const char *msg = +- "PDF inclusion: found PDF version <%d.%d>, but at most version <1.%d> allowed"; ++ "PDF inclusion: found PDF version <%d.%d>, but at most version <%d.%d> allowed"; + if (pdf_inclusion_errorlevel > 0) { +- pdftex_fail(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted); ++ pdftex_fail(msg, pdf_major_version_found, pdf_minor_version_found, /* major_pdf_version_wanted, */ minor_pdf_version_wanted); + } else if (pdf_inclusion_errorlevel < 0) { + ; /* do nothing */ + } else { /* = 0, give warning */ +- pdftex_warn(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted); ++ pdftex_warn(msg, pdf_major_version_found, pdf_minor_version_found, /* major_pdf_version_wanted, */ minor_pdf_version_wanted); + } + } + #else +@@ -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(); @@ -100,12 +68,11 @@ Fix building. if (page_num == 0) pdftex_fail("PDF inclusion: destination is not a page <%s>", page_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; +@@ -1107,7 +1107,5 @@ void epdf_check_mem() + n = p->next; + delete_document(p); + } +- // see above for globalParams +- delete globalParams; + } + } diff --git a/print/web2c/patches/patch-pdftexdir_pdftosrc-newpoppler.cc b/print/web2c/patches/patch-pdftexdir_pdftosrc-newpoppler.cc index d2665fd773b..308a20ac51a 100644 --- a/print/web2c/patches/patch-pdftexdir_pdftosrc-newpoppler.cc +++ b/print/web2c/patches/patch-pdftexdir_pdftosrc-newpoppler.cc @@ -1,19 +1,40 @@ -$NetBSD: patch-pdftexdir_pdftosrc-newpoppler.cc,v 1.6 2019/05/14 13:23:10 adam Exp $ +$NetBSD: patch-pdftexdir_pdftosrc-newpoppler.cc,v 1.7 2020/01/11 00:31:05 ryoon Exp $ Fix building. --- pdftexdir/pdftosrc-newpoppler.cc.orig 2018-12-06 23:31:33.000000000 +0000 +++ pdftexdir/pdftosrc-newpoppler.cc -@@ -69,7 +69,7 @@ int main(int argc, char *argv[]) - Stream *s; - Object srcStream, srcName, catalogDict; - FILE *outfile; -- char *outname; -+ const char *outname; - int objnum = 0, objgen = 0; - bool extract_xref_table = false; - int c; -@@ -110,7 +110,7 @@ int main(int argc, char *argv[]) +@@ -20,8 +20,7 @@ with this program. If not, see at + https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk +-by Arch Linux. The poppler should be 0.59.0 or newer versions. +-It is tested upto the poppler 0.70.1. ++by Arch Linux. The poppler should be 0.83.0 or newer versions. + POPPLER_VERSION should be defined. + */ + +@@ -80,7 +79,7 @@ int main(int argc, char *argv[]) + exit(1); + } + fileName = new GString(argv[1]); +- globalParams = new GlobalParams(); ++ globalParams = std::make_unique(); + doc = new PDFDoc(fileName); + if (!doc->isOk()) { + fprintf(stderr, "Invalid PDF file\n"); +@@ -100,8 +99,8 @@ int main(int argc, char *argv[]) + srcStream = Object(objNull); + if (objnum == 0) { + srcStream = catalogDict.dictLookup("SourceObject"); +- static char const_SourceFile[] = "SourceFile"; +- if (!srcStream.isStream(const_SourceFile)) { ++ static const char *const_SourceFile = "SourceFile"; ++ if (!srcStream.isDict(const_SourceFile)) { + fprintf(stderr, "No SourceObject found\n"); + exit(1); + } +@@ -110,7 +109,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "No SourceName found\n"); exit(1); } @@ -22,7 +43,7 @@ Fix building. // We cannot free srcName, as objname shares its string. // srcName.free(); } else if (objnum > 0) { -@@ -119,7 +119,7 @@ int main(int argc, char *argv[]) +@@ -119,7 +118,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Not a Stream object\n"); exit(1); } @@ -31,7 +52,7 @@ Fix building. if ((p = strrchr(buf, '.')) == 0) p = strchr(buf, 0); if (objgen == 0) -@@ -129,7 +129,7 @@ int main(int argc, char *argv[]) +@@ -129,7 +128,7 @@ int main(int argc, char *argv[]) outname = buf; } else { // objnum < 0 means we are extracting the XRef table extract_xref_table = true; @@ -40,12 +61,7 @@ Fix building. if ((p = strrchr(buf, '.')) == 0) p = strchr(buf, 0); sprintf(p, ".xref"); -@@ -157,12 +157,11 @@ int main(int argc, char *argv[]) - (e->type == xrefEntryFree ? "f" : "n")); - else { // e->offset is the object number of the object stream - Stream *str; -- Lexer *lexer; - Parser *parser; +@@ -162,7 +161,7 @@ int main(int argc, char *argv[]) Object objStr, obj1, obj2; int nObjects, first, n; int localOffset = 0; @@ -66,3 +82,9 @@ Fix building. for (n = 0; n < nObjects; ++n) { obj1 = parser->getObj(); obj2 = parser->getObj(); +@@ -204,5 +202,4 @@ int main(int argc, char *argv[]) + fprintf(stderr, "Cross-reference table extracted to %s\n", outname); + fclose(outfile); + delete doc; +- delete globalParams; + } diff --git a/print/web2c/patches/patch-pdftexdir_utils.c b/print/web2c/patches/patch-pdftexdir_utils.c new file mode 100644 index 00000000000..01962691023 --- /dev/null +++ b/print/web2c/patches/patch-pdftexdir_utils.c @@ -0,0 +1,14 @@ +$NetBSD: patch-pdftexdir_utils.c,v 1.1 2020/01/11 00:31:05 ryoon Exp $ + +* Fix a cstdio is not found error. + +--- pdftexdir/utils.c.orig 2017-11-14 23:50:55.000000000 +0000 ++++ pdftexdir/utils.c +@@ -33,7 +33,6 @@ with this program. If not, see + #ifdef POPPLER_VERSION +-#include + #define xpdfVersion POPPLER_VERSION + #define xpdfString "poppler" + #else -- cgit v1.2.3