scons: fix sqlite_rtree check + support configuring freetype and xml2 without config scripts
This commit is contained in:
parent
1c3a958205
commit
0a6beede62
1 changed files with 42 additions and 12 deletions
54
SConstruct
54
SConstruct
|
@ -85,10 +85,11 @@ pretty_dep_names = {
|
||||||
'm':'Basic math library, part of C++ stlib',
|
'm':'Basic math library, part of C++ stlib',
|
||||||
'pkg-config':'pkg-config tool | more info: http://pkg-config.freedesktop.org',
|
'pkg-config':'pkg-config tool | more info: http://pkg-config.freedesktop.org',
|
||||||
'pg_config':'pg_config program | try setting PG_CONFIG SCons option',
|
'pg_config':'pg_config program | try setting PG_CONFIG SCons option',
|
||||||
'xml2-config':'xml2-config program | try setting XML2_CONFIG SCons option',
|
'xml2-config':'xml2-config program | try setting XML2_CONFIG SCons option or avoid the need for xml2-config command by configuring with XML2_LIBS & XML2_INCLUDES',
|
||||||
'libxml2':'libxml2 library | try setting XML2_CONFIG SCons option to point to location of xml2-config program',
|
'libxml2':'libxml2 library | try setting XML2_CONFIG SCons option to point to location of xml2-config program or configure with XML2_LIBS & XML2_INCLUDES',
|
||||||
'gdal-config':'gdal-config program | try setting GDAL_CONFIG SCons option',
|
'gdal-config':'gdal-config program | try setting GDAL_CONFIG SCons option',
|
||||||
'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option',
|
'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option or configure with FREETYPE_LIBS & FREETYPE_INCLUDES',
|
||||||
|
'freetype':'libfreetype library | try setting FREETYPE_CONFIG SCons option or configure with FREETYPE_LIBS & FREETYPE_INCLUDES',
|
||||||
'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin',
|
||||||
'boost_regex_icu':'libboost_regex built with optional ICU unicode support is needed for unicode regex support in mapnik.',
|
'boost_regex_icu':'libboost_regex built with optional ICU unicode support is needed for unicode regex support in mapnik.',
|
||||||
'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)',
|
'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)',
|
||||||
|
@ -346,6 +347,10 @@ opts.AddVariables(
|
||||||
BoolVariable('PROJ', 'Build Mapnik with proj4 support to enable transformations between many different projections', 'True'),
|
BoolVariable('PROJ', 'Build Mapnik with proj4 support to enable transformations between many different projections', 'True'),
|
||||||
PathVariable('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/include', PathVariable.PathAccept),
|
PathVariable('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/include', PathVariable.PathAccept),
|
||||||
PathVariable('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
PathVariable('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||||
|
('FREETYPE_INCLUDES', 'Search path for Freetype include files', ''),
|
||||||
|
('FREETYPE_LIBS', 'Search path for Freetype library files', ''),
|
||||||
|
('XML2_INCLUDES', 'Search path for libxml2 include files', ''),
|
||||||
|
('XML2_LIBS', 'Search path for libxml2 library files', ''),
|
||||||
('PKG_CONFIG_PATH', 'Use this path to point pkg-config to .pc files instead of the PKG_CONFIG_PATH environment setting',''),
|
('PKG_CONFIG_PATH', 'Use this path to point pkg-config to .pc files instead of the PKG_CONFIG_PATH environment setting',''),
|
||||||
|
|
||||||
# Variables affecting rendering back-ends
|
# Variables affecting rendering back-ends
|
||||||
|
@ -1202,12 +1207,26 @@ if not preconfigured:
|
||||||
env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
|
env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
|
||||||
env.AppendUnique(LIBPATH = os.path.realpath(lib_path))
|
env.AppendUnique(LIBPATH = os.path.realpath(lib_path))
|
||||||
|
|
||||||
if conf.parse_config('FREETYPE_CONFIG'):
|
REQUIRED_LIBSHEADERS = [
|
||||||
|
['z', 'zlib.h', True,'C'],
|
||||||
|
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
|
||||||
|
]
|
||||||
|
|
||||||
|
if env.get('FREETYPE_LIBS') or env.get('FREETYPE_INCLUDES'):
|
||||||
|
REQUIRED_LIBSHEADERS.append(['freetype','ft2build.h',True,'C'])
|
||||||
|
if env.get('FREETYPE_INCLUDES'):
|
||||||
|
inc_path = env['FREETYPE_INCLUDES']
|
||||||
|
env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
|
||||||
|
if env.get('FREETYPE_LIBS'):
|
||||||
|
lib_path = env['FREETYPE_LIBS']
|
||||||
|
env.AppendUnique(LIBPATH = os.path.realpath(lib_path))
|
||||||
|
elif conf.parse_config('FREETYPE_CONFIG'):
|
||||||
# check if freetype links to bz2
|
# check if freetype links to bz2
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
if env['RUNTIME_LINK'] == 'static':
|
||||||
temp_env = env.Clone()
|
temp_env = env.Clone()
|
||||||
temp_env['LIBS'] = []
|
temp_env['LIBS'] = []
|
||||||
try:
|
try:
|
||||||
|
# TODO - freetype-config accepts --static as of v2.5.3
|
||||||
temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG'])
|
temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG'])
|
||||||
if 'bz2' in temp_env['LIBS']:
|
if 'bz2' in temp_env['LIBS']:
|
||||||
env['EXTRA_FREETYPE_LIBS'].append('bz2')
|
env['EXTRA_FREETYPE_LIBS'].append('bz2')
|
||||||
|
@ -1216,16 +1235,19 @@ if not preconfigured:
|
||||||
|
|
||||||
# libxml2 should be optional but is currently not
|
# libxml2 should be optional but is currently not
|
||||||
# https://github.com/mapnik/mapnik/issues/913
|
# https://github.com/mapnik/mapnik/issues/913
|
||||||
if conf.parse_config('XML2_CONFIG',checks='--cflags'):
|
if env.get('XML2_LIBS') or env.get('XML2_INCLUDES'):
|
||||||
|
REQUIRED_LIBSHEADERS.append(['libxml2','libxml/parser.h',True,'C'])
|
||||||
|
if env.get('XML2_INCLUDES'):
|
||||||
|
inc_path = env['XML2_INCLUDES']
|
||||||
|
env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
|
||||||
|
if env.get('XML2_LIBS'):
|
||||||
|
lib_path = env['XML2_LIBS']
|
||||||
|
env.AppendUnique(LIBPATH = os.path.realpath(lib_path))
|
||||||
|
elif conf.parse_config('XML2_CONFIG',checks='--cflags'):
|
||||||
env['HAS_LIBXML2'] = True
|
env['HAS_LIBXML2'] = True
|
||||||
else:
|
else:
|
||||||
env['MISSING_DEPS'].append('libxml2')
|
env['MISSING_DEPS'].append('libxml2')
|
||||||
|
|
||||||
REQUIRED_LIBSHEADERS = [
|
|
||||||
['z', 'zlib.h', True,'C'],
|
|
||||||
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
|
|
||||||
]
|
|
||||||
|
|
||||||
if conf.CheckHasDlfcn():
|
if conf.CheckHasDlfcn():
|
||||||
env.Append(CPPDEFINES = '-DMAPNIK_HAS_DLCFN')
|
env.Append(CPPDEFINES = '-DMAPNIK_HAS_DLCFN')
|
||||||
else:
|
else:
|
||||||
|
@ -1443,7 +1465,7 @@ if not preconfigured:
|
||||||
sqlite_backup = env.Clone().Dictionary()
|
sqlite_backup = env.Clone().Dictionary()
|
||||||
# if statically linking, on linux we likely
|
# if statically linking, on linux we likely
|
||||||
# need to link sqlite to pthreads and dl
|
# need to link sqlite to pthreads and dl
|
||||||
if env['RUNTIME_LINK'] == 'static':
|
if env['RUNTIME_LINK'] == 'static' and not env['PLATFORM'] == 'Darwin':
|
||||||
if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'):
|
if CHECK_PKG_CONFIG and conf.CheckPKG('sqlite3'):
|
||||||
sqlite_env = env.Clone()
|
sqlite_env = env.Clone()
|
||||||
try:
|
try:
|
||||||
|
@ -1453,7 +1475,15 @@ if not preconfigured:
|
||||||
env["SQLITE_LINKFLAGS"].append(lib)
|
env["SQLITE_LINKFLAGS"].append(lib)
|
||||||
env.Append(LIBS=lib)
|
env.Append(LIBS=lib)
|
||||||
except OSError,e:
|
except OSError,e:
|
||||||
pass
|
for lib in ["sqlite3","dl","pthread"]:
|
||||||
|
if not lib in env['LIBS']:
|
||||||
|
env["SQLITE_LINKFLAGS"].append("lib")
|
||||||
|
env.Append(LIBS=lib)
|
||||||
|
else:
|
||||||
|
for lib in ["sqlite3","dl","pthread"]:
|
||||||
|
if not lib in env['LIBS']:
|
||||||
|
env["SQLITE_LINKFLAGS"].append("lib")
|
||||||
|
env.Append(LIBS=lib)
|
||||||
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
|
SQLITE_HAS_RTREE = conf.sqlite_has_rtree()
|
||||||
if not SQLITE_HAS_RTREE:
|
if not SQLITE_HAS_RTREE:
|
||||||
env.Replace(**sqlite_backup)
|
env.Replace(**sqlite_backup)
|
||||||
|
|
Loading…
Reference in a new issue