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:
Dane Springmeyer 2013-06-02 14:56:21 -07:00
parent c5f01be4e2
commit ef1b99532b
3 changed files with 72 additions and 53 deletions

View file

@ -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']:

View file

@ -19,25 +19,36 @@
#
#
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(
if not can_build:
print 'WARNING: skipping building the optional geojson datasource plugin which requires boost >= 1.47'
else:
Import ('plugin_base')
PLUGIN_NAME = 'csv'
plugin_env = plugin_base.Clone()
plugin_sources = Split(
"""
%(PLUGIN_NAME)s_datasource.cpp
""" % locals()
)
)
# Link Library to Dependencies
libraries = []
libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.append(env['ICU_LIB_NAME'])
# Link Library to Dependencies
libraries = []
libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.append(env['ICU_LIB_NAME'])
if env['PLUGIN_LINKING'] == 'shared':
if env['PLUGIN_LINKING'] == 'shared':
libraries.append('mapnik')
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
@ -54,9 +65,9 @@ if env['PLUGIN_LINKING'] == 'shared':
env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET)
env.Alias('install', env['MAPNIK_INPUT_PLUGINS_DEST'])
plugin_obj = {
plugin_obj = {
'LIBS': libraries,
'SOURCES': plugin_sources,
}
}
Return('plugin_obj')
Return('plugin_obj')

View file

@ -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,12 +213,15 @@ 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']:
plugin_env = SConscript('../plugins/input/%s/build.py' % plugin)
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)
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']: