diff --git a/SConstruct b/SConstruct index abde7cb87..e9e747df2 100644 --- a/SConstruct +++ b/SConstruct @@ -85,10 +85,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)', @@ -346,6 +347,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 @@ -1202,12 +1207,26 @@ 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++'], + ] + + 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() temp_env['LIBS'] = [] try: + # TODO - freetype-config accepts --static as of v2.5.3 temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG']) if 'bz2' in temp_env['LIBS']: env['EXTRA_FREETYPE_LIBS'].append('bz2') @@ -1216,16 +1235,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++'], - ] - if conf.CheckHasDlfcn(): env.Append(CPPDEFINES = '-DMAPNIK_HAS_DLCFN') else: @@ -1443,7 +1465,7 @@ if not preconfigured: sqlite_backup = env.Clone().Dictionary() # if statically linking, on linux we likely # 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'): sqlite_env = env.Clone() try: @@ -1453,7 +1475,15 @@ if not preconfigured: env["SQLITE_LINKFLAGS"].append(lib) env.Append(LIBS=lib) 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() if not SQLITE_HAS_RTREE: env.Replace(**sqlite_backup)