git: c9675e79436d - main - print/foomatic-filters: Patch Ghostscript call to count PDF pages

From: Joseph Mingrone <jrm_at_FreeBSD.org>
Date: Sat, 02 Mar 2024 21:57:01 UTC
The branch main has been updated by jrm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c9675e79436d9e67e3f1e7795bed009020ded456

commit c9675e79436d9e67e3f1e7795bed009020ded456
Author:     Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2024-03-02 16:00:16 +0000
Commit:     Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2024-03-02 21:55:30 +0000

    print/foomatic-filters: Patch Ghostscript call to count PDF pages
    
    Before this patch, the Ghostscript call for counting PDF pages used the
    obsolete "pdfdict".  Patch to use "runpdfbegin" instead.
    
    For more information, see Arch Linux bug 62251.
    https://bugs.archlinux.org/task/62251
    
    Reported by:    Thomas Vaughan <thomas@vaughan.net>
    Sponsored by:   The FreeBSD Foundation
---
 print/foomatic-filters/Makefile          |  2 +-
 print/foomatic-filters/files/patch-pdf.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/print/foomatic-filters/Makefile b/print/foomatic-filters/Makefile
index e69d5fa58e72..07fbf57f7db5 100644
--- a/print/foomatic-filters/Makefile
+++ b/print/foomatic-filters/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	foomatic-filters
 PORTVERSION=	4.0.17
-PORTREVISION=	11
+PORTREVISION=	12
 CATEGORIES=	print
 MASTER_SITES=	http://www.openprinting.org/download/foomatic/
 
diff --git a/print/foomatic-filters/files/patch-pdf.c b/print/foomatic-filters/files/patch-pdf.c
new file mode 100644
index 000000000000..2abffc572915
--- /dev/null
+++ b/print/foomatic-filters/files/patch-pdf.c
@@ -0,0 +1,14 @@
+--- pdf.c.orig	2012-07-02 14:50:46 UTC
++++ pdf.c
+@@ -46,9 +46,8 @@ static int pdf_count_pages(const char *filename)
+     int pagecount;
+ 
+     snprintf(gscommand, 4095, "%s -dNODISPLAY -q -c "
+-	     "'/pdffile (%s) (r) file def pdfdict begin pdffile pdfopen begin "
+-	     "(PageCount: ) print pdfpagecount == flush currentdict pdfclose "
+-	     "end end quit'",
++	     "'/pdffile (%s) (r) file runpdfbegin (PageCount: ) print "
++	     "pdfpagecount = quit'",
+ 	     gspath, filename);
+ 
+     FILE *pd = popen(gscommand, "r");