scons: fix boost_regex and sqlite_rtree config checks and be resilient to plugins that cannot be built due to the boost version
This commit is contained in:
parent
c5f01be4e2
commit
ef1b99532b
3 changed files with 72 additions and 53 deletions
11
SConstruct
11
SConstruct
|
@ -902,8 +902,7 @@ int main()
|
|||
|
||||
def boost_regex_has_icu(context):
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
context.env.Append(LIBS='icui18n')
|
||||
context.env.Append(LIBS='icudata')
|
||||
context.env.AppendUnique(LIBS='icudata')
|
||||
ret = context.TryRun("""
|
||||
|
||||
#include <boost/regex/icu.hpp>
|
||||
|
@ -1299,6 +1298,9 @@ if not preconfigured:
|
|||
|
||||
if 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
|
||||
env.AppendUnique(LIBS='icui18n')
|
||||
if conf.boost_regex_has_icu():
|
||||
# TODO - should avoid having this be globally defined...
|
||||
env.Append(CPPDEFINES = '-DBOOST_REGEX_HAS_ICU')
|
||||
|
@ -1307,7 +1309,7 @@ if not preconfigured:
|
|||
|
||||
env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
|
||||
|
||||
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
|
||||
SQLITE_HAS_RTREE = None
|
||||
CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
|
||||
|
||||
if len(env['REQUESTED_PLUGINS']):
|
||||
|
@ -1342,6 +1344,7 @@ if not preconfigured:
|
|||
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
|
||||
|
@ -1358,6 +1361,8 @@ if not preconfigured:
|
|||
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']:
|
||||
|
|
|
@ -19,44 +19,55 @@
|
|||
#
|
||||
#
|
||||
|
||||
Import ('plugin_base')
|
||||
Import ('env')
|
||||
|
||||
PLUGIN_NAME = 'csv'
|
||||
can_build = False
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
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
|
||||
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
""" % locals()
|
||||
)
|
||||
if not can_build:
|
||||
print 'WARNING: skipping building the optional geojson datasource plugin which requires boost >= 1.47'
|
||||
else:
|
||||
Import ('plugin_base')
|
||||
|
||||
# Link Library to Dependencies
|
||||
libraries = []
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
PLUGIN_NAME = 'csv'
|
||||
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env.get('CUSTOM_LDFLAGS'))
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
""" % locals()
|
||||
)
|
||||
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
# Link Library to Dependencies
|
||||
libraries = []
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
source=plugin_sources,
|
||||
LIBS=libraries,
|
||||
LINKFLAGS=env.get('CUSTOM_LDFLAGS'))
|
||||
|
||||
Return('plugin_obj')
|
||||
# if the plugin links to libmapnik ensure it is built first
|
||||
Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
if 'uninstall' not in COMMAND_LINE_TARGETS:
|
||||
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
|
||||
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
|
||||
|
||||
plugin_obj = {
|
||||
'LIBS': libraries,
|
||||
'SOURCES': plugin_sources,
|
||||
}
|
||||
|
||||
Return('plugin_obj')
|
||||
|
|
43
src/build.py
43
src/build.py
|
@ -74,17 +74,17 @@ if env['TIFF']:
|
|||
if len(env['EXTRA_FREETYPE_LIBS']):
|
||||
lib_env['LIBS'].extend(copy(env['EXTRA_FREETYPE_LIBS']))
|
||||
|
||||
# libxml2 should be optional but is currently not
|
||||
# https://github.com/mapnik/mapnik/issues/913
|
||||
lib_env['LIBS'].append('xml2')
|
||||
|
||||
if env['THREADING'] == 'multi':
|
||||
lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND'])
|
||||
|
||||
if '-DBOOST_REGEX_HAS_ICU' in env['CPPDEFINES']:
|
||||
lib_env['LIBS'].append('icui18n')
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
if 'icuuc' in env['ICU_LIB_NAME']:
|
||||
lib_env['LIBS'].append('icudata')
|
||||
lib_env['LIBS'].append('icui18n')
|
||||
else:
|
||||
lib_env['LIBS'].insert(0, 'agg')
|
||||
|
||||
|
@ -213,24 +213,27 @@ if env['PLUGIN_LINKING'] == 'static':
|
|||
for plugin in env['REQUESTED_PLUGINS']:
|
||||
details = env['PLUGINS'][plugin]
|
||||
if details['lib'] in env['LIBS'] or not details['lib']:
|
||||
hit = True
|
||||
DEF = '-DMAPNIK_STATIC_PLUGIN_%s' % plugin.upper()
|
||||
lib_env.Append(CPPDEFINES = DEF)
|
||||
if DEF not in libmapnik_defines:
|
||||
libmapnik_defines.append(DEF)
|
||||
plugin_env = SConscript('../plugins/input/%s/build.py' % plugin)
|
||||
if plugin_env.has_key('SOURCES') and plugin_env['SOURCES']:
|
||||
source += ['../plugins/input/%s/%s' % (plugin, src) for src in plugin_env['SOURCES']]
|
||||
if plugin_env.has_key('CPPDEFINES') and plugin_env['CPPDEFINES']:
|
||||
lib_env.AppendUnique(CPPDEFINES=plugin_env['CPPDEFINES'])
|
||||
if plugin_env.has_key('CXXFLAGS') and plugin_env['CXXFLAGS']:
|
||||
lib_env.AppendUnique(CXXFLAGS=plugin_env['CXXFLAGS'])
|
||||
if plugin_env.has_key('LINKFLAGS') and plugin_env['LINKFLAGS']:
|
||||
lib_env.AppendUnique(LINKFLAGS=plugin_env['LINKFLAGS'])
|
||||
if plugin_env.has_key('CPPPATH') and plugin_env['CPPPATH']:
|
||||
lib_env.AppendUnique(CPPPATH=copy(plugin_env['CPPPATH']))
|
||||
if plugin_env.has_key('LIBS') and plugin_env['LIBS']:
|
||||
lib_env.AppendUnique(LIBS=plugin_env['LIBS'])
|
||||
if not plugin_env:
|
||||
print("Notice: no 'plugin_env' variable found for plugin: '%s'" % plugin)
|
||||
else:
|
||||
hit = True
|
||||
DEF = '-DMAPNIK_STATIC_PLUGIN_%s' % plugin.upper()
|
||||
lib_env.Append(CPPDEFINES = DEF)
|
||||
if DEF not in libmapnik_defines:
|
||||
libmapnik_defines.append(DEF)
|
||||
if plugin_env.has_key('SOURCES') and plugin_env['SOURCES']:
|
||||
source += ['../plugins/input/%s/%s' % (plugin, src) for src in plugin_env['SOURCES']]
|
||||
if plugin_env.has_key('CPPDEFINES') and plugin_env['CPPDEFINES']:
|
||||
lib_env.AppendUnique(CPPDEFINES=plugin_env['CPPDEFINES'])
|
||||
if plugin_env.has_key('CXXFLAGS') and plugin_env['CXXFLAGS']:
|
||||
lib_env.AppendUnique(CXXFLAGS=plugin_env['CXXFLAGS'])
|
||||
if plugin_env.has_key('LINKFLAGS') and plugin_env['LINKFLAGS']:
|
||||
lib_env.AppendUnique(LINKFLAGS=plugin_env['LINKFLAGS'])
|
||||
if plugin_env.has_key('CPPPATH') and plugin_env['CPPPATH']:
|
||||
lib_env.AppendUnique(CPPPATH=copy(plugin_env['CPPPATH']))
|
||||
if plugin_env.has_key('LIBS') and plugin_env['LIBS']:
|
||||
lib_env.AppendUnique(LIBS=plugin_env['LIBS'])
|
||||
else:
|
||||
print("Notice: dependencies not met for plugin '%s', not building..." % plugin)
|
||||
if hit:
|
||||
|
|
Loading…
Reference in a new issue