Update diff xpdf-4.04. - Upstream switched to camke - Prefer Qt5 instead of Qt6 (default). The printer code not compile with Qt6.4.
Tested on amd64. OK? Rafael Index: Makefile =================================================================== RCS file: /cvs/ports/textproc/xpdf/Makefile,v retrieving revision 1.96 diff -u -p -u -p -r1.96 Makefile --- Makefile 24 Aug 2022 08:00:05 -0000 1.96 +++ Makefile 5 Feb 2023 19:32:50 -0000 @@ -1,49 +1,47 @@ COMMENT= PDF viewer for X11 -DISTNAME= xpdf-3.04 +DISTNAME= xpdf-4.04 CATEGORIES= textproc x11 EPOCH= 0 -REVISION= 2 - -MASTER_SITES= https://xpdfreader-dl.s3.amazonaws.com/old/ HOMEPAGE= https://www.xpdfreader.com/ +MASTER_SITES= https://dl.xpdfreader.com/ + # GPLv2 only or GPLv3 only or both (at our choice) PERMIT_PACKAGE= Yes -LIB_DEPENDS+= graphics/png x11/motif -USE_GMAKE= Yes -CONFIGURE_STYLE=gnu -CONFIGURE_ARGS= --enable-multithreaded \ - --without-Sgm-library \ - --without-libpaper-library - -CONFIGURE_ENV= CPPFLAGS='-I${X11BASE}/include/freetype2 -I${X11BASE}/include -I${LOCALBASE}/include -DLOCALBASE="\"${LOCALBASE}\""' \ - LDFLAGS="-L${X11BASE}/lib -L${LOCALBASE}/lib -lm -lz" -MAKE_ENV+=MOTIFLIB='-L${LOCALBASE}/lib -lXm' +WANTLIB += ${COMPILER_LIBCXX} Qt5Core Qt5Gui Qt5Network Qt5PrintSupport +WANTLIB += Qt5Widgets c cups fontconfig freetype m paper png + +MODULES= devel/cmake \ + x11/qt5 + +LIB_DEPENDS+= graphics/png \ + print/libpaper RUN_DEPENDS= print/ghostscript/gnu-fonts -WANTLIB= ICE SM X11 Xext Xpm Xt freetype Xm \ - c m png pthread ${COMPILER_LIBCXX} z +CXXFLAGS += -I${X11BASE}/include -I${LOCALBASE}/include +MODCMAKE_LDFLAGS = -L${X11BASE}/lib -L${LOCALBASE}/lib -COMPILER = base-clang ports-gcc base-gcc +CONFIGURE_ARGS= -DOPI_SUPPORT=ON \ + -DXPDFWIDGET_PRINTING=ON \ + -DSYSTEM_XPDFRC=/etc/xpdfrc NO_TEST= Yes +pre-configure: + ${SUBST_CMD} ${WRKDIST}/xpdf/GlobalParams.cc + post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/xpdf ${INSTALL_DATA} ${WRKSRC}/doc/sample-xpdfrc \ ${PREFIX}/share/examples/xpdf/xpdfrc # already in poppler-utils -.for i in pdffonts pdfimages pdfinfo pdftoppm pdftops pdftotext +.for i in pdffonts pdfimages pdfinfo pdftoppm pdftops pdftotext pdftohtml rm ${PREFIX}/man/man1/$i.1 rm ${PREFIX}/bin/$i .endfor -# forgotten in Makefile.in (there's also a pdfthtml, but it conflicts -# with poppler-utils): - ${INSTALL_PROGRAM} ${WRKBUILD}/xpdf/pdftopng ${PREFIX}/bin - ${INSTALL_MAN} ${WRKSRC}/doc/pdftopng.1 ${PREFIX}/man/man1 .include <bsd.port.mk> Index: distinfo =================================================================== RCS file: /cvs/ports/textproc/xpdf/distinfo,v retrieving revision 1.20 diff -u -p -u -p -r1.20 distinfo --- distinfo 8 Nov 2017 18:30:24 -0000 1.20 +++ distinfo 5 Feb 2023 19:32:50 -0000 @@ -1,2 +1,2 @@ -SHA256 (xpdf-3.04.tar.gz) = ETkMdHM6vLJiqspNtocQ8T///UK/4qCGGl38kSspd+U= -SIZE (xpdf-3.04.tar.gz) = 825519 +SHA256 (xpdf-4.04.tar.gz) = Y84j/L92BI9STEC+R5rDhA16LLrbbR4GRup3kmZWut4= +SIZE (xpdf-4.04.tar.gz) = 969535 Index: patches/patch-Makefile_in =================================================================== RCS file: patches/patch-Makefile_in diff -N patches/patch-Makefile_in --- patches/patch-Makefile_in 11 Mar 2022 20:03:36 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,18 +0,0 @@ ---- Makefile.in.orig Mon Aug 15 23:08:52 2011 -+++ Makefile.in Thu Aug 18 21:10:22 2011 -@@ -102,13 +102,8 @@ install: dummy - $(INSTALL_DATA) $(srcdir)/doc/pdfimages.1 $(DESTDIR)@mandir@/man1/pdfimages.1 - -mkdir -p $(DESTDIR)@mandir@/man5 - $(INSTALL_DATA) $(srcdir)/doc/xpdfrc.5 $(DESTDIR)@mandir@/man5/xpdfrc.5 -- -mkdir -p $(DESTDIR)@sysconfdir@ -- @if test ! -f $(DESTDIR)@sysconfdir@/xpdfrc; then \ -- echo "$(INSTALL_DATA) $(srcdir)/doc/sample-xpdfrc $(DESTDIR)@sysconfdir@/xpdfrc"; \ -- $(INSTALL_DATA) $(srcdir)/doc/sample-xpdfrc $(DESTDIR)@sysconfdir@/xpdfrc; \ -- else \ -- echo "# not overwriting the existing $(DESTDIR)@sysconfdir@/xpdfrc"; \ -- fi -+ -mkdir -p $(PREFIX)/share/examples/xpdf -+ $(INSTALL_DATA) $(srcdir)/doc/sample-xpdfrc $(PREFIX)/share/examples/xpdf/xpdfrc - - clean: - -cd goo; $(MAKE) clean Index: patches/patch-cmake-config_txt =================================================================== RCS file: patches/patch-cmake-config_txt diff -N patches/patch-cmake-config_txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-cmake-config_txt 5 Feb 2023 19:32:50 -0000 @@ -0,0 +1,18 @@ +Index: cmake-config.txt +--- cmake-config.txt.orig ++++ cmake-config.txt +@@ -205,12 +205,12 @@ find_package(PNG) + + + #--- look for Qt +-find_package(Qt6Widgets QUIET) ++#find_package(Qt6Widgets QUIET) + if (Qt6Widgets_FOUND) + find_package(Qt6Network) + find_package(Qt6PrintSupport) + else () +- find_package(Qt5Widgets QUIET) ++ find_package(Qt5 COMPONENTS Widgets Network PrintSupport REQUIRED) + if (Qt5Widgets_FOUND) + find_package(Qt5Network) + find_package(Qt5PrintSupport) Index: patches/patch-doc_sample-xpdfrc =================================================================== RCS file: /cvs/ports/textproc/xpdf/patches/patch-doc_sample-xpdfrc,v retrieving revision 1.6 diff -u -p -u -p -r1.6 patch-doc_sample-xpdfrc --- patches/patch-doc_sample-xpdfrc 11 Mar 2022 20:03:36 -0000 1.6 +++ patches/patch-doc_sample-xpdfrc 5 Feb 2023 19:32:50 -0000 @@ -1,18 +1,9 @@ ---- doc/sample-xpdfrc.orig Wed May 28 20:50:50 2014 -+++ doc/sample-xpdfrc Fri May 30 14:26:13 2014 -@@ -56,7 +56,7 @@ - - # Set the default PostScript file or command. - --#psFile "|lpr -Pmyprinter" -+psFile "|lpr" - - # Set the default PostScript paper size -- this can be letter, legal, - # A4, or A3. You can also specify a paper size as width and height -@@ -87,5 +87,5 @@ +Index: doc/sample-xpdfrc +--- doc/sample-xpdfrc.orig ++++ doc/sample-xpdfrc +@@ -83,4 +83,4 @@ # Set the command used to run a web browser when a URL hyperlink is # clicked. -#launchCommand viewer-script -+#urlCommand "firefox -newtab -url 'openURL(%s)'" - #urlCommand "netscape -remote 'openURL(%s)'" ++#urlCommand>---"firefox -newtab -url 'openURL(%s)'" Index: patches/patch-splash_Makefile_in =================================================================== RCS file: patches/patch-splash_Makefile_in diff -N patches/patch-splash_Makefile_in --- patches/patch-splash_Makefile_in 11 Mar 2022 20:03:36 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,11 +0,0 @@ ---- splash/Makefile.in.orig Wed May 28 20:50:50 2014 -+++ splash/Makefile.in Fri May 30 14:29:41 2014 -@@ -16,7 +16,7 @@ GOOLIBDIR = ../goo - FOFISRCDIR = $(srcdir)/../fofi - FOFILIBDIR = ../fofi - --CXXFLAGS = @CXXFLAGS@ @DEFS@ -I.. -I$(srcdir)/.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I$(srcdir) @freetype2_CFLAGS@ -+CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ @DEFS@ -I.. -I$(srcdir)/.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I$(srcdir) @freetype2_CFLAGS@ - - CXX = @CXX@ - AR = @AR@ Index: patches/patch-splash_SplashXPath_cc =================================================================== RCS file: patches/patch-splash_SplashXPath_cc diff -N patches/patch-splash_SplashXPath_cc --- patches/patch-splash_SplashXPath_cc 11 Mar 2022 20:03:36 -0000 1.7 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,47 +0,0 @@ -Replace Miod's fix from 2009 by some assert's, because the bug -*should* have been fixed in a different way and I'm too lazy to -verify it. (needs a change to strokeAdjust(), which is private) - ---- splash/SplashXPath.cc.orig Wed May 28 20:50:50 2014 -+++ splash/SplashXPath.cc Fri May 30 15:31:49 2014 -@@ -8,6 +8,8 @@ - - #include <aconf.h> - -+#include <assert.h> -+ - #ifdef USE_GCC_PRAGMAS - #pragma implementation - #endif -@@ -69,7 +71,7 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord - - // do stroke adjustment - if (path->hints) { -- strokeAdjust(pts, path->hints, path->hintsLength); -+ strokeAdjust(pts, path->hints, path->hintsLength, path->length); - } - - segs = NULL; -@@ -176,7 +178,8 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord - } - - void SplashXPath::strokeAdjust(SplashXPathPoint *pts, -- SplashPathHint *hints, int nHints) { -+ SplashPathHint *hints, int nHints, -+ int plength) { - SplashXPathAdjust *adjusts, *adjust; - SplashPathHint *hint; - SplashCoord x0, y0, x1, y1, x2, y2, x3, y3; -@@ -188,9 +191,12 @@ void SplashXPath::strokeAdjust(SplashXPathPoint *pts, - adjusts = (SplashXPathAdjust *)gmallocn(nHints, sizeof(SplashXPathAdjust)); - for (i = 0; i < nHints; ++i) { - hint = &hints[i]; -+ assert(hint->firstPt < plength && hint->lastPt < plength); - x0 = pts[hint->ctrl0 ].x; y0 = pts[hint->ctrl0 ].y; -+ assert(hint->ctrl0 + 1 < plength); - x1 = pts[hint->ctrl0 + 1].x; y1 = pts[hint->ctrl0 + 1].y; - x2 = pts[hint->ctrl1 ].x; y2 = pts[hint->ctrl1 ].y; -+ assert(hint->ctrl1 + 1 < plength); - x3 = pts[hint->ctrl1 + 1].x; y3 = pts[hint->ctrl1 + 1].y; - if (x0 == x1 && x2 == x3) { - adjusts[i].vert = gTrue; Index: patches/patch-splash_SplashXPath_h =================================================================== RCS file: patches/patch-splash_SplashXPath_h diff -N patches/patch-splash_SplashXPath_h --- patches/patch-splash_SplashXPath_h 11 Mar 2022 20:03:36 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,16 +0,0 @@ -Replace Miod's fix from 2009 by some assert's, because the bug -*should* have been fixed in a different way and I'm too lazy to -verify it. (needs a change to strokeAdjust(), which is private) - ---- splash/SplashXPath.h.orig Wed May 28 20:50:50 2014 -+++ splash/SplashXPath.h Fri May 30 15:33:45 2014 -@@ -99,7 +99,8 @@ class SplashXPath { (private) - void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, - SplashCoord *xo, SplashCoord *yo); - void strokeAdjust(SplashXPathPoint *pts, -- SplashPathHint *hints, int nHints); -+ SplashPathHint *hints, int nHints, -+ int plength); - void grow(int nSegs); - void addCurve(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, Index: patches/patch-xpdf-qt_XpdfWidgetPrint_cc =================================================================== RCS file: patches/patch-xpdf-qt_XpdfWidgetPrint_cc diff -N patches/patch-xpdf-qt_XpdfWidgetPrint_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-xpdf-qt_XpdfWidgetPrint_cc 5 Feb 2023 19:32:50 -0000 @@ -0,0 +1,21 @@ +Index: xpdf-qt/XpdfWidgetPrint.cc +--- xpdf-qt/XpdfWidgetPrint.cc.orig ++++ xpdf-qt/XpdfWidgetPrint.cc +@@ -21,7 +21,7 @@ + #elif defined(__APPLE__) + # include <CoreFoundation/CoreFoundation.h> + # include <ApplicationServices/ApplicationServices.h> +-#elif defined(__linux__) ++#elif defined(__Linux__) || defined(__OpenBSD__) + # include "PSOutputDev.h" + # include <cups/cups.h> + #endif +@@ -315,7 +315,7 @@ XpdfWidget::ErrorCode printPDF(PDFDoc *doc, QPrinter * + // Linux + //------------------------------------------------------------------------ + +-#elif defined(__linux__) ++#elif defined(__Linux__) || defined(__OpenBSD__) + + static void fileOut(void *stream, const char *data, int len) { + fwrite(data, 1, len, (FILE *)stream); Index: patches/patch-xpdf_GlobalParams_cc =================================================================== RCS file: /cvs/ports/textproc/xpdf/patches/patch-xpdf_GlobalParams_cc,v retrieving revision 1.7 diff -u -p -u -p -r1.7 patch-xpdf_GlobalParams_cc --- patches/patch-xpdf_GlobalParams_cc 11 Mar 2022 20:03:36 -0000 1.7 +++ patches/patch-xpdf_GlobalParams_cc 5 Feb 2023 19:32:50 -0000 @@ -1,6 +1,7 @@ ---- xpdf/GlobalParams.cc.orig Wed May 28 20:50:50 2014 -+++ xpdf/GlobalParams.cc Fri May 30 14:27:13 2014 -@@ -120,14 +120,7 @@ static const char *displayFontDirs[] = { +Index: xpdf/GlobalParams.cc +--- xpdf/GlobalParams.cc.orig ++++ xpdf/GlobalParams.cc +@@ -109,14 +109,7 @@ static const char *displayFontDirs[] = { }; #else static const char *displayFontDirs[] = { @@ -12,7 +13,7 @@ -#if defined(__sun) && defined(__SVR4) - "/usr/sfw/share/ghostscript/fonts", -#endif -+ LOCALBASE "/share/fonts/ghostscript", ++ "${LOCALBASE}/share/fonts/ghostscript", NULL }; #endif Index: patches/patch-xpdf_JBIG2Stream_cc =================================================================== RCS file: patches/patch-xpdf_JBIG2Stream_cc diff -N patches/patch-xpdf_JBIG2Stream_cc --- patches/patch-xpdf_JBIG2Stream_cc 24 Aug 2022 08:00:05 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,22 +0,0 @@ -Security fix for CVE-2022-38171. -Extracted from upstream 4.04 - -Index: xpdf/JBIG2Stream.cc ---- xpdf/JBIG2Stream.cc.orig -+++ xpdf/JBIG2Stream.cc -@@ -1977,7 +1977,14 @@ void JBIG2Stream::readTextRegionSeg(Guint segNum, GBoo - for (i = 0; i < nRefSegs; ++i) { - if ((seg = findSegment(refSegs[i]))) { - if (seg->getType() == jbig2SegSymbolDict) { -- numSyms += ((JBIG2SymbolDict *)seg)->getSize(); -+ Guint segSize = ((JBIG2SymbolDict *)seg)->getSize(); -+ if (segSize > INT_MAX || numSyms > INT_MAX - segSize) { -+ error(errSyntaxError, getPos(), -+ "Too many symbols in JBIG2 text region"); -+ delete codeTables; -+ return; -+ } -+ numSyms += segSize; - } else if (seg->getType() == jbig2SegCodeTable) { - codeTables->append(seg); - } Index: patches/patch-xpdf_Makefile_in =================================================================== RCS file: patches/patch-xpdf_Makefile_in diff -N patches/patch-xpdf_Makefile_in --- patches/patch-xpdf_Makefile_in 11 Mar 2022 20:03:36 -0000 1.9 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,20 +0,0 @@ ---- xpdf/Makefile.in.orig Wed May 28 20:50:50 2014 -+++ xpdf/Makefile.in Fri May 30 14:28:24 2014 -@@ -19,7 +19,7 @@ FOFILIBDIR = ../fofi - SPLASHSRCDIR = $(srcdir)/../splash - SPLASHLIBDIR = ../splash - --CXXFLAGS = @CXXFLAGS@ @DEFS@ -I.. -I$(srcdir)/.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I$(SPLASHSRCDIR) -I$(srcdir) @freetype2_CFLAGS@ @Sgm_CFLAGS@ @Xm_CFLAGS@ @Xt_CFLAGS@ @Xp_CFLAGS@ @Xext_CFLAGS@ @Xpm_CFLAGS@ @libpng_CFLAGS@ @libpaper_CFLAGS@ @X_CFLAGS@ @EXTRA_CFLAGS@ -+CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ @DEFS@ -I.. -I$(srcdir)/.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I$(SPLASHSRCDIR) -I$(srcdir) @freetype2_CFLAGS@ @Sgm_CFLAGS@ @Xm_CFLAGS@ @Xt_CFLAGS@ @Xp_CFLAGS@ @Xext_CFLAGS@ @Xpm_CFLAGS@ @libpng_CFLAGS@ @libpaper_CFLAGS@ @X_CFLAGS@ @EXTRA_CFLAGS@ - - LDFLAGS = @LDFLAGS@ - -@@ -33,7 +33,7 @@ SPLASHLIBS = -L$(SPLASHLIBDIR) -lsplash - - OTHERLIBS = @LIBS@ @libpaper_LIBS@ @EXTRA_LIBS@ \ - -L$(FOFILIBDIR) -lfofi \ -- -L$(GOOLIBDIR) -lGoo -+ -L$(GOOLIBDIR) -lGoo -pthread - - CXX = @CXX@ - Index: patches/patch-xpdf_TextOutputDev_cc =================================================================== RCS file: patches/patch-xpdf_TextOutputDev_cc diff -N patches/patch-xpdf_TextOutputDev_cc --- patches/patch-xpdf_TextOutputDev_cc 11 Mar 2022 20:03:36 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,18 +0,0 @@ -CVE-2019-16927, CVE-2019-9877 from 4.02 - -Index: xpdf/TextOutputDev.cc ---- xpdf/TextOutputDev.cc.orig -+++ xpdf/TextOutputDev.cc -@@ -2472,6 +2472,12 @@ TextBlock *TextPage::split(GList *charsA, int rot) { - - //----- compute the horizontal and vertical profiles - -+ if (xMin / splitPrecision < 0.5 * INT_MIN || -+ xMax / splitPrecision > 0.5 * INT_MAX || -+ yMin / splitPrecision < 0.5 * INT_MIN || -+ xMax / splitPrecision > 0.5 * INT_MAX) { -+ return NULL; -+ } - // add some slack to the array bounds to avoid floating point - // precision problems - xMinI = (int)floor(xMin / splitPrecision) - 1; Index: patches/patch-xpdf_XRef_cc =================================================================== RCS file: /cvs/ports/textproc/xpdf/patches/patch-xpdf_XRef_cc,v retrieving revision 1.10 diff -u -p -u -p -r1.10 patch-xpdf_XRef_cc --- patches/patch-xpdf_XRef_cc 11 Mar 2022 20:03:36 -0000 1.10 +++ patches/patch-xpdf_XRef_cc 5 Feb 2023 19:32:50 -0000 @@ -1,6 +1,7 @@ ---- xpdf/XRef.cc.orig Wed May 28 20:50:50 2014 -+++ xpdf/XRef.cc Fri May 30 14:26:13 2014 -@@ -958,19 +958,19 @@ void XRef::setEncryption(int permFlagsA, GBool ownerPa +Index: xpdf/XRef.cc +--- xpdf/XRef.cc.orig ++++ xpdf/XRef.cc +@@ -1164,19 +1164,19 @@ GBool XRef::getEncryption(int *permFlagsA, GBool *owne } GBool XRef::okToPrint(GBool ignoreOwnerPW) {