From 6ab91b23008c2f978bb666cee2dc6bedfbd90430 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 23 Jan 2015 09:12:11 -0800 Subject: [PATCH] allow manually passing lib/include paths for libxml2 and freetype --- SConstruct | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/SConstruct b/SConstruct index 03f8ee76a..68583d292 100644 --- a/SConstruct +++ b/SConstruct @@ -88,10 +88,11 @@ pretty_dep_names = { 'm':'Basic math library, part of C++ stlib', 'pkg-config':'pkg-config tool | more info: http://pkg-config.freedesktop.org', 'pg_config':'pg_config program | try setting PG_CONFIG SCons option', - 'xml2-config':'xml2-config program | try setting XML2_CONFIG SCons option', - 'libxml2':'libxml2 library | try setting XML2_CONFIG SCons option to point to location of xml2-config program', + '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 or configure with XML2_LIBS & XML2_INCLUDES', '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', '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)', @@ -351,6 +352,10 @@ opts.AddVariables( 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_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',''), # Variables affecting rendering back-ends @@ -1193,7 +1198,21 @@ if not preconfigured: env.AppendUnique(CPPPATH = os.path.realpath(inc_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++'], + ['harfbuzz', 'harfbuzz/hb.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 if env['RUNTIME_LINK'] == 'static': temp_env = env.Clone() @@ -1208,17 +1227,19 @@ 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'): + 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 else: env['MISSING_DEPS'].append('libxml2') - REQUIRED_LIBSHEADERS = [ - ['z', 'zlib.h', True,'C'], - [env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'], - ['harfbuzz', 'harfbuzz/hb.h',True,'C++'] - ] - if conf.CheckHasDlfcn(): env.Append(CPPDEFINES = '-DMAPNIK_HAS_DLCFN') else: