1 |
commit: 864b528b1db3f4e946a21c7badac1448f13feaea |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 12 16:27:11 2019 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 12 20:07:04 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=864b528b |
7 |
|
8 |
sci-libs/gdal: Fix build with poppler-0.71 and poppler-0.72 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/674556 |
11 |
Package-Manager: Portage-2.3.55, Repoman-2.3.12 |
12 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
13 |
|
14 |
.../gdal/files/gdal-2.3.1-poppler-0.71.0.patch | 82 ++++++++++++++++++++++ |
15 |
.../gdal/files/gdal-2.3.1-poppler-0.72.0.patch | 58 +++++++++++++++ |
16 |
sci-libs/gdal/gdal-2.3.1.ebuild | 7 +- |
17 |
3 files changed, 146 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/sci-libs/gdal/files/gdal-2.3.1-poppler-0.71.0.patch b/sci-libs/gdal/files/gdal-2.3.1-poppler-0.71.0.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..90ee94d0621 |
22 |
--- /dev/null |
23 |
+++ b/sci-libs/gdal/files/gdal-2.3.1-poppler-0.71.0.patch |
24 |
@@ -0,0 +1,82 @@ |
25 |
+Description: Add support for Poppler 0.71.0. |
26 |
+Author: Even Rouault <even.rouault@×××××××××.com> |
27 |
+Origin: https://github.com/OSGeo/gdal/commit/4cc0215b8f2cef3582265cdfaf16589390697706 |
28 |
+Bug: https://github.com/OSGeo/gdal/issues/1121 |
29 |
+Bug-Debian: https://bugs.debian.org/915722 |
30 |
+ |
31 |
+--- a/frmts/pdf/pdfdataset.cpp |
32 |
++++ b/frmts/pdf/pdfdataset.cpp |
33 |
+@@ -2593,18 +2593,25 @@ static void PDFDatasetErrorFunctionCommo |
34 |
+ } |
35 |
+ |
36 |
+ #ifdef POPPLER_0_20_OR_LATER |
37 |
+-static void PDFDatasetErrorFunction(CPL_UNUSED void* userData, CPL_UNUSED ErrorCategory eErrCategory, |
38 |
++ |
39 |
++static void PDFDatasetErrorFunction(void* /* userData*/, |
40 |
++ ErrorCategory /* eErrCategory */, |
41 |
+ #ifdef POPPLER_0_23_OR_LATER |
42 |
+ Goffset nPos, |
43 |
+ #else |
44 |
+ int nPos, |
45 |
+ #endif |
46 |
+- char *pszMsg) |
47 |
++#ifdef POPPLER_0_71_OR_LATER |
48 |
++ const char *pszMsg |
49 |
++#else |
50 |
++ char *pszMsg |
51 |
++#endif |
52 |
++ ) |
53 |
+ { |
54 |
+ CPLString osError; |
55 |
+ |
56 |
+ if (nPos >= 0) |
57 |
+- osError.Printf("Pos = %d, ", (int)nPos); |
58 |
++ osError.Printf("Pos = " CPL_FRMT_GUIB ", ", static_cast<GUIntBig>(nPos)); |
59 |
+ osError += pszMsg; |
60 |
+ PDFDatasetErrorFunctionCommon(osError); |
61 |
+ } |
62 |
+@@ -4442,7 +4449,7 @@ GDALDataset *PDFDataset::Open( GDALOpenI |
63 |
+ #ifdef HAVE_POPPLER |
64 |
+ if (bUseLib.test(PDFLIB_POPPLER)) |
65 |
+ { |
66 |
+- PDFRectangle* psMediaBox = poPagePoppler->getMediaBox(); |
67 |
++ const auto* psMediaBox = poPagePoppler->getMediaBox(); |
68 |
+ dfX1 = psMediaBox->x1; |
69 |
+ dfY1 = psMediaBox->y1; |
70 |
+ dfX2 = psMediaBox->x2; |
71 |
+@@ -4780,14 +4787,12 @@ GDALDataset *PDFDataset::Open( GDALOpenI |
72 |
+ GooString* poMetadata = poCatalogPoppler->readMetadata(); |
73 |
+ if (poMetadata) |
74 |
+ { |
75 |
+- char* pszContent = poMetadata->getCString(); |
76 |
++ const char* pszContent = poMetadata->getCString(); |
77 |
+ if (pszContent != nullptr && |
78 |
+ STARTS_WITH(pszContent, "<?xpacket begin=")) |
79 |
+ { |
80 |
+- char *apszMDList[2]; |
81 |
+- apszMDList[0] = pszContent; |
82 |
+- apszMDList[1] = nullptr; |
83 |
+- poDS->SetMetadata(apszMDList, "xml:XMP"); |
84 |
++ const char * const apszMDList[2] = { pszContent, nullptr }; |
85 |
++ poDS->SetMetadata(const_cast<char**>(apszMDList), "xml:XMP"); |
86 |
+ } |
87 |
+ delete poMetadata; |
88 |
+ } |
89 |
+--- a/frmts/pdf/pdfio.h |
90 |
++++ b/frmts/pdf/pdfio.h |
91 |
+@@ -58,6 +58,15 @@ |
92 |
+ #define makeSubStream_object_type Object* |
93 |
+ #endif |
94 |
+ |
95 |
++// Detect Poppler 0.71 that no longer defines GBool |
96 |
++#ifdef POPPLER_0_69_OR_LATER |
97 |
++#ifndef initObj |
98 |
++#define POPPLER_0_71_OR_LATER |
99 |
++#define GBool bool |
100 |
++#define gFalse false |
101 |
++#endif |
102 |
++#endif |
103 |
++ |
104 |
+ class VSIPDFFileStream: public BaseStream |
105 |
+ { |
106 |
+ public: |
107 |
|
108 |
diff --git a/sci-libs/gdal/files/gdal-2.3.1-poppler-0.72.0.patch b/sci-libs/gdal/files/gdal-2.3.1-poppler-0.72.0.patch |
109 |
new file mode 100644 |
110 |
index 00000000000..3302df9100d |
111 |
--- /dev/null |
112 |
+++ b/sci-libs/gdal/files/gdal-2.3.1-poppler-0.72.0.patch |
113 |
@@ -0,0 +1,58 @@ |
114 |
+From b471814ef406582f2b1bc0aabbe430c0026608c7 Mon Sep 17 00:00:00 2001 |
115 |
+From: Andreas Sturmlechner <andreas.sturmlechner@×××××.com> |
116 |
+Date: Sat, 12 Jan 2019 17:21:54 +0100 |
117 |
+Subject: [PATCH] Fix build with poppler-0.72.0 |
118 |
+ |
119 |
+Non-upstreamable patch that breaks backward compatibility. |
120 |
+--- |
121 |
+ frmts/pdf/pdfdataset.cpp | 4 ++-- |
122 |
+ frmts/pdf/pdfobject.cpp | 4 ++-- |
123 |
+ 2 files changed, 4 insertions(+), 4 deletions(-) |
124 |
+ |
125 |
+diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp |
126 |
+index 84fe1fe..38b8c30 100644 |
127 |
+--- a/frmts/pdf/pdfdataset.cpp |
128 |
++++ b/frmts/pdf/pdfdataset.cpp |
129 |
+@@ -3459,7 +3459,7 @@ void PDFDataset::FindLayersPoppler() |
130 |
+ #endif |
131 |
+ if( ocg != nullptr && ocg->getName() != nullptr ) |
132 |
+ { |
133 |
+- const char* pszLayerName = (const char*)ocg->getName()->getCString(); |
134 |
++ const char* pszLayerName = (const char*)ocg->getName()->c_str(); |
135 |
+ AddLayer(pszLayerName); |
136 |
+ oLayerOCGMapPoppler[pszLayerName] = ocg; |
137 |
+ } |
138 |
+@@ -4787,7 +4787,7 @@ GDALDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo ) |
139 |
+ GooString* poMetadata = poCatalogPoppler->readMetadata(); |
140 |
+ if (poMetadata) |
141 |
+ { |
142 |
+- const char* pszContent = poMetadata->getCString(); |
143 |
++ const char* pszContent = poMetadata->c_str(); |
144 |
+ if (pszContent != nullptr && |
145 |
+ STARTS_WITH(pszContent, "<?xpacket begin=")) |
146 |
+ { |
147 |
+diff --git a/frmts/pdf/pdfobject.cpp b/frmts/pdf/pdfobject.cpp |
148 |
+index 0a5f907..9bed6c1 100644 |
149 |
+--- a/frmts/pdf/pdfobject.cpp |
150 |
++++ b/frmts/pdf/pdfobject.cpp |
151 |
+@@ -1061,7 +1061,7 @@ const CPLString& GDALPDFObjectPoppler::GetString() |
152 |
+ #else |
153 |
+ GooString* gooString = m_po->getString(); |
154 |
+ #endif |
155 |
+- return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->getCString()), |
156 |
++ return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->c_str()), |
157 |
+ static_cast<int>(gooString->getLength()))); |
158 |
+ } |
159 |
+ else |
160 |
+@@ -1422,7 +1422,7 @@ char* GDALPDFStreamPoppler::GetBytes() |
161 |
+ char* pszContent = (char*) VSIMalloc(m_nLength + 1); |
162 |
+ if (pszContent) |
163 |
+ { |
164 |
+- memcpy(pszContent, gstr->getCString(), m_nLength); |
165 |
++ memcpy(pszContent, gstr->c_str(), m_nLength); |
166 |
+ pszContent[m_nLength] = '\0'; |
167 |
+ } |
168 |
+ delete gstr; |
169 |
+-- |
170 |
+2.20.1 |
171 |
+ |
172 |
|
173 |
diff --git a/sci-libs/gdal/gdal-2.3.1.ebuild b/sci-libs/gdal/gdal-2.3.1.ebuild |
174 |
index 317b386da9e..7af0dee0851 100644 |
175 |
--- a/sci-libs/gdal/gdal-2.3.1.ebuild |
176 |
+++ b/sci-libs/gdal/gdal-2.3.1.ebuild |
177 |
@@ -1,4 +1,4 @@ |
178 |
-# Copyright 1999-2018 Gentoo Authors |
179 |
+# Copyright 1999-2019 Gentoo Authors |
180 |
# Distributed under the terms of the GNU General Public License v2 |
181 |
|
182 |
EAPI=6 |
183 |
@@ -83,6 +83,7 @@ PATCHES=( |
184 |
"${FILESDIR}/${PN}-2.2.3-bashcomp-path.patch" # bug 641866 |
185 |
"${FILESDIR}/${PN}-2.3.0-curl.patch" # bug 659840 |
186 |
"${FILESDIR}/${PN}-2.3.1-poppler-0.69.0.patch" |
187 |
+ "${FILESDIR}/${PN}-2.3.1-poppler-0.71.0.patch" # bug 674556 |
188 |
) |
189 |
|
190 |
src_prepare() { |
191 |
@@ -119,6 +120,9 @@ src_prepare() { |
192 |
|
193 |
default |
194 |
|
195 |
+ # not upstreamable, not fixed in 2.4.0 or master as of 2019-01-12: |
196 |
+ has_version ">=app-text/poppler-0.72.0" && eapply "${FILESDIR}/${PN}-2.3.1-poppler-0.72.0.patch" |
197 |
+ |
198 |
eautoreconf |
199 |
} |
200 |
|
201 |
@@ -311,6 +315,7 @@ src_install() { |
202 |
fi |
203 |
|
204 |
doman "${S}"/man/man*/* |
205 |
+ find "${ED}" -name '*.la' -delete || die |
206 |
} |
207 |
|
208 |
pkg_postinst() { |