commit:     2c14cff1f654a12596cf8aa8e0b6ea80db87ebee
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  8 19:04:21 2026 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Jan  8 19:08:29 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c14cff1

sci-libs/gdal: Fix build w/ poppler-26.01

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../gdal/files/gdal-3.12.1-poppler-26.01.patch     | 113 +++++++++++++++++++++
 sci-libs/gdal/gdal-3.12.1.ebuild                   |   6 +-
 2 files changed, 118 insertions(+), 1 deletion(-)

diff --git a/sci-libs/gdal/files/gdal-3.12.1-poppler-26.01.patch 
b/sci-libs/gdal/files/gdal-3.12.1-poppler-26.01.patch
new file mode 100644
index 000000000000..76639fad0e20
--- /dev/null
+++ b/sci-libs/gdal/files/gdal-3.12.1-poppler-26.01.patch
@@ -0,0 +1,113 @@
+Source: https://github.com/OSGeo/gdal/pull/13664
+
+From 28a15cb76d26a27be96ab8b8bc8fcb52c153c3a9 Mon Sep 17 00:00:00 2001
+From: Daeho Ro <[email protected]>
+Date: Thu, 8 Jan 2026 22:17:30 +0900
+Subject: [PATCH] Backport for poppler 26
+
+---
+ frmts/pdf/pdfio.cpp     | 13 +++++++++----
+ frmts/pdf/pdfio.h       | 15 +++++++++------
+ frmts/pdf/pdfobject.cpp | 12 ++++++++----
+ 3 files changed, 26 insertions(+), 14 deletions(-)
+
+diff --git a/frmts/pdf/pdfio.cpp b/frmts/pdf/pdfio.cpp
+index 39cb1285ef40..32c3263e9219 100644
+--- a/frmts/pdf/pdfio.cpp
++++ b/frmts/pdf/pdfio.cpp
+@@ -250,8 +250,9 @@ int VSIPDFFileStream::lookChar()
+ /*                                reset()                               */
+ /************************************************************************/
+ 
+-#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
+-    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++#if POPPLER_MAJOR_VERSION > 25
++bool VSIPDFFileStream::rewind()
++#elif POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2
+ bool VSIPDFFileStream::reset()
+ #else
+ void VSIPDFFileStream::reset()
+@@ -272,8 +273,12 @@ void VSIPDFFileStream::reset()
+ /*                         unfilteredReset()                            */
+ /************************************************************************/
+ 
+-#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
+-    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
++#if POPPLER_MAJOR_VERSION > 25
++bool VSIPDFFileStream::unfilteredRewind()
++{
++    return rewind();
++}
++#elif POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3
+ bool VSIPDFFileStream::unfilteredReset()
+ {
+     return reset();
+diff --git a/frmts/pdf/pdfio.h b/frmts/pdf/pdfio.h
+index 5fbe3a9dc2ae..1fe289211769 100644
+--- a/frmts/pdf/pdfio.h
++++ b/frmts/pdf/pdfio.h
+@@ -55,8 +55,9 @@ class VSIPDFFileStream final : public BaseStream
+     int getUnfilteredChar() override;
+     int lookChar() override;
+ 
+-#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
+-    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++#if POPPLER_MAJOR_VERSION > 25
++    bool rewind() override;
++#elif POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2
+     bool reset() override;
+ #else
+     void reset() override;
+@@ -64,16 +65,18 @@ class VSIPDFFileStream final : public BaseStream
+ 
+     static void resetNoCheckReturnValue(Stream *str)
+     {
+-#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
+-    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++#if POPPLER_MAJOR_VERSION > 25
++        CPL_IGNORE_RET_VAL(str->rewind());
++#elif POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2
+         CPL_IGNORE_RET_VAL(str->reset());
+ #else
+         str->reset();
+ #endif
+     }
+ 
+-#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
+-    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
++#if POPPLER_MAJOR_VERSION > 25
++    bool unfilteredRewind() override;
++#elif POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2
+     bool unfilteredReset() override;
+ #else
+     void unfilteredReset() override;
+diff --git a/frmts/pdf/pdfobject.cpp b/frmts/pdf/pdfobject.cpp
+index bcd48c016cd8..3fa9f8ca232e 100644
+--- a/frmts/pdf/pdfobject.cpp
++++ b/frmts/pdf/pdfobject.cpp
+@@ -1409,8 +1409,10 @@ int64_t GDALPDFStreamPoppler::GetLength(int64_t 
nMaxSize)
+     if (m_nLength >= 0)
+         return m_nLength;
+ 
+-#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
+-    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++#if POPPLER_MAJOR_VERSION > 25
++    if (!m_poStream->rewind())
++        return 0;
++#elif POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2
+     if (!m_poStream->reset())
+         return 0;
+ #else
+@@ -1488,8 +1490,10 @@ int64_t GDALPDFStreamPoppler::GetRawLength()
+         return m_nRawLength;
+ 
+     auto undecodeStream = m_poStream->getUndecodedStream();
+-#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
+-    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++#if POPPLER_MAJOR_VERSION > 25
++    if (!undecodeStream->rewind())
++        return 0;
++#elif POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2
+     if (!undecodeStream->reset())
+         return 0;
+ #else

diff --git a/sci-libs/gdal/gdal-3.12.1.ebuild b/sci-libs/gdal/gdal-3.12.1.ebuild
index 80b0dadb4f6e..9ee637a75523 100644
--- a/sci-libs/gdal/gdal-3.12.1.ebuild
+++ b/sci-libs/gdal/gdal-3.12.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -142,6 +142,10 @@ EPYTEST_RERUNS=5
 EPYTEST_XDIST=1
 # distutils_enable_tests unconditionally touches BDEPEND
 
+PATCHES=(
+       "${FILESDIR}"/${P}-poppler-26.01.patch # pending upstream
+)
+
 pkg_setup() {
        use java && java-pkg-opt-2_pkg_setup
 }

Reply via email to