-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapnik_patch
392 lines (366 loc) · 17.4 KB
/
mapnik_patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
diff --git a/SConstruct b/SConstruct
index d581389..e823b92 100644
--- a/SConstruct
+++ b/SConstruct
@@ -448,7 +448,8 @@ pickle_store = [# Scons internal variables
'SVG_RENDERER',
'SQLITE_LINKFLAGS',
'BOOST_LIB_VERSION_FROM_HEADER',
- 'BIGINT'
+ 'BIGINT',
+ 'HOST'
]
# Add all other user configurable options to pickle pickle_store
@@ -804,7 +805,7 @@ int main()
if silent:
context.did_show_result=1
context.Result(ret)
- return ret
+ return True
def CheckCairoHasFreetype(context, silent=False):
if not silent:
@@ -872,6 +873,7 @@ int main()
return ret[1].strip()
def icu_at_least_four_two(context):
+ return True
ret = context.TryRun("""
#include <unicode/uversion.h>
@@ -901,6 +903,7 @@ int main()
return False
def boost_regex_has_icu(context):
+ return True
if env['RUNTIME_LINK'] == 'static':
context.env.AppendUnique(LIBS='icudata')
ret = context.TryRun("""
@@ -1172,10 +1175,8 @@ if not preconfigured:
# libxml2 should be optional but is currently not
# https://github.com/mapnik/mapnik/issues/913
- if conf.parse_config('XML2_CONFIG',checks='--cflags'):
- env['HAS_LIBXML2'] = True
- else:
- env['MISSING_DEPS'].append('libxml2')
+ # if conf.parse_config('XML2_CONFIG',checks='--cflags'):
+ env['HAS_LIBXML2'] = True
LIBSHEADERS = [
['z', 'zlib.h', True,'C'],
@@ -1259,7 +1260,8 @@ if not preconfigured:
has_boost_devel = False
if has_boost_devel:
- env['BOOST_LIB_VERSION_FROM_HEADER'] = conf.GetBoostLibVersion()
+ if not env['HOST']:
+ env['BOOST_LIB_VERSION_FROM_HEADER'] = conf.GetBoostLibVersion()
# The other required boost headers.
BOOST_LIBSHEADERS = [
@@ -1303,7 +1305,7 @@ if not preconfigured:
color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0])
env['SKIPPED_DEPS'].append('boost ' + libinfo[0])
- if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
+ if not env['HOST'] and env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
# http://lists.boost.org/Archives/boost/2009/03/150076.php
# we need libicui18n if using static boost libraries, so it is
# important to try this check with the library linked
@@ -1317,85 +1319,92 @@ if not preconfigured:
env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
SQLITE_HAS_RTREE = None
+ if env['HOST']:
+ SQLITE_HAS_RTREE = True
+
CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
if len(env['REQUESTED_PLUGINS']):
- color_print(4,'Checking for requested plugins dependencies...')
- for plugin in env['REQUESTED_PLUGINS']:
- details = env['PLUGINS'][plugin]
- if plugin == 'gdal':
- if conf.parse_config('GDAL_CONFIG',checks='--libs'):
- conf.parse_config('GDAL_CONFIG',checks='--cflags')
- libname = conf.get_pkg_lib('GDAL_CONFIG','gdal')
- if libname:
- details['lib'] = libname
- elif plugin == 'postgis':
- conf.parse_pg_config('PG_CONFIG')
- elif plugin == 'ogr':
- if conf.ogr_enabled():
- if not 'gdal' in env['REQUESTED_PLUGINS']:
- conf.parse_config('GDAL_CONFIG',checks='--libs')
+ if env['HOST']:
+ for plugin in env['REQUESTED_PLUGINS']:
+ details = env['PLUGINS'][plugin]
+ if details['lib']:
+ env.AppendUnique(LIBS=details['lib'])
+ else:
+ color_print(4,'Checking for requested plugins dependencies...')
+ for plugin in env['REQUESTED_PLUGINS']:
+ details = env['PLUGINS'][plugin]
+ if plugin == 'gdal':
+ if conf.parse_config('GDAL_CONFIG',checks='--libs'):
conf.parse_config('GDAL_CONFIG',checks='--cflags')
- libname = conf.get_pkg_lib('GDAL_CONFIG','ogr')
- if libname:
- details['lib'] = libname
- elif details['path'] and details['lib'] and details['inc']:
- backup = env.Clone().Dictionary()
- # Note, the 'delete_existing' keyword makes sure that these paths are prepended
- # to the beginning of the path list even if they already exist
- incpath = env['%s_INCLUDES' % details['path']]
- libpath = env['%s_LIBS' % details['path']]
- env.PrependUnique(CPPPATH = os.path.realpath(incpath),delete_existing=True)
- env.PrependUnique(LIBPATH = os.path.realpath(libpath),delete_existing=True)
- if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
- env.Replace(**backup)
- env['SKIPPED_DEPS'].append(details['lib'])
- if plugin == 'sqlite':
- SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
- sqlite_backup = env.Clone().Dictionary()
-
- # if statically linking, on linux we likely
- # need to link sqlite to pthreads and dl
- if env['RUNTIME_LINK'] == 'static':
- if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'):
- sqlite_env = env.Clone()
- try:
- sqlite_env.ParseConfig('pkg-config --static --libs sqlite3')
- for lib in sqlite_env['LIBS']:
- if not lib in env['LIBS']:
- env["SQLITE_LINKFLAGS"].append(lib)
- env.Append(LIBS=lib)
- except OSError,e:
- pass
-
- if SQLITE_HAS_RTREE is None:
+ libname = conf.get_pkg_lib('GDAL_CONFIG','gdal')
+ if libname:
+ details['lib'] = libname
+ elif plugin == 'postgis':
+ conf.parse_pg_config('PG_CONFIG')
+ elif plugin == 'ogr':
+ if conf.ogr_enabled():
+ if not 'gdal' in env['REQUESTED_PLUGINS']:
+ conf.parse_config('GDAL_CONFIG',checks='--libs')
+ conf.parse_config('GDAL_CONFIG',checks='--cflags')
+ libname = conf.get_pkg_lib('GDAL_CONFIG','ogr')
+ if libname:
+ details['lib'] = libname
+ elif details['path'] and details['lib'] and details['inc']:
+ backup = env.Clone().Dictionary()
+ # Note, the 'delete_existing' keyword makes sure that these paths are prepended
+ # to the beginning of the path list even if they already exist
+ incpath = env['%s_INCLUDES' % details['path']]
+ libpath = env['%s_LIBS' % details['path']]
+ env.PrependUnique(CPPPATH = os.path.realpath(incpath),delete_existing=True)
+ env.PrependUnique(LIBPATH = os.path.realpath(libpath),delete_existing=True)
+ if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
+ env.Replace(**backup)
+ env['SKIPPED_DEPS'].append(details['lib'])
+ if plugin == 'sqlite':
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
- if not SQLITE_HAS_RTREE:
- env.Replace(**sqlite_backup)
- if details['lib'] in env['LIBS']:
- env['LIBS'].remove(details['lib'])
- env['SKIPPED_DEPS'].append('sqlite_rtree')
- else:
- env.Replace(**sqlite_backup)
-
- elif details['lib'] and details['inc']:
- if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
- env['SKIPPED_DEPS'].append(details['lib'])
-
- # re-append the local paths for mapnik sources to the beginning of the list
- # to make sure they come before any plugins that were 'prepended'
- env.PrependUnique(CPPPATH = '#include', delete_existing=True)
- env.PrependUnique(CPPPATH = '#', delete_existing=True)
- env.PrependUnique(LIBPATH = '#src', delete_existing=True)
-
- if env['PGSQL2SQLITE']:
- if 'sqlite3' not in env['LIBS']:
- env.AppendUnique(LIBS='sqlite3')
- env.AppendUnique(CPPPATH = os.path.realpath(env['SQLITE_INCLUDES']))
- env.AppendUnique(LIBPATH = os.path.realpath(env['SQLITE_LIBS']))
- if not SQLITE_HAS_RTREE:
- env['SKIPPED_DEPS'].append('pgsql2sqlite_rtree')
- env['PGSQL2SQLITE'] = False
+ sqlite_backup = env.Clone().Dictionary()
+ # if statically linking, on linux we likely
+ # need to link sqlite to pthreads and dl
+ if env['RUNTIME_LINK'] == 'static':
+ if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'):
+ sqlite_env = env.Clone()
+ try:
+ sqlite_env.ParseConfig('pkg-config --static --libs sqlite3')
+ for lib in sqlite_env['LIBS']:
+ if not lib in env['LIBS']:
+ env["SQLITE_LINKFLAGS"].append(lib)
+ env.Append(LIBS=lib)
+ except OSError,e:
+ pass
+ if SQLITE_HAS_RTREE is None:
+ SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
+ if not SQLITE_HAS_RTREE:
+ env.Replace(**sqlite_backup)
+ if details['lib'] in env['LIBS']:
+ env['LIBS'].remove(details['lib'])
+ env['SKIPPED_DEPS'].append('sqlite_rtree')
+ else:
+ env.Replace(**sqlite_backup)
+ elif details['lib'] and details['inc']:
+ if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
+ env['SKIPPED_DEPS'].append(details['lib'])
+
+ # re-append the local paths for mapnik sources to the beginning of the list
+ # to make sure they come before any plugins that were 'prepended'
+ env.PrependUnique(CPPPATH = '#include', delete_existing=True)
+ env.PrependUnique(CPPPATH = '#', delete_existing=True)
+ env.PrependUnique(LIBPATH = '#src', delete_existing=True)
+
+ if not env['HOST']:
+ if env['PGSQL2SQLITE']:
+ if 'sqlite3' not in env['LIBS']:
+ env.AppendUnique(LIBS='sqlite3')
+ env.AppendUnique(CPPPATH = os.path.realpath(env['SQLITE_INCLUDES']))
+ env.AppendUnique(LIBPATH = os.path.realpath(env['SQLITE_LIBS']))
+ if not SQLITE_HAS_RTREE:
+ env['SKIPPED_DEPS'].append('pgsql2sqlite_rtree')
+ env['PGSQL2SQLITE'] = False
# we rely on an internal, patched copy of agg with critical fixes
# prepend to make sure we link locally
@@ -1591,10 +1600,13 @@ if not preconfigured:
# fetch the mapnik version header in order to set the
# ABI version used to build libmapnik.so on linux in src/build.py
- abi = conf.GetMapnikLibVersion()
+ abi = None
abi_fallback = "2.2.0"
+ if not env['HOST']:
+ abi = conf.GetMapnikLibVersion()
if not abi:
- color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback)
+ if not env['HOST']:
+ color_print(1,'Problem encountered parsing mapnik version, falling back to %s' % abi_fallback)
abi = abi_fallback
abi_no_pre = abi.replace('-pre','').split('.')
@@ -1818,7 +1830,7 @@ if not HELP_REQUESTED:
if env['PLUGIN_LINKING'] == 'static' or plugin not in env['REQUESTED_PLUGINS']:
if os.path.exists('plugins/input/%s.input' % plugin):
os.unlink('plugins/input/%s.input' % plugin)
- if plugin in env['REQUESTED_PLUGINS']:
+ elif plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin]
if details['lib'] in env['LIBS']:
if env['PLUGIN_LINKING'] == 'shared':
@@ -1858,26 +1870,25 @@ if not HELP_REQUESTED:
os.unlink(plugin_path)
# Build the c++ rundemo app if requested
- if env['DEMO']:
- SConscript('demo/c++/build.py')
+ if not env['HOST']:
+ if env['DEMO']:
+ SConscript('demo/c++/build.py')
# Build shapeindex and remove its dependency from the LIBS
- if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
- if env['SHAPEINDEX']:
- SConscript('utils/shapeindex/build.py')
-
- # Build the pgsql2psqlite app if requested
- if env['PGSQL2SQLITE']:
- SConscript('utils/pgsql2sqlite/build.py')
-
- if env['SVG2PNG']:
- SConscript('utils/svg2png/build.py')
-
- # devtools not ready for public
- #SConscript('utils/ogrindex/build.py')
- env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
- else :
- color_print(1,"WARNING: Cannot find boost_program_options. 'shapeindex' and other command line programs will not be available")
+ if not env['HOST']:
+ if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
+ if env['SHAPEINDEX']:
+ SConscript('utils/shapeindex/build.py')
+ # Build the pgsql2psqlite app if requested
+ if env['PGSQL2SQLITE']:
+ SConscript('utils/pgsql2sqlite/build.py')
+ if env['SVG2PNG']:
+ SConscript('utils/svg2png/build.py')
+ # devtools not ready for public
+ #SConscript('utils/ogrindex/build.py')
+ env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
+ else :
+ color_print(1,"WARNING: Cannot find boost_program_options. 'shapeindex' and other command line programs will not be available")
# Build the Python bindings
if 'python' in env['BINDINGS']:
diff --git a/bindings/python/mapnik_datasource.cpp b/bindings/python/mapnik_datasource.cpp
index 07383b3..85e2ff7 100644
--- a/bindings/python/mapnik_datasource.cpp
+++ b/bindings/python/mapnik_datasource.cpp
@@ -61,7 +61,11 @@ boost::shared_ptr<mapnik::datasource> create_datasource(dict const& d)
PyObject* temp = PyUnicode_AsUTF8String(obj.ptr());
if (temp)
{
+#if PY_VERSION_HEX >= 0x03000000
+ char* c_str = PyBytes_AsString(temp);
+#else
char* c_str = PyString_AsString(temp);
+#endif
params[key] = std::string(c_str);
Py_DecRef(temp);
}
diff --git a/plugins/input/csv/build.py b/plugins/input/csv/build.py
index 001537b..ad766e0 100644
--- a/plugins/input/csv/build.py
+++ b/plugins/input/csv/build.py
@@ -21,12 +21,11 @@
Import ('env')
-can_build = False
-
+can_build = True
if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
- if boost_version_from_header >= 47:
- can_build = True
+ if boost_version_from_header < 47:
+ can_build = False
if not can_build:
print 'WARNING: skipping building the optional geojson datasource plugin which requires boost >= 1.47'
diff --git a/plugins/input/geojson/build.py b/plugins/input/geojson/build.py
index 73aeb12..f8b2bff 100644
--- a/plugins/input/geojson/build.py
+++ b/plugins/input/geojson/build.py
@@ -21,12 +21,11 @@
Import ('env')
-can_build = False
-
+can_build = True
if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
- if boost_version_from_header >= 47:
- can_build = True
+ if boost_version_from_header < 47:
+ can_build = False
if not can_build:
print 'WARNING: skipping building the optional geojson datasource plugin which requires boost >= 1.47'
diff --git a/plugins/input/shape/build.py b/plugins/input/shape/build.py
index 3d07be2..a55a99e 100644
--- a/plugins/input/shape/build.py
+++ b/plugins/input/shape/build.py
@@ -40,6 +40,7 @@ plugin_sources = Split(
# Link Library to Dependencies
libraries = []
libraries.append(env['ICU_LIB_NAME'])
+libraries.append('icudata')
libraries.append('boost_system%s' % env['BOOST_APPEND'])
cppdefines = []
diff --git a/src/build.py b/src/build.py
index 051729a..64a10d1 100644
--- a/src/build.py
+++ b/src/build.py
@@ -206,6 +206,12 @@ source = Split(
xml_tree.cpp
config_error.cpp
color_factory.cpp
+ ../plugins/input/shape/dbfile.cpp
+ ../plugins/input/shape/shape_datasource.cpp
+ ../plugins/input/shape/shape_featureset.cpp
+ ../plugins/input/shape/shape_index_featureset.cpp
+ ../plugins/input/shape/shape_io.cpp
+ ../plugins/input/shape/shape_utils.cpp
"""
)