--- b/graphics/gdal/Makefile +++ b/graphics/gdal/Makefile @@ -3,6 +3,7 @@ PORTNAME= gdal PORTVERSION= 2.4.1 +PORTREVISION= 2 CATEGORIES= graphics geography MASTER_SITES= https://download.osgeo.org/gdal/${PORTVERSION}/ \ LOCAL/sunpoet @@ -20,17 +21,32 @@ LIB_DEPENDS= libgeotiff.so:graphics/libgeotiff \ libproj.so:graphics/proj \ libtiff.so:graphics/tiff +FLAVORS= default lite full +FLAVOR?= ${FLAVORS:[1]} +lite_PKGNAMESUFFIX= -lite +full_PKGNAMESUFFIX= -full +.if ${FLAVOR} == lite +OPTIONS_DEFAULT= JASPER +.elif ${FLAVOR} == full +OPTIONS_DEFAULT= ARMADILLO CFITSIO CURL ECW EXPAT FREEXL GEOS GTA HDF5 JASPER \ + KML LIBXML2 MYSQL NETCDF ODBC OPENJPEG PCRE PGSQL POPPLER \ + SFCGAL SPATIALITE SQLITE WEBP XERCES ZSTD +.else +OPTIONS_DEFAULT=CURL ECW EXPAT FREEXL GEOS HDF5 JASPER KML LIBXML2 \ + NETCDF OPENJPEG PCRE PGSQL POPPLER SPATIALITE SQLITE \ + WEBP XERCES +.endif + +USES= compiler:c++11-lang gmake iconv jpeg localbase pkgconfig ssl tar:xz + OPTIONS_DEFINE= ARMADILLO CFITSIO CURL ECW EXPAT FREEXL GEOS GTA HDF5 JASPER \ KML LIBXML2 MYSQL NETCDF ODBC OPENJPEG PCRE PGSQL SFCGAL \ SPATIALITE SQLITE WEBP XERCES ZSTD -OPTIONS_DEFAULT=JASPER OPTIONS_RADIO= PDF OPTIONS_RADIO_PDF= PODOFO POPPLER OPTIONS_SUB= yes PCRE_DESC= Regular expression support for SQLite -USES= compiler:c++11-lang gmake iconv jpeg localbase pkgconfig ssl tar:xz - CFLAGS+= -fPIC CONFIGURE_ARGS= --datadir=${DATADIR} \ --enable-static=yes \ --- /dev/null +++ b/graphics/gdal/files/patch-frmts_pdf_pdfobject.cpp @@ -0,0 +1,130 @@ +--- frmts/pdf/pdfobject.cpp.orig 2019-05-08 16:11:48 UTC ++++ frmts/pdf/pdfobject.cpp +@@ -38,7 +38,7 @@ + #include + #include "pdfobject.h" + +-CPL_CVSID("$Id: pdfobject.cpp d295d0ebc3b41092ad072790c704c772098da210 2019-01-17 22:52:36 +0100 Even Rouault $") ++CPL_CVSID("$Id$") + + /************************************************************************/ + /* ROUND_TO_INT_IF_CLOSE() */ +@@ -1195,7 +1195,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const cha + return oIter->second; + + #if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 58 +- Object o = m_poDict->lookupNF(((char*)pszKey)); ++ auto&& o(m_poDict->lookupNF(((char*)pszKey))); + if (!o.isNull()) + { + int nRefNum = 0; +@@ -1204,7 +1204,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const cha + { + nRefNum = o.getRefNum(); + nRefGen = o.getRefGen(); +- Object o2 = m_poDict->lookup((char*)pszKey); ++ Object o2(m_poDict->lookup((char*)pszKey)); + if( !o2.isNull() ) + { + GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE); +@@ -1215,7 +1215,7 @@ GDALPDFObject* GDALPDFDictionaryPoppler::Get(const cha + } + else + { +- GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE); ++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o.copy())), TRUE); + poObj->SetRefNumAndGen(nRefNum, nRefGen); + m_map[pszKey] = poObj; + return poObj; +@@ -1329,7 +1329,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex) + return m_v[nIndex]; + + #if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 58 +- Object o = m_poArray->getNF(nIndex); ++ auto&& o(m_poArray->getNF(nIndex)); + if( !o.isNull() ) + { + int nRefNum = 0; +@@ -1338,7 +1338,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex) + { + nRefNum = o.getRefNum(); + nRefGen = o.getRefGen(); +- Object o2 = m_poArray->get(nIndex); ++ Object o2(m_poArray->get(nIndex)); + if( !o2.isNull() ) + { + GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE); +@@ -1349,7 +1349,7 @@ GDALPDFObject* GDALPDFArrayPoppler::Get(int nIndex) + } + else + { +- GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE); ++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o.copy())), TRUE); + poObj->SetRefNumAndGen(nRefNum, nRefGen); + m_v[nIndex] = poObj; + return poObj; +@@ -1416,8 +1416,6 @@ int GDALPDFStreamPoppler::GetLength() + + char* GDALPDFStreamPoppler::GetBytes() + { +- /* fillGooString() available in poppler >= 0.16.0 */ +-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS + GooString* gstr = new GooString(); + m_poStream->fillGooString(gstr); + +@@ -1427,7 +1425,12 @@ char* GDALPDFStreamPoppler::GetBytes() + char* pszContent = (char*) VSIMalloc(m_nLength + 1); + if (pszContent) + { +- memcpy(pszContent, gstr->getCString(), m_nLength); ++#if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72) ++ const char* srcStr = gstr->c_str(); ++#else ++ const char* srcStr = gstr->getCString(); ++#endif ++ memcpy(pszContent, srcStr, m_nLength); + pszContent[m_nLength] = '\0'; + } + delete gstr; +@@ -1438,41 +1441,6 @@ char* GDALPDFStreamPoppler::GetBytes() + delete gstr; + return nullptr; + } +-#else +- int i; +- int nLengthAlloc = 0; +- char* pszContent = nullptr; +- if( m_nLength >= 0 ) +- { +- pszContent = (char*) VSIMalloc(m_nLength + 1); +- if (!pszContent) +- return nullptr; +- nLengthAlloc = m_nLength; +- } +- m_poStream->reset(); +- for(i = 0; ; ++i ) +- { +- int nVal = m_poStream->getChar(); +- if (nVal == EOF) +- break; +- if( i >= nLengthAlloc ) +- { +- nLengthAlloc = 32 + nLengthAlloc + nLengthAlloc / 3; +- char* pszContentNew = (char*) VSIRealloc(pszContent, nLengthAlloc + 1); +- if( pszContentNew == nullptr ) +- { +- CPLFree(pszContent); +- m_nLength = 0; +- return nullptr; +- } +- pszContent = pszContentNew; +- } +- pszContent[i] = (GByte)nVal; +- } +- m_nLength = i; +- pszContent[i] = '\0'; +- return pszContent; +-#endif + } + + #endif // HAVE_POPPLER