gdal: Update to 2.4.0
This commit is contained in:
@@ -1,353 +0,0 @@
|
||||
From 0c0b9ea5a5d6bbef938de8a77c5b00cb228b902d Mon Sep 17 00:00:00 2001
|
||||
From: Even Rouault <even.rouault@spatialys.com>
|
||||
Date: Fri, 12 Oct 2018 19:02:40 +0200
|
||||
Subject: [PATCH] Add support for Poppler 0.69 (fixes #1004)
|
||||
|
||||
---
|
||||
gdal/GDALmake.opt.in | 1 +
|
||||
gdal/configure.ac | 56 +++++++++++++++++++++++---------
|
||||
gdal/frmts/pdf/GNUmakefile | 4 +++
|
||||
gdal/frmts/pdf/makefile.vc | 6 +++-
|
||||
gdal/frmts/pdf/pdfdataset.cpp | 12 +++++++
|
||||
gdal/nmake.opt | 2 ++
|
||||
7 files changed, 111 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/GDALmake.opt.in b/GDALmake.opt.in
|
||||
index 30749ae982a..f9ab41fd124 100644
|
||||
--- a/GDALmake.opt.in
|
||||
+++ b/GDALmake.opt.in
|
||||
@@ -481,6 +481,8 @@ POPPLER_BASE_STREAM_HAS_TWO_ARGS = @POPPLER_BASE_STREAM_HAS_TWO_ARGS@
|
||||
POPPLER_0_20_OR_LATER = @POPPLER_0_20_OR_LATER@
|
||||
POPPLER_0_23_OR_LATER = @POPPLER_0_23_OR_LATER@
|
||||
POPPLER_0_58_OR_LATER = @POPPLER_0_58_OR_LATER@
|
||||
+POPPLER_0_69_OR_LATER = @POPPLER_0_69_OR_LATER@
|
||||
+POPPLER_0_72_OR_LATER = @POPPLER_0_72_OR_LATER@
|
||||
POPPLER_INC = @POPPLER_INC@
|
||||
POPPLER_PLUGIN_LIB = @POPPLER_PLUGIN_LIB@
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 4b8ab911cec..0c588e04f03 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -4496,6 +4496,8 @@ POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
|
||||
POPPLER_0_20_OR_LATER=no
|
||||
POPPLER_0_23_OR_LATER=no
|
||||
POPPLER_0_58_OR_LATER=no
|
||||
+POPPLER_0_69_OR_LATER=no
|
||||
+POPPLER_0_72_OR_LATER=no
|
||||
|
||||
AC_MSG_CHECKING([for poppler])
|
||||
|
||||
@@ -4536,21 +4537,68 @@ if test "$with_poppler" != "no" -a "$with_poppler" != ""; then
|
||||
|
||||
CHECK_OTHER_POPPLER_VERSION=yes
|
||||
|
||||
- # And now we check if we have Poppler >= 0.58.0
|
||||
- AC_MSG_CHECKING([if Object does have new API (>= 0.58.0)])
|
||||
- rm -f testpoppler.*
|
||||
- echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
- echo 'int main(int argc, char** argv) { Object o(objNull); return 0; }' >> testpoppler.cpp
|
||||
- if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
- POPPLER_0_58_OR_LATER=yes
|
||||
- POPPLER_0_23_OR_LATER=yes
|
||||
- POPPLER_0_20_OR_LATER=yes
|
||||
- POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
- POPPLER_HAS_OPTCONTENT=yes
|
||||
- CHECK_OTHER_POPPLER_VERSION=no
|
||||
- AC_MSG_RESULT([yes])
|
||||
- else
|
||||
- AC_MSG_RESULT([no])
|
||||
+ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
+ AC_MSG_CHECKING([if GooString has API >= 0.72.0])
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/goo/GooString.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) {' >> testpoppler.cpp
|
||||
+ echo 'GooString *goostr = new GooString("Test");' >> testpoppler.cpp
|
||||
+ echo 'const char* data = (const char*)goostr->c_str();' >> testpoppler.cpp
|
||||
+ echo 'return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_72_OR_LATER=yes
|
||||
+ POPPLER_0_69_OR_LATER=yes
|
||||
+ POPPLER_0_58_OR_LATER=yes
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
+ POPPLER_HAS_OPTCONTENT=yes
|
||||
+ CHECK_OTHER_POPPLER_VERSION=no
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
+ AC_MSG_CHECKING([if OptionalContent has API >= 0.69.0])
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/OptionalContent.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) {' >> testpoppler.cpp
|
||||
+ echo 'OCGs ocg(nullptr, nullptr);' >> testpoppler.cpp
|
||||
+ echo 'ocg.getOCGs().size();' >> testpoppler.cpp
|
||||
+ echo 'return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_69_OR_LATER=yes
|
||||
+ POPPLER_0_58_OR_LATER=yes
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
+ POPPLER_HAS_OPTCONTENT=yes
|
||||
+ CHECK_OTHER_POPPLER_VERSION=no
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
+ # And now we check if we have Poppler >= 0.58.0
|
||||
+ AC_MSG_CHECKING([if Object does have new API (>= 0.58.0)])
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/Object.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) { Object o(objNull); return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_58_OR_LATER=yes
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
+ POPPLER_HAS_OPTCONTENT=yes
|
||||
+ CHECK_OTHER_POPPLER_VERSION=no
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
fi
|
||||
|
||||
if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
@@ -4635,6 +4660,8 @@ AC_SUBST(POPPLER_BASE_STREAM_HAS_TWO_ARGS, $POPPLER_BASE_STREAM_HAS_TWO_ARGS)
|
||||
AC_SUBST(POPPLER_0_20_OR_LATER, $POPPLER_0_20_OR_LATER)
|
||||
AC_SUBST(POPPLER_0_23_OR_LATER, $POPPLER_0_23_OR_LATER)
|
||||
AC_SUBST(POPPLER_0_58_OR_LATER, $POPPLER_0_58_OR_LATER)
|
||||
+AC_SUBST(POPPLER_0_69_OR_LATER, $POPPLER_0_69_OR_LATER)
|
||||
+AC_SUBST(POPPLER_0_72_OR_LATER, $POPPLER_0_72_OR_LATER)
|
||||
AC_SUBST(POPPLER_INC, $POPPLER_INC)
|
||||
AC_SUBST(POPPLER_PLUGIN_LIB, $POPPLER_PLUGIN_LIB)
|
||||
|
||||
diff --git a/frmts/pdf/GNUmakefile b/frmts/pdf/GNUmakefile
|
||||
index 2c332d2798f..6a267f529b2 100644
|
||||
--- a/frmts/pdf/GNUmakefile
|
||||
+++ b/frmts/pdf/GNUmakefile
|
||||
@@ -34,6 +34,14 @@ ifeq ($(POPPLER_0_58_OR_LATER),yes)
|
||||
CPPFLAGS += -DPOPPLER_0_58_OR_LATER
|
||||
endif
|
||||
|
||||
+ifeq ($(POPPLER_0_72_OR_LATER),yes)
|
||||
+CPPFLAGS += -DPOPPLER_0_72_OR_LATER
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(POPPLER_0_69_OR_LATER),yes)
|
||||
+CPPFLAGS += -DPOPPLER_0_69_OR_LATER
|
||||
+endif
|
||||
+
|
||||
ifeq ($(HAVE_PODOFO),yes)
|
||||
CPPFLAGS += -DHAVE_PODOFO
|
||||
endif
|
||||
diff --git a/frmts/pdf/makefile.vc b/frmts/pdf/makefile.vc
|
||||
index b4fa14d0a18..ad76d3de70c 100644
|
||||
--- a/frmts/pdf/makefile.vc
|
||||
+++ b/frmts/pdf/makefile.vc
|
||||
@@ -14,7 +14,7 @@ OBJ = $(OBJ) ..\..\ogr\ogrsf_frmts\mem\ogrmemdatasource.obj ..\..\ogr\ogrsf_frmt
|
||||
EXTRAFLAGS = -I..\vrt -I..\mem -I..\..\ogr\ogrsf_frmts\mem $(POPPLER_EXTRAFLAGS) $(PODOFO_EXTRAFLAGS) $(PDFIUM_EXTRAFLAGS)
|
||||
|
||||
!IFDEF POPPLER_ENABLED
|
||||
-POPPLER_EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) $(POPPLER_0_23_OR_LATER_FLAGS) $(POPPLER_0_58_OR_LATER_FLAGS) -DHAVE_POPPLER
|
||||
+POPPLER_EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) $(POPPLER_0_23_OR_LATER_FLAGS) $(POPPLER_0_58_OR_LATER_FLAGS) $(POPPLER_0_69_OR_LATER_FLAGS) $(POPPLER_0_72_OR_LATER_FLAGS) -DHAVE_POPPLER
|
||||
|
||||
!IFDEF POPPLER_HAS_OPTCONTENT
|
||||
POPPLER_HAS_OPTCONTENT_FLAGS = -DPOPPLER_HAS_OPTCONTENT
|
||||
@@ -36,6 +36,14 @@ POPPLER_0_23_OR_LATER_FLAGS = -DPOPPLER_0_23_OR_LATER
|
||||
POPPLER_0_58_OR_LATER_FLAGS = -DPOPPLER_0_58_OR_LATER
|
||||
!ENDIF
|
||||
|
||||
+!IFDEF POPPLER_0_69_OR_LATER
|
||||
+POPPLER_0_69_OR_LATER_FLAGS = -DPOPPLER_0_69_OR_LATER
|
||||
+!ENDIF
|
||||
+
|
||||
+!IFDEF POPPLER_0_72_OR_LATER
|
||||
+POPPLER_0_72_OR_LATER_FLAGS = -DPOPPLER_0_69_OR_LATER
|
||||
+!ENDIF
|
||||
+
|
||||
!ENDIF
|
||||
|
||||
!IFDEF PODOFO_ENABLED
|
||||
diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp
|
||||
index ee89fd07564..1a56f57ee06 100644
|
||||
--- a/frmts/pdf/pdfdataset.cpp
|
||||
+++ b/frmts/pdf/pdfdataset.cpp
|
||||
@@ -2593,18 +2593,25 @@
|
||||
}
|
||||
|
||||
#ifdef POPPLER_0_20_OR_LATER
|
||||
-static void PDFDatasetErrorFunction(CPL_UNUSED void* userData, CPL_UNUSED ErrorCategory eErrCategory,
|
||||
+
|
||||
+static void PDFDatasetErrorFunction(void* /* userData*/,
|
||||
+ ErrorCategory /* eErrCategory */,
|
||||
#ifdef POPPLER_0_23_OR_LATER
|
||||
Goffset nPos,
|
||||
#else
|
||||
int nPos,
|
||||
#endif
|
||||
- char *pszMsg)
|
||||
+#ifdef POPPLER_0_71_OR_LATER
|
||||
+ const char *pszMsg
|
||||
+#else
|
||||
+ char *pszMsg
|
||||
+#endif
|
||||
+ )
|
||||
{
|
||||
CPLString osError;
|
||||
|
||||
if (nPos >= 0)
|
||||
- osError.Printf("Pos = %d, ", (int)nPos);
|
||||
+ osError.Printf("Pos = " CPL_FRMT_GUIB ", ", static_cast<GUIntBig>(nPos));
|
||||
osError += pszMsg;
|
||||
PDFDatasetErrorFunctionCommon(osError);
|
||||
}
|
||||
@@ -3440,13 +3447,23 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+#ifdef POPPLER_0_69_OR_LATER
|
||||
+ for( const auto& refOCGPair: optContentConfig->getOCGs() )
|
||||
+ {
|
||||
+ auto ocg = refOCGPair.second.get();
|
||||
+#else
|
||||
GooList* ocgList = optContentConfig->getOCGs();
|
||||
for(int i=0;i<ocgList->getLength();i++)
|
||||
{
|
||||
OptionalContentGroup* ocg = (OptionalContentGroup*) ocgList->get(i);
|
||||
+#endif
|
||||
if( ocg != nullptr && ocg->getName() != nullptr )
|
||||
{
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ const char* pszLayerName = (const char*)ocg->getName()->c_str();
|
||||
+#else
|
||||
const char* pszLayerName = (const char*)ocg->getName()->getCString();
|
||||
+#endif
|
||||
AddLayer(pszLayerName);
|
||||
oLayerOCGMapPoppler[pszLayerName] = ocg;
|
||||
}
|
||||
@@ -3472,10 +3489,16 @@
|
||||
{
|
||||
int i;
|
||||
int bAll = EQUAL(pszLayers, "ALL");
|
||||
+#ifdef POPPLER_0_69_OR_LATER
|
||||
+ for( const auto& refOCGPair: optContentConfig->getOCGs() )
|
||||
+ {
|
||||
+ auto ocg = refOCGPair.second.get();
|
||||
+#else
|
||||
GooList* ocgList = optContentConfig->getOCGs();
|
||||
for(i=0;i<ocgList->getLength();i++)
|
||||
{
|
||||
OptionalContentGroup* ocg = (OptionalContentGroup*) ocgList->get(i);
|
||||
+#endif
|
||||
ocg->setState( (bAll) ? OptionalContentGroup::On : OptionalContentGroup::Off );
|
||||
}
|
||||
|
||||
@@ -4430,7 +4453,7 @@
|
||||
#ifdef HAVE_POPPLER
|
||||
if (bUseLib.test(PDFLIB_POPPLER))
|
||||
{
|
||||
- PDFRectangle* psMediaBox = poPagePoppler->getMediaBox();
|
||||
+ const auto* psMediaBox = poPagePoppler->getMediaBox();
|
||||
dfX1 = psMediaBox->x1;
|
||||
dfY1 = psMediaBox->y1;
|
||||
dfX2 = psMediaBox->x2;
|
||||
@@ -4768,14 +4791,16 @@
|
||||
GooString* poMetadata = poCatalogPoppler->readMetadata();
|
||||
if (poMetadata)
|
||||
{
|
||||
- char* pszContent = poMetadata->getCString();
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ const char* pszContent = poMetadata->c_str();
|
||||
+#else
|
||||
+ const char* pszContent = poMetadata->getCString();
|
||||
+#endif
|
||||
if (pszContent != nullptr &&
|
||||
STARTS_WITH(pszContent, "<?xpacket begin="))
|
||||
{
|
||||
- char *apszMDList[2];
|
||||
- apszMDList[0] = pszContent;
|
||||
- apszMDList[1] = nullptr;
|
||||
- poDS->SetMetadata(apszMDList, "xml:XMP");
|
||||
+ const char * const apszMDList[2] = { pszContent, nullptr };
|
||||
+ poDS->SetMetadata(const_cast<char**>(apszMDList), "xml:XMP");
|
||||
}
|
||||
delete poMetadata;
|
||||
}
|
||||
diff --git a/frmts/pdf/pdfio.h b/frmts/pdf/pdfio.h
|
||||
index fef95954e90..2d58059e801 100644
|
||||
--- a/frmts/pdf/pdfio.h
|
||||
+++ b/frmts/pdf/pdfio.h
|
||||
@@ -58,6 +58,15 @@
|
||||
#define makeSubStream_object_type Object*
|
||||
#endif
|
||||
|
||||
+// Detect Poppler 0.71 that no longer defines GBool
|
||||
+#ifdef POPPLER_0_69_OR_LATER
|
||||
+#ifndef initObj
|
||||
+#define POPPLER_0_71_OR_LATER
|
||||
+#define GBool bool
|
||||
+#define gFalse false
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
class VSIPDFFileStream: public BaseStream
|
||||
{
|
||||
public:
|
||||
--- a/frmts/pdf/pdfobject.cpp 2018-12-18 07:52:04.036212100 +0300
|
||||
+++ b/frmts/pdf/pdfobject.cpp 2018-12-18 07:53:39.648780000 +0300
|
||||
@@ -1061,7 +1061,11 @@
|
||||
#else
|
||||
GooString* gooString = m_po->getString();
|
||||
#endif
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->c_str()),
|
||||
+#else
|
||||
return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->getCString()),
|
||||
+#endif
|
||||
static_cast<int>(gooString->getLength())));
|
||||
}
|
||||
else
|
||||
@@ -1422,7 +1426,11 @@
|
||||
char* pszContent = (char*) VSIMalloc(m_nLength + 1);
|
||||
if (pszContent)
|
||||
{
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ memcpy(pszContent, gstr->c_str(), m_nLength);
|
||||
+#else
|
||||
memcpy(pszContent, gstr->getCString(), m_nLength);
|
||||
+#endif
|
||||
pszContent[m_nLength] = '\0';
|
||||
}
|
||||
delete gstr;
|
||||
diff --git a/nmake.opt b/nmake.opt
|
||||
index 682d766d93e..1eb049038c8 100644
|
||||
--- a/nmake.opt
|
||||
+++ b/nmake.opt
|
||||
@@ -639,6 +639,8 @@ OCI_INCLUDE = -I$(ORACLE_HOME)\oci\include
|
||||
# Uncomment POPPLER_0_20_OR_LATER = YES for Poppler >= 0.20.0
|
||||
# Uncomment POPPLER_0_23_OR_LATER = YES for Poppler >= 0.23.0
|
||||
# Uncomment POPPLER_0_58_OR_LATER = YES for Poppler >= 0.58.0
|
||||
+# Uncomment POPPLER_0_69_OR_LATER = YES for Poppler >= 0.69.0
|
||||
+# Uncomment POPPLER_0_72_OR_LATER = YES for Poppler >= 0.69.0
|
||||
#POPPLER_ENABLED = YES
|
||||
#POPPLER_CFLAGS = -Ie:/kde/include -Ie:/kde/include/poppler
|
||||
#POPPLER_HAS_OPTCONTENT = YES
|
||||
@@ -646,6 +647,8 @@ OCI_INCLUDE = -I$(ORACLE_HOME)\oci\include
|
||||
#POPPLER_0_20_OR_LATER = YES
|
||||
#POPPLER_0_23_OR_LATER = YES
|
||||
#POPPLER_0_58_OR_LATER = YES
|
||||
+#POPPLER_0_69_OR_LATER = YES
|
||||
+#POPPLER_0_72_OR_LATER = YES
|
||||
#POPPLER_LIBS = e:/kde/lib/poppler.lib e:/kde/lib/freetype.lib e:/kde/lib/liblcms-1.lib advapi32.lib gdi32.lib
|
||||
|
||||
# Uncomment for PDF support
|
||||
129
mingw-w64-gdal/0010-poppler-0_72-support.patch
Normal file
129
mingw-w64-gdal/0010-poppler-0_72-support.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
diff -Naur gdal-2.4.0-orig/configure.ac gdal-2.4.0/configure.ac
|
||||
--- gdal-2.4.0-orig/configure.ac 2018-12-15 00:34:19.000000000 +0300
|
||||
+++ gdal-2.4.0/configure.ac 2018-12-25 11:58:47.052523400 +0300
|
||||
@@ -4499,6 +4499,7 @@
|
||||
POPPLER_0_23_OR_LATER=no
|
||||
POPPLER_0_58_OR_LATER=no
|
||||
POPPLER_0_69_OR_LATER=no
|
||||
+POPPLER_0_72_OR_LATER=no
|
||||
|
||||
AC_MSG_CHECKING([for poppler])
|
||||
|
||||
@@ -4540,6 +4541,30 @@
|
||||
CHECK_OTHER_POPPLER_VERSION=yes
|
||||
|
||||
if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
+ AC_MSG_CHECKING([if GooString has API >= 0.72.0])
|
||||
+ rm -f testpoppler.*
|
||||
+ echo '#include <poppler/goo/GooString.h>' > testpoppler.cpp
|
||||
+ echo 'int main(int argc, char** argv) {' >> testpoppler.cpp
|
||||
+ echo 'GooString *goostr = new GooString("Test");' >> testpoppler.cpp
|
||||
+ echo 'const char* data = (const char*)goostr->c_str();' >> testpoppler.cpp
|
||||
+ echo 'return 0; }' >> testpoppler.cpp
|
||||
+ if test -z "`${CXX} ${CXXFLAGS} ${CPPFLAGS} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
|
||||
+ POPPLER_0_72_OR_LATER=yes
|
||||
+ POPPLER_0_71_OR_LATER=yes
|
||||
+ POPPLER_0_69_OR_LATER=yes
|
||||
+ POPPLER_0_58_OR_LATER=yes
|
||||
+ POPPLER_0_23_OR_LATER=yes
|
||||
+ POPPLER_0_20_OR_LATER=yes
|
||||
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
|
||||
+ POPPLER_HAS_OPTCONTENT=yes
|
||||
+ CHECK_OTHER_POPPLER_VERSION=no
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
|
||||
AC_MSG_CHECKING([if OptionalContent has API >= 0.69.0])
|
||||
rm -f testpoppler.*
|
||||
echo '#include <poppler/OptionalContent.h>' > testpoppler.cpp
|
||||
@@ -4663,6 +4688,7 @@
|
||||
AC_SUBST(POPPLER_0_23_OR_LATER, $POPPLER_0_23_OR_LATER)
|
||||
AC_SUBST(POPPLER_0_58_OR_LATER, $POPPLER_0_58_OR_LATER)
|
||||
AC_SUBST(POPPLER_0_69_OR_LATER, $POPPLER_0_69_OR_LATER)
|
||||
+AC_SUBST(POPPLER_0_72_OR_LATER, $POPPLER_0_72_OR_LATER)
|
||||
AC_SUBST(POPPLER_INC, $POPPLER_INC)
|
||||
AC_SUBST(POPPLER_PLUGIN_LIB, $POPPLER_PLUGIN_LIB)
|
||||
|
||||
diff -Naur gdal-2.4.0-orig/frmts/pdf/GNUmakefile gdal-2.4.0/frmts/pdf/GNUmakefile
|
||||
--- gdal-2.4.0-orig/frmts/pdf/GNUmakefile 2018-12-15 00:34:20.000000000 +0300
|
||||
+++ gdal-2.4.0/frmts/pdf/GNUmakefile 2018-12-25 11:59:44.039423500 +0300
|
||||
@@ -38,6 +38,10 @@
|
||||
CPPFLAGS += -DPOPPLER_0_69_OR_LATER
|
||||
endif
|
||||
|
||||
+ifeq ($(POPPLER_0_72_OR_LATER),yes)
|
||||
+CPPFLAGS += -DPOPPLER_0_72_OR_LATER
|
||||
+endif
|
||||
+
|
||||
ifeq ($(HAVE_PODOFO),yes)
|
||||
CPPFLAGS += -DHAVE_PODOFO
|
||||
endif
|
||||
diff -Naur gdal-2.4.0-orig/frmts/pdf/pdfdataset.cpp gdal-2.4.0/frmts/pdf/pdfdataset.cpp
|
||||
--- gdal-2.4.0-orig/frmts/pdf/pdfdataset.cpp 2018-12-15 00:37:15.000000000 +0300
|
||||
+++ gdal-2.4.0/frmts/pdf/pdfdataset.cpp 2018-12-25 12:03:40.855376100 +0300
|
||||
@@ -3459,7 +3459,11 @@
|
||||
#endif
|
||||
if( ocg != nullptr && ocg->getName() != nullptr )
|
||||
{
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ const char* pszLayerName = (const char*)ocg->getName()->c_str();
|
||||
+#else
|
||||
const char* pszLayerName = (const char*)ocg->getName()->getCString();
|
||||
+#endif
|
||||
AddLayer(pszLayerName);
|
||||
oLayerOCGMapPoppler[pszLayerName] = ocg;
|
||||
}
|
||||
@@ -4787,7 +4791,11 @@
|
||||
GooString* poMetadata = poCatalogPoppler->readMetadata();
|
||||
if (poMetadata)
|
||||
{
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ const char* pszContent = poMetadata->c_str();
|
||||
+#else
|
||||
const char* pszContent = poMetadata->getCString();
|
||||
+#endif
|
||||
if (pszContent != nullptr &&
|
||||
STARTS_WITH(pszContent, "<?xpacket begin="))
|
||||
{
|
||||
diff -Naur gdal-2.4.0-orig/frmts/pdf/pdfobject.cpp gdal-2.4.0/frmts/pdf/pdfobject.cpp
|
||||
--- gdal-2.4.0-orig/frmts/pdf/pdfobject.cpp 2018-12-15 00:37:15.000000000 +0300
|
||||
+++ gdal-2.4.0/frmts/pdf/pdfobject.cpp 2018-12-25 12:05:19.681549600 +0300
|
||||
@@ -1061,7 +1061,11 @@
|
||||
#else
|
||||
GooString* gooString = m_po->getString();
|
||||
#endif
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->c_str()),
|
||||
+#else
|
||||
return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->getCString()),
|
||||
+#endif
|
||||
static_cast<int>(gooString->getLength())));
|
||||
}
|
||||
else
|
||||
@@ -1422,7 +1426,11 @@
|
||||
char* pszContent = (char*) VSIMalloc(m_nLength + 1);
|
||||
if (pszContent)
|
||||
{
|
||||
+#ifdef POPPLER_0_72_OR_LATER
|
||||
+ memcpy(pszContent, gstr->c_str(), m_nLength);
|
||||
+#else
|
||||
memcpy(pszContent, gstr->getCString(), m_nLength);
|
||||
+#endif
|
||||
pszContent[m_nLength] = '\0';
|
||||
}
|
||||
delete gstr;
|
||||
diff -Naur gdal-2.4.0-orig/GDALmake.opt.in gdal-2.4.0/GDALmake.opt.in
|
||||
--- gdal-2.4.0-orig/GDALmake.opt.in 2018-12-15 00:34:19.000000000 +0300
|
||||
+++ gdal-2.4.0/GDALmake.opt.in 2018-12-25 11:55:57.757409400 +0300
|
||||
@@ -482,6 +482,7 @@
|
||||
POPPLER_0_23_OR_LATER = @POPPLER_0_23_OR_LATER@
|
||||
POPPLER_0_58_OR_LATER = @POPPLER_0_58_OR_LATER@
|
||||
POPPLER_0_69_OR_LATER = @POPPLER_0_69_OR_LATER@
|
||||
+POPPLER_0_72_OR_LATER = @POPPLER_0_72_OR_LATER@
|
||||
POPPLER_INC = @POPPLER_INC@
|
||||
POPPLER_PLUGIN_LIB = @POPPLER_PLUGIN_LIB@
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
_realname=gdal
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=2.3.2
|
||||
pkgrel=3
|
||||
pkgver=2.4.0
|
||||
pkgrel=1
|
||||
pkgdesc="A translator library for raster geospatial data formats (mingw-w64)"
|
||||
arch=('any')
|
||||
url="http://www.gdal.org/"
|
||||
@@ -51,11 +51,11 @@ options=('strip' 'staticlibs')
|
||||
source=(http://download.osgeo.org/${_realname}/${pkgver}/${_realname}-${pkgver}.tar.gz
|
||||
0001-external-qhull-static.patch
|
||||
0002-libproj4-dll-name.patch
|
||||
0010-poppler-0_69-support.patch)
|
||||
sha256sums=('7808dd7ea7ee19700a133c82060ea614d4a72edbf299dfcb3713f5f79a909d64'
|
||||
0010-poppler-0_72-support.patch)
|
||||
sha256sums=('a568cf3dc7bb203ae12a48e1eb2a42302cded499ef6eccaf9e8f09187d8ce75a'
|
||||
'6952586cd4436003748e8d99f2e8e8a660ba59bdb3c0b294493695ef57f93077'
|
||||
'392123102d2884dfd91f4cdd89041c2f84467f40a60659cfc65c5e9983c15c6e'
|
||||
'4f164c6ba9245d060701b4bc34f39c4fd93cc3ef6ccf138e21ff329bdedd34e5')
|
||||
'40868b7be157637c1cf3bad8125adc7cb65d1690c6fac09e252963d5762a1791')
|
||||
|
||||
prepare() {
|
||||
[[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
|
||||
@@ -72,7 +72,7 @@ prepare() {
|
||||
|
||||
#patch -p1 -i ${srcdir}/0001-external-qhull-static.patch
|
||||
patch -p1 -i ${srcdir}/0002-libproj4-dll-name.patch
|
||||
patch -p1 -i ${srcdir}/0010-poppler-0_69-support.patch
|
||||
patch -p1 -i ${srcdir}/0010-poppler-0_72-support.patch
|
||||
|
||||
# bug: http://osgeo-org.1560.x6.nabble.com/gdal-dev-jpeg2000-jasper-error-compiling-gdal-2-1-from-git-release-branch-td5299100.html
|
||||
sed -i -e 's@uchar@unsigned char@' frmts/jpeg2000/jpeg2000_vsil_io.cpp
|
||||
|
||||
Reference in New Issue
Block a user