public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
From: Bernd Kuhls <bernd@kuhls.net>
To: buildroot@buildroot.org
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>,
	Olivier Schonken <olivier.schonken@gmail.com>
Subject: [Buildroot] [PATCH 2/2] package/cups-filters: fix build against qpdf 12
Date: Sun,  1 Mar 2026 16:30:14 +0100	[thread overview]
Message-ID: <20260301153015.1981106-2-bernd@kuhls.net> (raw)
In-Reply-To: <20260301153015.1981106-1-bernd@kuhls.net>

This patch adds fixes for cups-filters so it can be build with newer
versions of qpdf that made changes to PointerHolder:
https://github.com/qpdf/qpdf/blob/v12.3.2/manual/design.rst#smart-pointers

Build-tested using this defconfig:

BR2_PACKAGE_CUPS=y
BR2_PACKAGE_CUPS_FILTERS=y

                             arm-aarch64 [ 1/32]: OK
                   bootlin-aarch64-glibc [ 2/32]: OK
               bootlin-aarch64-glibc-old [ 3/32]: SKIPPED
               bootlin-arcle-hs38-uclibc [ 4/32]: OK
                    bootlin-armv5-uclibc [ 5/32]: OK
                     bootlin-armv7-glibc [ 6/32]: OK
                   bootlin-armv7m-uclibc [ 7/32]: SKIPPED
                      bootlin-armv7-musl [ 8/32]: OK
                bootlin-m68k-5208-uclibc [ 9/32]: SKIPPED
               bootlin-m68k-68040-uclibc [10/32]: OK
             bootlin-microblazeel-uclibc [11/32]: OK
                  bootlin-mips64el-glibc [12/32]: OK
                bootlin-mipsel32r6-glibc [13/32]: OK
                   bootlin-mipsel-uclibc [14/32]: OK
                 bootlin-openrisc-uclibc [15/32]: OK
        bootlin-powerpc64le-power8-glibc [16/32]: OK
           bootlin-powerpc-e500mc-uclibc [17/32]: OK
                   bootlin-riscv32-glibc [18/32]: OK
                   bootlin-riscv64-glibc [19/32]: OK
                    bootlin-riscv64-musl [20/32]: OK
                 bootlin-s390x-z13-glibc [21/32]: OK
                      bootlin-sh4-uclibc [22/32]: OK
                   bootlin-sparc64-glibc [23/32]: OK
                    bootlin-sparc-uclibc [24/32]: OK
                    bootlin-x86-64-glibc [25/32]: OK
                     bootlin-x86-64-musl [26/32]: OK
                   bootlin-x86-64-uclibc [27/32]: OK
                   bootlin-x86-i686-musl [28/32]: OK
                   bootlin-xtensa-uclibc [29/32]: OK
                            br-arm-basic [30/32]: SKIPPED
                    br-arm-full-nothread [31/32]: SKIPPED
                      br-arm-full-static [32/32]: SKIPPED


32 builds, 6 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
This solution avoids[1] a version bump of this package while keeping
compatibility with the newest version of qpdf. The bump of qpdf is
needed to fix build errors with gcc 16-snapshot versions.

[1] https://lists.buildroot.org/pipermail/buildroot/2025-August/784931.html
Thomas: "which means duplicating all the crazy dependencies of
 libcupsfilters yes :/"

 package/cups-filters/0002-qpdf-12.patch | 117 ++++++++++++++++++++++++
 1 file changed, 117 insertions(+)
 create mode 100644 package/cups-filters/0002-qpdf-12.patch

diff --git a/package/cups-filters/0002-qpdf-12.patch b/package/cups-filters/0002-qpdf-12.patch
new file mode 100644
index 0000000000..336c353672
--- /dev/null
+++ b/package/cups-filters/0002-qpdf-12.patch
@@ -0,0 +1,117 @@
+From: Sébastien Noel <sebastien@twolife.be>
+Subject: fix build against qpdf 12
+
+Downloaded from Debian:
+https://sources.debian.org/src/cups-filters/1.28.17-7/debian/patches/0006-qpdf-12.patch
+
+Alpine Linux uses the same patch:
+https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/cups-filters/0006-qpdf-12.patch
+
+Upstream: not applicable, upstream moved to 2.0.x
+
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+
+--- a/filter/pdf.cxx
++++ b/filter/pdf.cxx
+@@ -21,6 +21,8 @@
+ #include <vector>
+ #include <string>
+ #include <cstring>
++#define POINTERHOLDER_TRANSITION 3
++#include <qpdf/PointerHolder.hh>
+ #include <qpdf/QPDF.hh>
+ #include <qpdf/QPDFObjectHandle.hh>
+ #include <qpdf/QPDFWriter.hh>
+--- a/filter/pdftopdf/qpdf_xobject.cc
++++ b/filter/pdftopdf/qpdf_xobject.cc
+@@ -1,5 +1,7 @@
+ #include "qpdf_xobject.h"
+ //#include <qpdf/Types.h>
++#define POINTERHOLDER_TRANSITION 3
++#include <qpdf/PointerHolder.hh>
+ #include <qpdf/QPDF.hh>
+ #include <qpdf/Pl_Discard.hh>
+ #include <qpdf/Pl_Count.hh>
+--- a/filter/rastertopdf.cpp
++++ b/filter/rastertopdf.cpp
+@@ -39,6 +39,8 @@
+ #include <arpa/inet.h>   // ntohl
+ 
+ #include <vector>
++#define POINTERHOLDER_TRANSITION 3
++#include <qpdf/PointerHolder.hh>
+ #include <qpdf/QPDF.hh>
+ #include <qpdf/QPDFWriter.hh>
+ #include <qpdf/QUtil.hh>
+@@ -481,7 +483,7 @@ QPDFObjectHandle embedIccProfile(QPDF &p
+     cmsSaveProfileToMem(colorProfile, buff, &profile_size);
+ 
+     // Write ICC profile buffer into PDF
+-    ph = new Buffer(buff, profile_size);  
++    ph = (PointerHolder<Buffer>) new Buffer(buff, profile_size);  
+     iccstream = QPDFObjectHandle::newStream(&pdf, ph);
+     iccstream.replaceDict(QPDFObjectHandle::newDictionary(streamdict));
+ 
+--- a/filter/pdftopdf/qpdf_pdftopdf_processor.cc
++++ b/filter/pdftopdf/qpdf_pdftopdf_processor.cc
+@@ -83,10 +83,10 @@
+     page.getKey("/Resources").replaceKey("/XObject",QPDFObjectHandle::newDictionary(xobjs));
+     content.append("Q\n");
+     page.getKey("/Contents").replaceStreamData(content,QPDFObjectHandle::newNull(),QPDFObjectHandle::newNull());
+-    page.replaceOrRemoveKey("/Rotate",makeRotate(rotation));
++    page.replaceKey("/Rotate",makeRotate(rotation));
+   } else {
+     Rotation rot=getRotate(page)+rotation;
+-    page.replaceOrRemoveKey("/Rotate",makeRotate(rot));
++    page.replaceKey("/Rotate",makeRotate(rot));
+   }
+   page=QPDFObjectHandle(); // i.e. uninitialized
+   return ret;
+@@ -181,9 +181,9 @@
+   page.assertInitialized();
+   Rotation save_rotate = getRotate(page);
+   if(orientation==ROT_0||orientation==ROT_180)
+-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_90));
++    page.replaceKey("/Rotate",makeRotate(ROT_90));
+   else
+-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_0));
++    page.replaceKey("/Rotate",makeRotate(ROT_0));
+ 
+   PageRect currpage= getBoxAsRect(getTrimBox(page));
+   double width = currpage.right-currpage.left;
+@@ -242,7 +242,7 @@
+   //Cropping.
+   // TODO: Borders are covered by the image. buffer space?
+   page.replaceKey("/TrimBox",makeBox(currpage.left,currpage.bottom,currpage.right,currpage.top));
+-  page.replaceOrRemoveKey("/Rotate",makeRotate(save_rotate));
++  page.replaceKey("/Rotate",makeRotate(save_rotate));
+   return getRotate(page);
+ }
+ 
+@@ -251,14 +251,14 @@
+   page.assertInitialized();
+   Rotation save_rotate = getRotate(page);
+   if(orientation==ROT_0||orientation==ROT_180)
+-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_90));
++    page.replaceKey("/Rotate",makeRotate(ROT_90));
+   else
+-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_0));
++    page.replaceKey("/Rotate",makeRotate(ROT_0));
+ 
+   PageRect currpage= getBoxAsRect(getTrimBox(page));
+   double width = currpage.right-currpage.left;
+   double height = currpage.top-currpage.bottom;
+-  page.replaceOrRemoveKey("/Rotate",makeRotate(save_rotate));
++  page.replaceKey("/Rotate",makeRotate(save_rotate));
+   if(width>height)
+     return true;
+   return false;
+@@ -662,7 +662,7 @@
+       // TODO? other rotation direction, e.g. if (src_rot==ROT_0)&&(param.orientation==ROT_270) ... etc.
+       // rotation=ROT_270;
+ 
+-      page.replaceOrRemoveKey("/Rotate",makeRotate(src_rot+rotation));
++      page.replaceKey("/Rotate",makeRotate(src_rot+rotation));
+     }
+   }
+ }
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2026-03-01 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-01 15:30 [Buildroot] [PATCH/next v4 1/2] package/qpdf: bump to version 12.3.2 Bernd Kuhls
2026-03-01 15:30 ` Bernd Kuhls [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260301153015.1981106-2-bernd@kuhls.net \
    --to=bernd@kuhls.net \
    --cc=angelo.compagnucci@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=olivier.schonken@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox