scons: fixes for bypassing configure checks when HOST is provided (iOS build)

This commit is contained in:
Dane Springmeyer 2013-06-14 11:40:45 -07:00
parent 98d21de168
commit 2505001af1

View file

@ -448,7 +448,8 @@ pickle_store = [# Scons internal variables
'SVG_RENDERER', 'SVG_RENDERER',
'SQLITE_LINKFLAGS', 'SQLITE_LINKFLAGS',
'BOOST_LIB_VERSION_FROM_HEADER', 'BOOST_LIB_VERSION_FROM_HEADER',
'BIGINT' 'BIGINT',
'HOST'
] ]
# Add all other user configurable options to pickle pickle_store # Add all other user configurable options to pickle pickle_store
@ -1259,7 +1260,8 @@ if not preconfigured:
has_boost_devel = False has_boost_devel = False
if has_boost_devel: 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. # The other required boost headers.
BOOST_LIBSHEADERS = [ 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]) color_print(4,'Could not find optional header or shared library for boost %s' % libinfo[0])
env['SKIPPED_DEPS'].append('boost ' + 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 # http://lists.boost.org/Archives/boost/2009/03/150076.php
# we need libicui18n if using static boost libraries, so it is # we need libicui18n if using static boost libraries, so it is
# important to try this check with the library linked # 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'])] env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
SQLITE_HAS_RTREE = None SQLITE_HAS_RTREE = None
if env['HOST']:
SQLITE_HAS_RTREE = True
CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0') CHECK_PKG_CONFIG = conf.CheckPKGConfig('0.15.0')
if len(env['REQUESTED_PLUGINS']): if len(env['REQUESTED_PLUGINS']):
color_print(4,'Checking for requested plugins dependencies...') if env['HOST']:
for plugin in env['REQUESTED_PLUGINS']: for plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin] details = env['PLUGINS'][plugin]
if plugin == 'gdal': if details['lib']:
if conf.parse_config('GDAL_CONFIG',checks='--libs'): env.AppendUnique(LIBS=details['lib'])
conf.parse_config('GDAL_CONFIG',checks='--cflags') else:
libname = conf.get_pkg_lib('GDAL_CONFIG','gdal') color_print(4,'Checking for requested plugins dependencies...')
if libname: for plugin in env['REQUESTED_PLUGINS']:
details['lib'] = libname details = env['PLUGINS'][plugin]
elif plugin == 'postgis': if plugin == 'gdal':
conf.parse_pg_config('PG_CONFIG') if conf.parse_config('GDAL_CONFIG',checks='--libs'):
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') conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','ogr') libname = conf.get_pkg_lib('GDAL_CONFIG','gdal')
if libname: if libname:
details['lib'] = libname details['lib'] = libname
elif details['path'] and details['lib'] and details['inc']: elif plugin == 'postgis':
backup = env.Clone().Dictionary() conf.parse_pg_config('PG_CONFIG')
# Note, the 'delete_existing' keyword makes sure that these paths are prepended elif plugin == 'ogr':
# to the beginning of the path list even if they already exist if conf.ogr_enabled():
incpath = env['%s_INCLUDES' % details['path']] if not 'gdal' in env['REQUESTED_PLUGINS']:
libpath = env['%s_LIBS' % details['path']] conf.parse_config('GDAL_CONFIG',checks='--libs')
env.PrependUnique(CPPPATH = os.path.realpath(incpath),delete_existing=True) conf.parse_config('GDAL_CONFIG',checks='--cflags')
env.PrependUnique(LIBPATH = os.path.realpath(libpath),delete_existing=True) libname = conf.get_pkg_lib('GDAL_CONFIG','ogr')
if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']): if libname:
env.Replace(**backup) details['lib'] = libname
env['SKIPPED_DEPS'].append(details['lib']) elif details['path'] and details['lib'] and details['inc']:
if plugin == 'sqlite': backup = env.Clone().Dictionary()
SQLITE_HAS_RTREE = conf.sqlite_has_rtree() # Note, the 'delete_existing' keyword makes sure that these paths are prepended
sqlite_backup = env.Clone().Dictionary() # to the beginning of the path list even if they already exist
incpath = env['%s_INCLUDES' % details['path']]
# if statically linking, on linux we likely libpath = env['%s_LIBS' % details['path']]
# need to link sqlite to pthreads and dl env.PrependUnique(CPPPATH = os.path.realpath(incpath),delete_existing=True)
if env['RUNTIME_LINK'] == 'static': env.PrependUnique(LIBPATH = os.path.realpath(libpath),delete_existing=True)
if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'): if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']):
sqlite_env = env.Clone() env.Replace(**backup)
try: env['SKIPPED_DEPS'].append(details['lib'])
sqlite_env.ParseConfig('pkg-config --static --libs sqlite3') if plugin == 'sqlite':
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() SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
if not SQLITE_HAS_RTREE: sqlite_backup = env.Clone().Dictionary()
env.Replace(**sqlite_backup) # if statically linking, on linux we likely
if details['lib'] in env['LIBS']: # need to link sqlite to pthreads and dl
env['LIBS'].remove(details['lib']) if env['RUNTIME_LINK'] == 'static':
env['SKIPPED_DEPS'].append('sqlite_rtree') if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'):
else: sqlite_env = env.Clone()
env.Replace(**sqlite_backup) 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'])
elif details['lib'] and details['inc']: # re-append the local paths for mapnik sources to the beginning of the list
if not conf.CheckLibWithHeader(details['lib'], details['inc'], details['lang']): # to make sure they come before any plugins that were 'prepended'
env['SKIPPED_DEPS'].append(details['lib']) env.PrependUnique(CPPPATH = '#include', delete_existing=True)
env.PrependUnique(CPPPATH = '#', delete_existing=True)
env.PrependUnique(LIBPATH = '#src', delete_existing=True)
# re-append the local paths for mapnik sources to the beginning of the list if not env['HOST']:
# to make sure they come before any plugins that were 'prepended' if env['PGSQL2SQLITE']:
env.PrependUnique(CPPPATH = '#include', delete_existing=True) if 'sqlite3' not in env['LIBS']:
env.PrependUnique(CPPPATH = '#', delete_existing=True) env.AppendUnique(LIBS='sqlite3')
env.PrependUnique(LIBPATH = '#src', delete_existing=True) env.AppendUnique(CPPPATH = os.path.realpath(env['SQLITE_INCLUDES']))
env.AppendUnique(LIBPATH = os.path.realpath(env['SQLITE_LIBS']))
if env['PGSQL2SQLITE']: if not SQLITE_HAS_RTREE:
if 'sqlite3' not in env['LIBS']: env['SKIPPED_DEPS'].append('pgsql2sqlite_rtree')
env.AppendUnique(LIBS='sqlite3') env['PGSQL2SQLITE'] = False
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 # we rely on an internal, patched copy of agg with critical fixes
# prepend to make sure we link locally # prepend to make sure we link locally
@ -1591,10 +1600,13 @@ if not preconfigured:
# fetch the mapnik version header in order to set the # fetch the mapnik version header in order to set the
# ABI version used to build libmapnik.so on linux in src/build.py # ABI version used to build libmapnik.so on linux in src/build.py
abi = conf.GetMapnikLibVersion() abi = None
abi_fallback = "3.0.0-pre" abi_fallback = "3.0.0-pre"
if not env['HOST']:
abi = conf.GetMapnikLibVersion()
if not abi: 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 = abi_fallback
abi_no_pre = abi.replace('-pre','').split('.') 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 env['PLUGIN_LINKING'] == 'static' or plugin not in env['REQUESTED_PLUGINS']:
if os.path.exists('plugins/input/%s.input' % plugin): if os.path.exists('plugins/input/%s.input' % plugin):
os.unlink('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] details = env['PLUGINS'][plugin]
if details['lib'] in env['LIBS']: if details['lib'] in env['LIBS']:
if env['PLUGIN_LINKING'] == 'shared': if env['PLUGIN_LINKING'] == 'shared':
@ -1858,26 +1870,25 @@ if not HELP_REQUESTED:
os.unlink(plugin_path) os.unlink(plugin_path)
# Build the c++ rundemo app if requested # Build the c++ rundemo app if requested
if env['DEMO']: if not env['HOST']:
SConscript('demo/c++/build.py') if env['DEMO']:
SConscript('demo/c++/build.py')
# Build shapeindex and remove its dependency from the LIBS # Build shapeindex and remove its dependency from the LIBS
if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']: if not env['HOST']:
if env['SHAPEINDEX']: if 'boost_program_options%s' % env['BOOST_APPEND'] in env['LIBS']:
SConscript('utils/shapeindex/build.py') if env['SHAPEINDEX']:
SConscript('utils/shapeindex/build.py')
# Build the pgsql2psqlite app if requested # Build the pgsql2psqlite app if requested
if env['PGSQL2SQLITE']: if env['PGSQL2SQLITE']:
SConscript('utils/pgsql2sqlite/build.py') SConscript('utils/pgsql2sqlite/build.py')
if env['SVG2PNG']:
if env['SVG2PNG']: SConscript('utils/svg2png/build.py')
SConscript('utils/svg2png/build.py') # devtools not ready for public
#SConscript('utils/ogrindex/build.py')
# devtools not ready for public env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND'])
#SConscript('utils/ogrindex/build.py') else :
env['LIBS'].remove('boost_program_options%s' % env['BOOST_APPEND']) color_print(1,"WARNING: Cannot find boost_program_options. 'shapeindex' and other command line programs will not be available")
else :
color_print(1,"WARNING: Cannot find boost_program_options. 'shapeindex' and other command line programs will not be available")
# Build the Python bindings # Build the Python bindings
if 'python' in env['BINDINGS']: if 'python' in env['BINDINGS']: