From e84119aed984b0b4ed9ea4485771f05c9aa47249 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 5 Jul 2011 23:41:17 +0000 Subject: [PATCH] directly link libmapnik in plugins (not just darwin) - patch from Stella L. - closes #790 --- AUTHORS | 1 + CHANGELOG | 2 ++ bindings/python/mapnik/__init__.py | 15 --------------- plugins/input/gdal/SConscript | 11 +++++------ plugins/input/geos/SConscript | 15 +++++++-------- plugins/input/kismet/SConscript | 13 ++++++------- plugins/input/occi/SConscript | 10 ++++------ plugins/input/ogr/SConscript | 15 +++++++-------- plugins/input/osm/SConscript | 10 ++++------ plugins/input/postgis/SConscript | 15 +++++++-------- plugins/input/raster/SConscript | 15 +++++++-------- plugins/input/rasterlite/SConscript | 15 +++++++-------- plugins/input/shape/SConscript | 15 +++++++-------- plugins/input/sqlite/SConscript | 16 ++++++++-------- 14 files changed, 72 insertions(+), 96 deletions(-) diff --git a/AUTHORS b/AUTHORS index ea5ea15ce..5b1a4638b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,6 +39,7 @@ Patches - Aubrey Holland - Konstantin Käfer - Mak Kolybabi + - Stella Laurenzo - Dennis Luxen - Tom MacWright - Michal Migurski diff --git a/CHANGELOG b/CHANGELOG index 3ca6f42ce..828a9afe8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,8 @@ For a complete change history, see the SVN log. Mapnik Trunk ------------ +- Directly link input plugins to libmapnik to avoid having to set dlopen flags from binding languages (#790) + - Throw an error during registration for fonts which Freetype2 does not report a family or style name (r2985). - Fixed quoting syntax for "table"."attribute" in PostGIS plugin (previously if table aliases were used quoting like "table.attribute" would cause query failure) (r2979). diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py index 2454b8c3f..d04c68b2e 100644 --- a/bindings/python/mapnik/__init__.py +++ b/bindings/python/mapnik/__init__.py @@ -43,18 +43,6 @@ import os import sys import warnings -try: - from ctypes import RTLD_NOW, RTLD_GLOBAL -except ImportError: - try: - from DLFCN import RTLD_NOW, RTLD_GLOBAL - except ImportError: - RTLD_NOW = 2 - RTLD_GLOBAL = 256 - -flags = sys.getdlopenflags() -sys.setdlopenflags(RTLD_NOW | RTLD_GLOBAL) - from _mapnik2 import * from paths import inputpluginspath, fontscollectionpath @@ -660,9 +648,6 @@ def register_fonts(path=fontscollectionpath,valid_extensions=['.ttf','.otf','.tt register_plugins() register_fonts() -#set dlopen flags back to the original -sys.setdlopenflags(flags) - # Explicitly export API members to avoid namespace pollution # and ensure correct documentation processing __all__ = [ diff --git a/plugins/input/gdal/SConscript b/plugins/input/gdal/SConscript index dd910463a..c64f88c82 100644 --- a/plugins/input/gdal/SConscript +++ b/plugins/input/gdal/SConscript @@ -35,15 +35,14 @@ gdal_src = Split( libraries = [env['PLUGINS']['gdal']['lib']] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) input_plugin = plugin_env.SharedLibrary('../gdal', source=gdal_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/geos/SConscript b/plugins/input/geos/SConscript index 8bb1c0e5b..4d509734a 100644 --- a/plugins/input/geos/SConscript +++ b/plugins/input/geos/SConscript @@ -36,17 +36,16 @@ geos_src = Split( libraries = [env['PLUGINS']['geos']['lib']] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_system%s' % env['BOOST_APPEND']) - libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../geos', source=geos_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/kismet/SConscript b/plugins/input/kismet/SConscript index 400e46825..08198b54d 100644 --- a/plugins/input/kismet/SConscript +++ b/plugins/input/kismet/SConscript @@ -34,16 +34,15 @@ kismet_src = Split( ) libraries = [] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_thread%s' % env['BOOST_APPEND']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +libraries.append('boost_thread%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../kismet', source=kismet_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/occi/SConscript b/plugins/input/occi/SConscript index 13df7cb04..d81437c57 100644 --- a/plugins/input/occi/SConscript +++ b/plugins/input/occi/SConscript @@ -37,15 +37,13 @@ occi_src = Split( ) libraries = [ 'occi', 'ociei' ] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) input_plugin = plugin_env.SharedLibrary('../occi', source=occi_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/ogr/SConscript b/plugins/input/ogr/SConscript index a1662d5bd..d0eaa01ae 100644 --- a/plugins/input/ogr/SConscript +++ b/plugins/input/ogr/SConscript @@ -38,17 +38,16 @@ ogr_src = Split( libraries = [env['PLUGINS']['ogr']['lib']] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_system%s' % env['BOOST_APPEND']) - libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../ogr', source=ogr_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/osm/SConscript b/plugins/input/osm/SConscript index 82f606820..26a9ecbd7 100644 --- a/plugins/input/osm/SConscript +++ b/plugins/input/osm/SConscript @@ -39,15 +39,13 @@ osm_src = Split( libraries = [ 'xml2' ] libraries.append('curl') -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) input_plugin = plugin_env.SharedLibrary('../osm', source=osm_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/postgis/SConscript b/plugins/input/postgis/SConscript index efc73ec58..f92ff019d 100644 --- a/plugins/input/postgis/SConscript +++ b/plugins/input/postgis/SConscript @@ -35,17 +35,16 @@ postgis_src = Split( libraries = ['pq'] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - if env['THREADING'] == 'multi': - libraries.append('boost_thread%s' % env['BOOST_APPEND']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +if env['THREADING'] == 'multi': + libraries.append('boost_thread%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/raster/SConscript b/plugins/input/raster/SConscript index bb66cfc00..84285d10f 100644 --- a/plugins/input/raster/SConscript +++ b/plugins/input/raster/SConscript @@ -35,17 +35,16 @@ raster_src = Split( ) libraries = [] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_system%s' % env['BOOST_APPEND']) - libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../raster', source=raster_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/rasterlite/SConscript b/plugins/input/rasterlite/SConscript index aed0fe784..7cf3cf28f 100644 --- a/plugins/input/rasterlite/SConscript +++ b/plugins/input/rasterlite/SConscript @@ -35,17 +35,16 @@ rasterlite_src = Split( libraries = [env['PLUGINS']['rasterlite']['lib']] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_system%s' % env['BOOST_APPEND']) - libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../rasterlite', source=rasterlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/shape/SConscript b/plugins/input/shape/SConscript index 10f42f450..c1077c69d 100644 --- a/plugins/input/shape/SConscript +++ b/plugins/input/shape/SConscript @@ -39,20 +39,19 @@ shape_src = Split( libraries = [] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_system%s' % env['BOOST_APPEND']) - libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) if env['SHAPE_MEMORY_MAPPED_FILE']: plugin_env.Append(CXXFLAGS = '-DSHAPE_MEMORY_MAPPED_FILE') input_plugin = plugin_env.SharedLibrary('../shape', SHLIBSUFFIX='.input', source=shape_src, SHLIBPREFIX='', LIBS = libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin) diff --git a/plugins/input/sqlite/SConscript b/plugins/input/sqlite/SConscript index d36118e91..938a1b1f0 100644 --- a/plugins/input/sqlite/SConscript +++ b/plugins/input/sqlite/SConscript @@ -34,17 +34,17 @@ sqlite_src = Split( ) libraries = [ 'sqlite3' ] -if env['PLATFORM'] == 'Darwin': - libraries.append('mapnik2') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_system%s' % env['BOOST_APPEND']) - libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) + +# Link Library to Dependencies +libraries.append('mapnik2') +libraries.append(env['ICU_LIB_NAME']) +libraries.append('boost_system%s' % env['BOOST_APPEND']) +libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../sqlite', source=sqlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -if env['PLATFORM'] == 'Darwin': - # if the plugin links to libmapnik2 ensure it is built first - Depends(input_plugin,'../../../src/libmapnik2.dylib') +# if the plugin links to libmapnik2 ensure it is built first +Depends(input_plugin, env.subst('../../../src/${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + env['LIB_DIR_NAME'] + '/input', input_plugin)