Hi Ingo,

(cc'ing back to ports)

On Sun, Oct 22, 2017 at 12:38:09AM +0200, Ingo Schwarze wrote:
> > As libpaper seems fairly useless to me, i guess you might want to take
> > the second approach, disable it explicitly.
> > 
> > I'm now investigating how to do that...
> 
> Applying the patch appended at the end on top of your patch lets
> xpdf build, package, install (with pkg_add -r), and run for me.

Thanks! I've added it to my version.

> It does spew crap to stderr that i didn't notice with previous
> versions, but i may have missed it.  Probably such splatter is
> to be expected with "modern" software (sigh).
> 
>   QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to 
> '/tmp/runtime-schwarze'

I'll have to ask the Qt gurus about this. Other Qt5 applications produce
the same warning (stellarium from astro/stellarium, for example).

>   libGL error: failed to open drm device: Permission denied
>   libGL error: failed to load driver: i965

Hmm. This happens if you don't own /dev/drm0. I bet you get the
same error messages when running glxgears(1).  I'm using xenodm,
which should take care of it (/etc/xenodm/GiveConsole):

if [ -c /dev/drm0 ]; then
    chown $USER /dev/drm0
fi

For not-so-normal setups, or when using startx(1), I'm not sure how
to fix it in a generic way. However, I'd expect that you get the
same error from other X11 programs using drm, too.

> Looking at the build log, this looks somewhat strange:
> 
>   ===>   Applying OpenBSD patch patch-xpdf_GlobalParams_cc
>   Hmm...  Looks like a unified diff to me...
>   The text leading up to this was:
>   --------------------------
>   |$OpenBSD: patch-xpdf_GlobalParams_cc,v 1.4 2015/04/06 21:05:07 ajacoutot 
> Exp $
>   |--- xpdf/GlobalParams.cc.orig  Wed May 28 20:50:50 2014
>   |+++ xpdf/GlobalParams.cc       Fri May 30 14:27:13 2014
>   --------------------------
>   Patching file xpdf/GlobalParams.cc using Plan A...
>   Hunk #1 succeeded at 103 (offset -17 lines).
>   done
> 
> Does the "offset -17 lines" mean that the patch should be regenerated?
> Same for patch-xpdf_XRef_cc.

I didn't include regenerated patches in my diff. The new diff contains
regenerated patches.

> Why do you list png explicitly in LIB_DEPENDS, but not jpeg?
> Given that the only other direct lib dependency, qtbase, requires
> both jpeg and png directly and that the xpdf cmake run explicitly
> tests for both, what is the difference?

Sloppiness on my side. png could have been removed in the past, too
because even x11/motif pulled it in. Now removed in the new diff.

> I see this in my output:
> 
>   -- Found TIFF: /usr/local/lib/libtiff.so.40.1 (found version "4.0.8") 
> 
> but:
> 
>   $ pkg_info -S xpdf
>   Information for inst:xpdf-4.00
>   Signature: 
> xpdf-4.00,0,@ghostscript-fonts-8.11p3,@png-1.6.31,@qtbase-5.9.1p4,Qt5Core.2.1,Qt5Gui.2.1,Qt5Widgets.2.1,c++.1.0,c++abi.0.0,c.90.0,freetype.28.1,m.10.0,png.17.4,pthread.24.0,z.5.0
> 
> No tiff in there.  Any idea what is going on?

It looks like it checks for libtiff but then doesn't use it anywhere.

Here's a new diff:

Index: Makefile
===================================================================
RCS file: /cvs/ports/textproc/xpdf/Makefile,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile
--- Makefile    26 Jul 2017 22:45:31 -0000      1.89
+++ Makefile    22 Oct 2017 16:05:37 -0000
@@ -2,33 +2,33 @@
 
 COMMENT=       PDF viewer for X11
 
-DISTNAME=      xpdf-3.04
+DISTNAME=      xpdf-4.00
 CATEGORIES=    textproc x11
-REVISION=      2
 
-MASTER_SITES=  ftp://ftp.foolabs.com/pub/xpdf/ \
-               http://mirror.ctan.org/support/xpdf/
+MASTER_SITES=  https://www.xpdfreader.com/dl/
 
-HOMEPAGE=      http://www.foolabs.com/xpdf/
+HOMEPAGE=      https://www.xpdfreader.com/
 
 # GPLv2 only or GPLv3 only or both (at our choice)
 PERMIT_PACKAGE_CDROM=  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'
+MODULES=       devel/cmake \
+               X11/qt5
+
+LIB_DEPENDS+=  graphics/png
 
 RUN_DEPENDS=   print/ghostscript/gnu-fonts
 
-WANTLIB=       ICE SM X11 Xext Xpm Xt freetype Xm \
-               c m png pthread ${COMPILER_LIBCXX} z
+USE_GMAKE=     Yes
+
+# Don't pick up libpaper -- the build currently fails to link against
+# it.
+CONFIGURE_ARGS+=       -DHAVE_PAPER_H=0
+
+CXXFLAGS+=     -DLOCALBASE=\\\"${LOCALBASE}\\\"
+
+WANTLIB=       Qt5Core Qt5Gui Qt5Widgets freetype c m png pthread \
+               ${COMPILER_LIBCXX} z
 
 NO_TEST=       Yes
 
@@ -37,13 +37,9 @@ post-install:
        ${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 pdftohtml pdftoppm pdftops pdftotext
        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.18
diff -u -p -r1.18 distinfo
--- distinfo    8 Jun 2014 18:56:33 -0000       1.18
+++ distinfo    22 Oct 2017 16:05:37 -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.00.tar.gz) = /z2SxCFm41sbpq7JtfCt/7X8BaPrldxJUFtuNE5CFtY=
+SIZE (xpdf-4.00.tar.gz) = 854175
Index: patches/patch-Makefile_in
===================================================================
RCS file: patches/patch-Makefile_in
diff -N patches/patch-Makefile_in
--- patches/patch-Makefile_in   1 Oct 2011 19:46:35 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-Makefile_in,v 1.2 2011/10/01 19:46:35 kili Exp $
---- 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-splash_Makefile_in
===================================================================
RCS file: patches/patch-splash_Makefile_in
diff -N patches/patch-splash_Makefile_in
--- patches/patch-splash_Makefile_in    8 Jun 2014 18:56:33 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-splash_Makefile_in,v 1.2 2014/06/08 18:56:33 kili Exp $
---- 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 8 Jun 2014 18:56:33 -0000       1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-$OpenBSD: patch-splash_SplashXPath_cc,v 1.4 2014/06/08 18:56:33 kili Exp $
-
-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  8 Jun 2014 18:56:33 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-$OpenBSD: patch-splash_SplashXPath_h,v 1.1 2014/06/08 18:56:33 kili Exp $
-
-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_GlobalParams_cc
===================================================================
RCS file: /cvs/ports/textproc/xpdf/patches/patch-xpdf_GlobalParams_cc,v
retrieving revision 1.4
diff -u -p -r1.4 patch-xpdf_GlobalParams_cc
--- patches/patch-xpdf_GlobalParams_cc  6 Apr 2015 21:05:07 -0000       1.4
+++ patches/patch-xpdf_GlobalParams_cc  22 Oct 2017 16:05:37 -0000
@@ -1,7 +1,8 @@
 $OpenBSD: patch-xpdf_GlobalParams_cc,v 1.4 2015/04/06 21:05:07 ajacoutot Exp $
---- 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
+@@ -103,14 +103,7 @@ static const char *displayFontDirs[] = {
  };
  #else
  static const char *displayFontDirs[] = {
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      8 Jun 2014 18:56:33 -0000       1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-$OpenBSD: patch-xpdf_Makefile_in,v 1.6 2014/06/08 18:56:33 kili Exp $
---- 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_XRef_cc
===================================================================
RCS file: /cvs/ports/textproc/xpdf/patches/patch-xpdf_XRef_cc,v
retrieving revision 1.7
diff -u -p -r1.7 patch-xpdf_XRef_cc
--- patches/patch-xpdf_XRef_cc  8 Jun 2014 18:56:33 -0000       1.7
+++ patches/patch-xpdf_XRef_cc  22 Oct 2017 16:05:37 -0000
@@ -1,7 +1,8 @@
 $OpenBSD: patch-xpdf_XRef_cc,v 1.7 2014/06/08 18:56:33 kili Exp $
---- 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
+@@ -1003,19 +1003,19 @@ GBool XRef::getEncryption(int *permFlagsA, GBool *owne
  }
  
  GBool XRef::okToPrint(GBool ignoreOwnerPW) {

Reply via email to