commit:     539e2bd77947977caf5ff045bfe8dccbf0130c8d
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  9 15:03:05 2025 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Feb  9 15:11:53 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=539e2bd7

sci-libs/gdal: add 3.9.3 w/ fix for app-text/poppler-25.02.0

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

 sci-libs/gdal/Manifest                             |   2 +
 sci-libs/gdal/files/gdal-3.9.3-poppler-25.02.patch | 240 +++++++++++++++++
 .../files/gdal-3.9.3-poppler-autotest-25.02.patch  |  23 ++
 sci-libs/gdal/gdal-3.9.3.ebuild                    | 289 +++++++++++++++++++++
 4 files changed, 554 insertions(+)

diff --git a/sci-libs/gdal/Manifest b/sci-libs/gdal/Manifest
index 2f52817fe608..250e37a35f35 100644
--- a/sci-libs/gdal/Manifest
+++ b/sci-libs/gdal/Manifest
@@ -2,7 +2,9 @@ DIST gdal-3.8.0.tar.xz 8853728 BLAKE2B 
646aa91283e7228a054221d120bddb456c8b898f9
 DIST gdal-3.8.5.tar.xz 8871404 BLAKE2B 
2c5f9b3fa1c3d5d7879c2aa1c95f82c6360b35a259443a8ad68ff8f471f4efa8d2fd7935c57317ee5e94789244067706967f9c5df413bccd2556b5790d51d349
 SHA512 
4cdf1c45ea110cf6ba6ffe5b890ebd8f82654899ed6224ede6c59864f28626c758b5ea15f26c1840a4d3f70abaf9c1255754c565ef2fe5e5b39e0499ace63521
 DIST gdal-3.9.0.tar.xz 9081116 BLAKE2B 
5b1453b889768359d36c6da435b27f6d31bb1ba95cecfd05d525d63258100705778d2675219711d0c2ab0e2392dd0eabffa1af3ffd055ebfc14840aaa1e768c0
 SHA512 
05e50a3898b4c71351125c59b0058eb8213858ef14f213b251dee44638522e7e87ed660d028677803a74728543531b0f438e53a543e6529bb8cdc391e9a09b02
 DIST gdal-3.9.1.tar.xz 9098844 BLAKE2B 
a9c5c20b1bc704a331ea54f1575f655197075dde75fa6144cff43763d57d64b9bd6e3c7a40bedb919567b45185688b206a3cc13278d0605c5be0b895b403bbab
 SHA512 
5f4edc65ffb1eb187fa83259a25f4a078fbc75e21b39d21b17660a8ccf3322ca13de263ff91531cdf7a2e2871d1dd4275b88af37c122080fc16bef2436e1edb6
+DIST gdal-3.9.3.tar.xz 9110460 BLAKE2B 
0ae536ff832a3659dd9e56d32f2695b9428c24b1a0d75845c860ce7c78eb462cf78df7e821d814287f4c37ccf79f938256fe662a09c4bd936843a75157f29c8c
 SHA512 
e8d4c8c97946a68775d03ecf1f192d950bf01b7a40ff7bf35a6f535dd08b370a26d5646da84179e4864aa59ebfbceae7e77bbb04b745bdd26fde555f6ae0708e
 DIST gdalautotest-3.8.0.tar.gz 15615239 BLAKE2B 
fa524bb796a6f5b28bea79b51c4ce34e231b1d10a108a4590e30a48dc946df45880828a5a1ee0db07ed191e0f7dd5631fb294f3a73d1ce24244b6132f5cc3de1
 SHA512 
e72705571a337412d379cdf36debbe01aca61e789527c5e1f1c47904ba817c390a04032913fde75f899b96ec4f0b3a849ec3ead2539c31b59ca5006cd5e4e431
 DIST gdalautotest-3.8.5.tar.gz 15711701 BLAKE2B 
3f0a5ba7f6a2072aaf46e2867739faaba9fae89f2679ad5cb4cb356112b197141e996fc10365bb6a95c3fce648a440bd746aa68f5c52a8743995cf696d230ef0
 SHA512 
18251e2fe5870bcbbde9c4278d7ce969feb6397a727679f56e6cf051cf5a3ded29217c034566cb9c5ebb02d51ad4d12933ab918eeadb0017c78859892bbf4f19
 DIST gdalautotest-3.9.0.tar.gz 16280839 BLAKE2B 
e9d294dcbf98b052889b807992ec435837da37a8ecf6bf97ab3cac5c798feea4f69c930cfcecbe072f959c140788136f34525fed9086e14d9bf4fb1fe44e0113
 SHA512 
411037da7c8de6985dad7b5f3868527b8f59b280a2b7fd29addab81ae1ae58f8611843de355d9a39ea3fca09001b7931c669f379e88b407116784e597b2cda7f
 DIST gdalautotest-3.9.1.tar.gz 16681261 BLAKE2B 
c6eecb5bdd3d9b9730f49ba88dc9d5c1098990f1dfe34b9a181bf30a71570d382b36a7d22026e8ebb3c2e6e24ae4a4de321f70d6960784aed283d7e7511cb578
 SHA512 
e35c3dbd4239b1404b0fb774dae1d675bdfbc406d97ac909ec0e20b57d60fbc9236158871249fbdf9e3fb727b3d16a13a366803462afde9f2be4cb1efd91bf6e
+DIST gdalautotest-3.9.3.tar.gz 17239532 BLAKE2B 
991e24ac3181e1ab4837933183520828fc4f5416ce0f3e6e13a12052db301286898eaecd80f8b6765f19876be786b95854c1efef6cccfe02cacedae5f00302e6
 SHA512 
a9f44065bb5817cdc32995cd57f65f8a588dfaea77d4a5bc2d9ea361ef1423843358d7e31be2e27505b6e991d07b18f0f5c3fd9526cf697c74bc88f558205d61

diff --git a/sci-libs/gdal/files/gdal-3.9.3-poppler-25.02.patch 
b/sci-libs/gdal/files/gdal-3.9.3-poppler-25.02.patch
new file mode 100644
index 000000000000..dd1e374be5ce
--- /dev/null
+++ b/sci-libs/gdal/files/gdal-3.9.3-poppler-25.02.patch
@@ -0,0 +1,240 @@
+From f6d4e0608dabfd4f2712172bdb604996178eb744 Mon Sep 17 00:00:00 2001
+From: Even Rouault <[email protected]>
+Date: Thu, 6 Feb 2025 14:41:52 +0100
+Subject: [PATCH] Build: fix build against Poppler 25.02.00
+
+Fixes #11804
+---
+ frmts/pdf/pdfdataset.cpp           | 41 ++++++++++++++++++++++++++----
+ frmts/pdf/pdfio.cpp                | 17 +++++++++++++
+ frmts/pdf/pdfio.h                  | 12 +++++++++
+ frmts/pdf/pdfobject.cpp            |  6 ++---
+ frmts/pdf/pdfobject.h              |  2 +-
+ frmts/pdf/pdfsdk_headers.h |  9 +++++--
+ 6 files changed, 76 insertions(+), 11 deletions(-)
+
+diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp
+--- a/frmts/pdf/pdfdataset.cpp
++++ b/frmts/pdf/pdfdataset.cpp
+@@ -1964,6 +1964,14 @@ CPLErr PDFDataset::ReadPixels(int nReqXOff, int 
nReqYOff, int nReqXSize,
+         PDFDoc *poDoc = m_poDocPoppler;
+         poSplashOut->startDoc(poDoc);
+ 
++        // Note: Poppler 25.2 is certainly not the lowest version where we can
++        // avoid the hack.
++#if !(POPPLER_MAJOR_VERSION > 25 ||                                           
 \
++      (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2))
++#define USE_OPTCONTENT_HACK
++#endif
++
++#ifdef USE_OPTCONTENT_HACK
+         /* EVIL: we modify a private member... */
+         /* poppler (at least 0.12 and 0.14 versions) don't render correctly */
+         /* some PDFs and display an error message 'Could not find a OCG with
+@@ -1978,6 +1986,7 @@ CPLErr PDFDataset::ReadPixels(int nReqXOff, int 
nReqYOff, int nReqXSize,
+         OCGs *poOldOCGs = poCatalog->optContent;
+         if (!m_bUseOCG)
+             poCatalog->optContent = nullptr;
++#endif
+         try
+         {
+             poDoc->displayPageSlice(poSplashOut, m_iPage, m_dfDPI, m_dfDPI, 0,
+@@ -1988,14 +1997,19 @@ CPLErr PDFDataset::ReadPixels(int nReqXOff, int 
nReqYOff, int nReqXSize,
+         {
+             CPLError(CE_Failure, CPLE_AppDefined,
+                      "PDFDoc::displayPageSlice() failed with %s", e.what());
++
++#ifdef USE_OPTCONTENT_HACK
+             /* Restore back */
+             poCatalog->optContent = poOldOCGs;
++#endif
+             delete poSplashOut;
+             return CE_Failure;
+         }
+ 
++#ifdef USE_OPTCONTENT_HACK
+         /* Restore back */
+         poCatalog->optContent = poOldOCGs;
++#endif
+ 
+         SplashBitmap *poBitmap = poSplashOut->getBitmap();
+         if (poBitmap->getWidth() != nReqXSize ||
+@@ -3734,9 +3748,14 @@ void PDFDataset::ExploreLayersPoppler(GDALPDFArray 
*poArray,
+                 }
+                 else
+                     osCurLayer = std::move(osName);
+-                // CPLDebug("PDF", "Layer %s", osCurLayer.c_str());
++                    // CPLDebug("PDF", "Layer %s", osCurLayer.c_str());
+ 
+-                OCGs *optContentConfig = 
m_poDocPoppler->getOptContentConfig();
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++                const
++#endif
++                    OCGs *optContentConfig =
++                        m_poDocPoppler->getOptContentConfig();
+                 struct Ref r;
+                 r.num = poObj->GetRefNum().toInt();
+                 r.gen = poObj->GetRefGen();
+@@ -3772,11 +3791,19 @@ void PDFDataset::FindLayersPoppler(int iPageOfInterest)
+     if (poPages)
+         nPageCount = poPages->GetLength();
+ 
+-    OCGs *optContentConfig = m_poDocPoppler->getOptContentConfig();
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++    const
++#endif
++        OCGs *optContentConfig = m_poDocPoppler->getOptContentConfig();
+     if (optContentConfig == nullptr || !optContentConfig->isOk())
+         return;
+ 
+-    Array *array = optContentConfig->getOrderArray();
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++    const
++#endif
++        Array *array = optContentConfig->getOrderArray();
+     if (array)
+     {
+         GDALPDFArray *poArray = GDALPDFCreateArray(array);
+@@ -3812,7 +3839,11 @@ void PDFDataset::FindLayersPoppler(int iPageOfInterest)
+ 
+ void PDFDataset::TurnLayersOnOffPoppler()
+ {
+-    OCGs *optContentConfig = m_poDocPoppler->getOptContentConfig();
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++    const
++#endif
++        OCGs *optContentConfig = m_poDocPoppler->getOptContentConfig();
+     if (optContentConfig == nullptr || !optContentConfig->isOk())
+         return;
+ 
+diff --git a/frmts/pdf/pdfio.cpp b/frmts/pdf/pdfio.cpp
+--- a/frmts/pdf/pdfio.cpp
++++ b/frmts/pdf/pdfio.cpp
+@@ -237,23 +237,40 @@ int VSIPDFFileStream::lookChar()
+ /*                                reset()                               */
+ /************************************************************************/
+ 
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++bool VSIPDFFileStream::reset()
++#else
+ void VSIPDFFileStream::reset()
++#endif
+ {
+     nSavedPos = VSIFTellL(f);
+     bHasSavedPos = TRUE;
+     VSIFSeekL(f, nCurrentPos = nStart, SEEK_SET);
+     nPosInBuffer = -1;
+     nBufferLength = -1;
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++    return true;
++#endif
+ }
+ 
+ /************************************************************************/
+ /*                         unfilteredReset()                            */
+ /************************************************************************/
+ 
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION > 2)
++bool VSIPDFFileStream::unfilteredReset()
++{
++    return reset();
++}
++#else
+ void VSIPDFFileStream::unfilteredReset()
+ {
+     reset();
+ }
++#endif
+ 
+ /************************************************************************/
+ /*                                close()                               */
+diff --git a/frmts/pdf/pdfio.h b/frmts/pdf/pdfio.h
+--- a/frmts/pdf/pdfio.h
++++ b/frmts/pdf/pdfio.h
+@@ -48,8 +48,20 @@ class VSIPDFFileStream final : public BaseStream
+     virtual int getUnfilteredChar() override;
+     virtual int lookChar() override;
+ 
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++    virtual bool reset() override;
++#else
+     virtual void reset() override;
++#endif
++
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION > 2)
++    virtual bool unfilteredReset() override;
++#else
+     virtual void unfilteredReset() override;
++#endif
++
+     virtual void close() override;
+ 
+     bool FoundLinearizedHint() const
+diff --git a/frmts/pdf/pdfobject.cpp b/frmts/pdf/pdfobject.cpp
+--- a/frmts/pdf/pdfobject.cpp
++++ b/frmts/pdf/pdfobject.cpp
+@@ -979,11 +979,11 @@ class GDALPDFDictionaryPoppler : public GDALPDFDictionary
+ class GDALPDFArrayPoppler : public GDALPDFArray
+ {
+   private:
+-    Array *m_poArray;
++    const Array *m_poArray;
+     std::vector<std::unique_ptr<GDALPDFObject>> m_v;
+ 
+   public:
+-    GDALPDFArrayPoppler(Array *poArray) : m_poArray(poArray)
++    GDALPDFArrayPoppler(const Array *poArray) : m_poArray(poArray)
+     {
+     }
+ 
+@@ -1334,7 +1334,7 @@ std::map<CPLString, GDALPDFObject *> 
&GDALPDFDictionaryPoppler::GetValues()
+ /*                           GDALPDFCreateArray()                       */
+ /************************************************************************/
+ 
+-GDALPDFArray *GDALPDFCreateArray(Array *array)
++GDALPDFArray *GDALPDFCreateArray(const Array *array)
+ {
+     return new GDALPDFArrayPoppler(array);
+ }
+diff --git a/frmts/pdf/pdfobject.h b/frmts/pdf/pdfobject.h
+--- a/frmts/pdf/pdfobject.h
++++ b/frmts/pdf/pdfobject.h
+@@ -405,7 +405,7 @@ class GDALPDFObjectPoppler : public GDALPDFObject
+     virtual int GetRefGen() override;
+ };
+ 
+-GDALPDFArray *GDALPDFCreateArray(Array *array);
++GDALPDFArray *GDALPDFCreateArray(const Array *array);
+ 
+ #endif  // HAVE_POPPLER
+ 
+diff --git a/frmts/pdf/pdfsdk_headers.h b/frmts/pdf/pdfsdk_headers.h
+--- a/frmts/pdf/pdfsdk_headers.h
++++ b/frmts/pdf/pdfsdk_headers.h
+@@ -51,10 +51,15 @@
+ 
+ #include <Dict.h>
+ 
+-#define private                                                               
 \
+-    public /* Ugly! Catalog::optContent is private but we need it... */
++#if POPPLER_MAJOR_VERSION > 25 ||                                             
 \
++    (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
++#include <Catalog.h>
++#else
++/* Ugly! Catalog::optContent is private but we need it for ancient Poppler 
versions. */
++#define private public
+ #include <Catalog.h>
+ #undef private
++#endif
+ 
+ #define private public /* Ugly! PDFDoc::str is private but we need it... */
+ #include <PDFDoc.h>

diff --git a/sci-libs/gdal/files/gdal-3.9.3-poppler-autotest-25.02.patch 
b/sci-libs/gdal/files/gdal-3.9.3-poppler-autotest-25.02.patch
new file mode 100644
index 000000000000..6048c886b690
--- /dev/null
+++ b/sci-libs/gdal/files/gdal-3.9.3-poppler-autotest-25.02.patch
@@ -0,0 +1,23 @@
+From f6d4e0608dabfd4f2712172bdb604996178eb744 Mon Sep 17 00:00:00 2001
+From: Even Rouault <[email protected]>
+Date: Thu, 6 Feb 2025 14:41:52 +0100
+Subject: [PATCH] Build: fix build against Poppler 25.02.00
+
+Fixes #11804
+---
+ autotest/gdrivers/pdf.py           |  2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/autotest/gdrivers/pdf.py b/autotest/gdrivers/pdf.py
+index 7b74e9b5384c..373604068ec3 100755
+--- a/autotest/gdrivers/pdf.py
++++ b/autotest/gdrivers/pdf.py
+@@ -1524,7 +1524,7 @@ def test_pdf_extra_rasters(poppler_or_pdfium):
+             "LAYER_01_NAME=subbyte",
+         ], "did not get expected layers"
+     if pdf_is_poppler():
+-        assert cs in (7926, 8177, 8174, 8165, 8172)
++        assert cs in (7926, 8177, 8174, 8165, 8172, 8193)
+ 
+ 
+ 
###############################################################################

diff --git a/sci-libs/gdal/gdal-3.9.3.ebuild b/sci-libs/gdal/gdal-3.9.3.ebuild
new file mode 100644
index 000000000000..d2542f591370
--- /dev/null
+++ b/sci-libs/gdal/gdal-3.9.3.ebuild
@@ -0,0 +1,289 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit cmake java-pkg-opt-2 python-single-r1
+
+DESCRIPTION="Translator library for raster geospatial data formats (includes 
OGR support)"
+HOMEPAGE="https://gdal.org/";
+SRC_URI="https://download.osgeo.org/${PN}/${PV}/${P}.tar.xz";
+SRC_URI+=" test? ( 
https://download.osgeo.org/${PN}/${PV}/${PN}autotest-${PV}.tar.gz )"
+
+LICENSE="BSD Info-ZIP MIT"
+SLOT="0/35" # subslot is libgdal.so.<SONAME>
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux 
~ppc-macos"
+IUSE="armadillo +curl cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_sse 
cpu_flags_x86_sse2 cpu_flags_x86_sse4_1 cpu_flags_x86_ssse3 doc fits geos gif 
gml hdf5 heif java jpeg jpeg2k lerc lzma mysql netcdf odbc ogdi opencl oracle 
parquet pdf png postgres python spatialite sqlite test webp xls zstd"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="
+       python? ( ${PYTHON_REQUIRED_USE} )
+       spatialite? ( sqlite )
+       test? ( ${PYTHON_REQUIRED_USE} )
+"
+
+BDEPEND="
+       virtual/pkgconfig
+       doc? ( app-text/doxygen )
+       java? (
+               >=dev-java/ant-1.10.14-r3:0
+               dev-lang/swig
+       )
+       python? (
+               dev-lang/swig
+               $(python_gen_cond_dep '
+                       dev-python/setuptools[${PYTHON_USEDEP}]
+               ')
+       )
+       test? (
+               ${PYTHON_DEPS}
+               dev-cpp/gtest
+       )
+"
+DEPEND="
+       dev-libs/expat
+       dev-libs/json-c:=
+       dev-libs/libpcre2
+       dev-libs/libxml2:2
+       dev-libs/openssl:=
+       media-libs/tiff
+       >=sci-libs/libgeotiff-1.5.1-r1:=
+       >=sci-libs/proj-6.0.0:=
+       sys-libs/zlib[minizip(+)]
+       armadillo? ( sci-libs/armadillo:=[lapack] )
+       curl? ( net-misc/curl )
+       fits? ( sci-libs/cfitsio:= )
+       geos? ( >=sci-libs/geos-3.8.0 )
+       gif? ( media-libs/giflib:= )
+       gml? ( >=dev-libs/xerces-c-3.1 )
+       heif? ( media-libs/libheif:= )
+       hdf5? ( >=sci-libs/hdf5-1.6.4:=[cxx,szip] )
+       java? (
+               >=virtual/jdk-1.8:*[-headless-awt]
+       )
+       jpeg? ( media-libs/libjpeg-turbo:= )
+       jpeg2k? ( media-libs/openjpeg:2= )
+       lerc? ( media-libs/tiff:=[lerc(-)] )
+       lzma? ( || (
+               app-arch/xz-utils
+               app-arch/lzma
+       ) )
+       mysql? ( virtual/mysql )
+       netcdf? ( sci-libs/netcdf:= )
+       odbc? ( dev-db/unixODBC )
+       ogdi? ( >=sci-libs/ogdi-4.1.0-r1 )
+       opencl? ( virtual/opencl )
+       oracle? ( dev-db/oracle-instantclient:= )
+       parquet? ( dev-libs/apache-arrow:=[dataset,parquet] )
+       pdf? ( app-text/poppler:= )
+       png? ( media-libs/libpng:= )
+       postgres? ( >=dev-db/postgresql-8.4:= )
+       python? (
+               ${PYTHON_DEPS}
+               $(python_gen_cond_dep '
+                       dev-python/numpy[${PYTHON_USEDEP}]
+               ')
+       )
+       spatialite? ( dev-db/spatialite )
+       sqlite? ( dev-db/sqlite:3 )
+       webp? ( media-libs/libwebp:= )
+       xls? ( dev-libs/freexl )
+       zstd? ( app-arch/zstd:= )
+"
+RDEPEND="
+       ${DEPEND}
+       java? ( >=virtual/jre-1.8:* )
+"
+
+QA_CONFIG_IMPL_DECL_SKIP=(
+       _wstat64 # Windows LFS
+)
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-3.6.4-abseil-cpp-20230125.2-c++17.patch
+       "${FILESDIR}"/${PN}-3.9.1-poppler-24.12.patch
+       "${FILESDIR}"/${P}-poppler-25.02.patch
+)
+
+pkg_setup() {
+       if use python || use test ; then
+               python-single-r1_pkg_setup
+       fi
+
+       use java && java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+       if use test ; then
+               mv "${WORKDIR}"/gdalautotest-${PV} "${S}"/autotest || die
+               PATCHES+=( "${FILESDIR}"/${P}-poppler-autotest-25.02.patch )
+       fi
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DENABLE_IPO=OFF
+               -DGDAL_USE_EXTERNAL_LIBS=ON
+               -DGDAL_USE_INTERNAL_LIBS=OFF
+               -DBUILD_TESTING=$(usex test)
+
+               # bug #844874 and bug #845150
+               -DCMAKE_INSTALL_INCLUDEDIR="include/gdal"
+
+               # Options here are generally off because of one of:
+               # - Not yet packaged dependencies
+               #
+               # - Off for autotools build and didn't want more churn by
+               #   enabling during port to CMake. Feel free to request them
+               #   being turned on if useful for you.
+               -DGDAL_USE_ARMADILLO=$(usex armadillo)
+               -DGDAL_USE_ARROW=OFF
+               -DGDAL_USE_BLOSC=OFF
+               -DGDAL_USE_BRUNSLI=OFF
+               -DGDAL_USE_CRNLIB=OFF
+               -DGDAL_USE_CFITSIO=$(usex fits)
+               -DGDAL_USE_CURL=$(usex curl)
+               -DGDAL_USE_CRYPTOPP=OFF
+               -DGDAL_USE_DEFLATE=OFF
+               -DGDAL_USE_ECW=OFF
+               -DGDAL_USE_EXPAT=ON
+               -DGDAL_USE_FILEGDB=OFF
+               -DGDAL_USE_FREEXL=$(usex xls)
+               -DGDAL_USE_FYBA=OFF
+               -DGDAL_USE_GEOTIFF=ON
+               -DGDAL_USE_GEOS=$(usex geos)
+               -DGDAL_USE_GIF=$(usex gif)
+               -DGDAL_USE_GTA=OFF
+               -DGDAL_USE_HEIF=$(usex heif)
+               -DGDAL_USE_HDF4=OFF
+               -DGDAL_USE_HDF5=$(usex hdf5)
+               -DGDAL_USE_HDFS=OFF
+               -DGDAL_USE_ICONV=ON # TODO dep
+               -DGDAL_USE_IDB=OFF
+               -DGDAL_USE_JPEG=$(usex jpeg)
+
+               # https://gdal.org/build_hints.html#jpeg12
+               # Independent of whether using system libjpeg
+               -DGDAL_USE_JPEG12_INTERNAL=ON
+
+               -DGDAL_USE_JSONC=ON
+               -DGDAL_USE_JXL=OFF
+               -DGDAL_USE_KDU=OFF
+               -DGDAL_USE_KEA=OFF
+               -DGDAL_USE_LERC=$(usex lerc)
+               -DGDAL_USE_LIBKML=OFF
+               -DGDAL_USE_LIBLZMA=$(usex lzma)
+               -DGDAL_USE_LIBXML2=ON
+               -DGDAL_USE_LURATECH=OFF
+               -DGDAL_USE_LZ4=OFF
+               -DGDAL_USE_MONGOCXX=OFF
+               -DGDAL_USE_MRSID=OFF
+               -DGDAL_USE_MSSQL_NCLI=OFF
+               -DGDAL_USE_MSSQL_ODBC=OFF
+               -DGDAL_USE_MYSQL=$(usex mysql)
+               -DGDAL_USE_NETCDF=$(usex netcdf)
+               -DGDAL_USE_ODBC=$(usex odbc)
+               -DGDAL_USE_ODBCCPP=OFF
+               -DGDAL_USE_OGDI=$(usex ogdi)
+               -DGDAL_USE_OPENCAD=OFF
+               -DGDAL_USE_OPENCL=$(usex opencl)
+               -DGDAL_USE_OPENEXR=OFF
+               -DGDAL_USE_OPENJPEG=$(usex jpeg2k)
+               -DGDAL_USE_OPENSSL=ON
+               -DGDAL_USE_ORACLE=$(usex oracle)
+               -DGDAL_USE_PARQUET=$(usex parquet)
+               -DGDAL_USE_PCRE2=ON
+               -DGDAL_USE_PDFIUM=OFF
+               -DGDAL_USE_PNG=$(usex png)
+               -DGDAL_USE_PODOFO=OFF
+               -DGDAL_USE_POPPLER=$(usex pdf)
+               -DGDAL_USE_POSTGRESQL=$(usex postgres)
+               -DGDAL_USE_QHULL=OFF
+               -DGDAL_USE_RASTERLITE2=OFF
+               -DGDAL_USE_RDB=OFF
+               -DGDAL_USE_SPATIALITE=$(usex spatialite)
+               -DGDAL_USE_SQLITE3=$(usex sqlite)
+               -DGDAL_USE_SFCGAL=OFF
+               -DGDAL_USE_TEIGHA=OFF
+               -DGDAL_USE_TIFF=ON
+               -DGDAL_USE_TILEDB=OFF
+               -DGDAL_USE_WEBP=$(usex webp)
+               -DGDAL_USE_XERCESC=$(usex gml)
+               -DGDAL_USE_ZLIB=ON
+               -DGDAL_USE_ZSTD=$(usex zstd)
+
+               # Bindings
+               -DBUILD_PYTHON_BINDINGS=$(usex python)
+               -DBUILD_JAVA_BINDINGS=$(usex java)
+               # bug #845369
+               -DBUILD_CSHARP_BINDINGS=OFF
+
+               # Check work/gdal-3.5.0_build/CMakeCache.txt after configure
+               # and 
https://github.com/OSGeo/gdal/blob/master/cmake/helpers/CheckCompilerMachineOption.cmake#L71
+               # Commented out: not (yet?) implemented upstream.
+               # Also, arm64 stuff is a TODO upstream, but not there (yet?)
+               -Dtest_avx=$(usex cpu_flags_x86_avx)
+               -Dtest_avx2=$(usex cpu_flags_x86_avx2)
+               -Dtest_sse=$(usex cpu_flags_x86_sse)
+               -Dtest_sse2=$(usex cpu_flags_x86_sse2)
+               #-Dtest_sse3=$(usex cpu_flags_x86_sse3)
+               -Dtest_sse4.1=$(usex cpu_flags_x86_sse4_1)
+               #-Dtest_sse4.2=$(usex cpu_flags_x86_sse4_2)
+               #-Dtest_sse4a=$(usex cpu_flags_x86_sse4a)
+               -Dtest_ssse3=$(usex cpu_flags_x86_ssse3)
+               #-Dtest_fma4=$(usex cpu_flags_x86_fma4)
+               #-Dtest_xop=$(usex cpu_flags_x86_xop)
+       )
+
+       if use test ; then
+               mycmakeargs+=( -DUSE_EXTERNAL_GTEST=ON )
+       fi
+
+       cmake_src_configure
+}
+
+src_compile() {
+       cmake_src_compile
+
+       use doc && cmake_src_compile doc
+}
+
+src_test() {
+       export GDAL_RUN_SLOW_TESTS=0
+       export GDAL_DOWNLOAD_TEST_DATA=0
+
+       # Two test suites:
+       # 1. autotests (much larger, uses pytest)
+       # 2. Small set of fuzzing tests (no download needed)
+
+       # Missing file for test-unit?
+       cmake_src_test -E "(test-unit)"
+}
+
+src_install() {
+       cmake_src_install
+       use python && python_optimize
+
+       if use java; then
+               # Move the native library into the proper place for Gentoo.  The
+               # library in ${D} has already had its RPATH fixed, so we use it
+               # rather than ${BUILD_DIR}/swig/java/libgdalalljni.so.
+               java-pkg_doso "${D}/usr/$(get_libdir)/jni/libgdalalljni.so"
+               rm -rf "${ED}/usr/$(get_libdir)/jni" || die
+       fi
+
+       # TODO: install docs?
+}
+
+pkg_postinst() {
+       elog "Check available image and data formats after building with"
+       elog "gdalinfo and ogrinfo (using the --formats switch)."
+
+       if use java; then
+               elog
+               elog "To use the Java bindings, you need to pass the following 
to java:"
+               elog "    -Djava.library.path=$(java-config -i gdal)"
+       fi
+}

Reply via email to