From d0b357cab73442771f5e2c4d3f32dd5a5391cb90 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 9 Jun 2014 13:55:56 -0700 Subject: [PATCH] scons: support MAPNIK_NAME option to customize libmapnik name for custom packaging --- SConstruct | 5 +++-- benchmark/build.py | 2 +- bin/build.py | 2 +- bindings/python/build.py | 8 ++++---- bindings/python/mapnik/__init__.py | 2 +- demo/c++/build.py | 2 +- plugins/input/csv/build.py | 2 +- plugins/input/gdal/build.py | 2 +- plugins/input/geojson/build.py | 2 +- plugins/input/occi/build.py | 2 +- plugins/input/ogr/build.py | 2 +- plugins/input/osm/build.py | 2 +- plugins/input/postgis/build.py | 2 +- plugins/input/python/build.py | 2 +- plugins/input/raster/build.py | 2 +- plugins/input/rasterlite/build.py | 2 +- plugins/input/shape/build.py | 2 +- plugins/input/sqlite/build.py | 2 +- plugins/input/templates/helloworld/build.py | 2 +- plugins/input/topojson/build.py | 2 +- src/build.py | 8 ++++---- tests/cpp_tests/build.py | 2 +- tests/cpp_tests/svg_renderer_tests/build.py | 2 +- utils/nik2img/build.py | 2 +- utils/ogrindex/build.py | 2 +- utils/pgsql2sqlite/build.py | 2 +- utils/shapeindex/build.py | 2 +- utils/svg2png/build.py | 2 +- 28 files changed, 36 insertions(+), 35 deletions(-) diff --git a/SConstruct b/SConstruct index 09ccd4db6..aafa5f37e 100644 --- a/SConstruct +++ b/SConstruct @@ -316,6 +316,7 @@ opts.AddVariables( ('PATH', 'A custom path (or multiple paths divided by ":") to append to the $PATH env to prioritize usage of command line programs (if multiple are present on the system)', ''), ('PATH_REMOVE', 'A path prefix to exclude from all known command and compile paths (create multiple excludes separated by :)', ''), ('PATH_REPLACE', 'Two path prefixes (divided with a :) to search/replace from all known command and compile paths', ''), + ('MAPNIK_NAME', 'Name of library', 'mapnik'), # Boost variables # default is '/usr/include', see FindBoost method below @@ -1152,9 +1153,9 @@ if not preconfigured: env['MAPNIK_FONTS_DEST'] = os.path.join(env['MAPNIK_LIB_DIR_DEST'],'fonts') if env['LINKING'] == 'static': - env['MAPNIK_LIB_NAME'] = '${LIBPREFIX}mapnik${LIBSUFFIX}' + env['MAPNIK_LIB_NAME'] = '${LIBPREFIX}${MAPNIK_NAME}${LIBSUFFIX}' else: - env['MAPNIK_LIB_NAME'] = '${SHLIBPREFIX}mapnik${SHLIBSUFFIX}' + env['MAPNIK_LIB_NAME'] = '${SHLIBPREFIX}${MAPNIK_NAME}${SHLIBSUFFIX}' if env['PKG_CONFIG_PATH']: env['ENV']['PKG_CONFIG_PATH'] = os.path.realpath(env['PKG_CONFIG_PATH']) diff --git a/benchmark/build.py b/benchmark/build.py index ca2eb7f30..e39d4d3ea 100644 --- a/benchmark/build.py +++ b/benchmark/build.py @@ -7,7 +7,7 @@ Import ('env') test_env = env.Clone() test_env['LIBS'] = copy(env['LIBMAPNIK_LIBS']) -test_env.AppendUnique(LIBS='mapnik') +test_env.AppendUnique(LIBS=env['MAPNIK_NAME']) test_env.AppendUnique(CXXFLAGS='-g') if 'g++' in env['CXX']: test_env.Append(CXXFLAGS='-fPIC') diff --git a/bin/build.py b/bin/build.py index 5c0492b44..26e28c2d7 100644 --- a/bin/build.py +++ b/bin/build.py @@ -119,7 +119,7 @@ configuration = { "git_describe": git_describe, "version_string": config_env['MAPNIK_VERSION_STRING'], "version": config_env['MAPNIK_VERSION'], - "mapnik_libname": 'mapnik', + "mapnik_libname": env['MAPNIK_NAME'], "mapnik_libpath": lib_path, "ldflags": ldflags, "dep_libs": dep_libs, diff --git a/bindings/python/build.py b/bindings/python/build.py index 5544fd5ab..9696a312c 100644 --- a/bindings/python/build.py +++ b/bindings/python/build.py @@ -40,7 +40,7 @@ def is_py3(): prefix = env['PREFIX'] -target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik') +target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + env['MAPNIK_NAME']) target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2') py_env = env.Clone() @@ -48,7 +48,7 @@ py_env.Append(CPPPATH = env['PYTHON_INCLUDES']) py_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES']) -py_env['LIBS'] = ['mapnik',env['BOOST_PYTHON_LIB']] +py_env['LIBS'] = [env['MAPNIK_NAME'],env['BOOST_PYTHON_LIB']] link_all_libs = env['LINKING'] == 'static' or env['RUNTIME_LINK'] == 'static' or (env['PLATFORM'] == 'Darwin' and not env['PYTHON_DYNAMIC_LOOKUP']) @@ -135,8 +135,8 @@ else: paths += "__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n" -if not os.path.exists('mapnik'): - os.mkdir('mapnik') +if not os.path.exists(env['MAPNIK_NAME']): + os.mkdir(env['MAPNIK_NAME']) file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR'])) diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py index fea4590ed..6ad1f4838 100644 --- a/bindings/python/mapnik/__init__.py +++ b/bindings/python/mapnik/__init__.py @@ -429,7 +429,7 @@ def PostGIS(**keywords): cursor_size -- integer size of binary cursor to use (default: 0, no binary cursor is used) >>> from mapnik import PostGIS, Layer - >>> params = dict(dbname='mapnik',table='osm',user='postgres',password='gis') + >>> params = dict(dbname=env['MAPNIK_NAME'],table='osm',user='postgres',password='gis') >>> params['estimate_extent'] = False >>> params['extent'] = '-20037508,-19929239,20037508,19929239' >>> postgis = PostGIS(**params) diff --git a/demo/c++/build.py b/demo/c++/build.py index cfa4ec38e..7eb878f0b 100644 --- a/demo/c++/build.py +++ b/demo/c++/build.py @@ -40,7 +40,7 @@ if env['HAS_CAIRO']: demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS']) demo_env.Append(CPPDEFINES = '-DHAVE_CAIRO') -libraries = ['mapnik'] +libraries = [env['MAPNIK_NAME']] libraries.extend(copy(env['LIBMAPNIK_LIBS'])) rundemo = demo_env.Program('rundemo', source, LIBS=libraries) diff --git a/plugins/input/csv/build.py b/plugins/input/csv/build.py index 802ae9d1d..6b1aa1392 100644 --- a/plugins/input/csv/build.py +++ b/plugins/input/csv/build.py @@ -39,7 +39,7 @@ libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append(env['ICU_LIB_NAME']) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/plugins/input/gdal/build.py b/plugins/input/gdal/build.py index d14162cd0..506385a99 100644 --- a/plugins/input/gdal/build.py +++ b/plugins/input/gdal/build.py @@ -45,7 +45,7 @@ if env['RUNTIME_LINK'] == 'static': libraries = copy(plugin_env['LIBS']) if env['PLUGIN_LINKING'] == 'shared': - libraries.insert(0,'mapnik') + libraries.insert(0,env['MAPNIK_NAME']) libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) diff --git a/plugins/input/geojson/build.py b/plugins/input/geojson/build.py index 0a70c55a8..8e818f4bd 100644 --- a/plugins/input/geojson/build.py +++ b/plugins/input/geojson/build.py @@ -42,7 +42,7 @@ libraries.append('boost_system%s' % env['BOOST_APPEND']) # libraries.append('boost_thread%s' % env['BOOST_APPEND']) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/plugins/input/occi/build.py b/plugins/input/occi/build.py index 0c8bbb6da..2797345d7 100644 --- a/plugins/input/occi/build.py +++ b/plugins/input/occi/build.py @@ -41,7 +41,7 @@ libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append(env['ICU_LIB_NAME']) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/plugins/input/ogr/build.py b/plugins/input/ogr/build.py index c68c5bf61..9c4101bc2 100644 --- a/plugins/input/ogr/build.py +++ b/plugins/input/ogr/build.py @@ -51,7 +51,7 @@ libraries = copy(plugin_env['LIBS']) plugin_env.Append(CXXFLAGS=cxxflags) if env['PLUGIN_LINKING'] == 'shared': - libraries.insert(0,'mapnik') + libraries.insert(0,env['MAPNIK_NAME']) libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) diff --git a/plugins/input/osm/build.py b/plugins/input/osm/build.py index d82e8e1d5..62402f6f4 100644 --- a/plugins/input/osm/build.py +++ b/plugins/input/osm/build.py @@ -60,7 +60,7 @@ libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/plugins/input/postgis/build.py b/plugins/input/postgis/build.py index b9251cd83..676fbf29c 100644 --- a/plugins/input/postgis/build.py +++ b/plugins/input/postgis/build.py @@ -51,7 +51,7 @@ else: libraries = copy(plugin_env['LIBS']) if env['PLUGIN_LINKING'] == 'shared': - libraries.insert(0,'mapnik') + libraries.insert(0,env['MAPNIK_NAME']) libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_regex%s' % env['BOOST_APPEND']) diff --git a/plugins/input/python/build.py b/plugins/input/python/build.py index dd330cbdf..e5d20ec5b 100644 --- a/plugins/input/python/build.py +++ b/plugins/input/python/build.py @@ -69,7 +69,7 @@ else: plugin_env.Append(LINKFLAGS=python_link_flag) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', SHLIBSUFFIX='.input', diff --git a/plugins/input/raster/build.py b/plugins/input/raster/build.py index 7ea45617f..20f65b2d2 100644 --- a/plugins/input/raster/build.py +++ b/plugins/input/raster/build.py @@ -40,7 +40,7 @@ libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/plugins/input/rasterlite/build.py b/plugins/input/rasterlite/build.py index 3bd399551..4b463831b 100644 --- a/plugins/input/rasterlite/build.py +++ b/plugins/input/rasterlite/build.py @@ -39,7 +39,7 @@ libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/plugins/input/shape/build.py b/plugins/input/shape/build.py index a93684832..4ef33687a 100644 --- a/plugins/input/shape/build.py +++ b/plugins/input/shape/build.py @@ -49,7 +49,7 @@ plugin_env.Append(CXXFLAGS=cxxflags) plugin_env.Append(CPPDEFINES=cppdefines) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../shape', SHLIBSUFFIX='.input', diff --git a/plugins/input/sqlite/build.py b/plugins/input/sqlite/build.py index 8cbe7a6f5..3136dcae7 100644 --- a/plugins/input/sqlite/build.py +++ b/plugins/input/sqlite/build.py @@ -44,7 +44,7 @@ if env['SQLITE_LINKFLAGS']: plugin_env.Append(LINKFLAGS=linkflags) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/plugins/input/templates/helloworld/build.py b/plugins/input/templates/helloworld/build.py index 948a6d956..a36aa1ddb 100644 --- a/plugins/input/templates/helloworld/build.py +++ b/plugins/input/templates/helloworld/build.py @@ -51,7 +51,7 @@ if env['PLUGIN_LINKING'] == 'shared': install_dest = env['MAPNIK_INPUT_PLUGINS_DEST'] # only link mapnik if we are build an external shared object - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary( # the name of the target to build, eg 'sqlite.input' diff --git a/plugins/input/topojson/build.py b/plugins/input/topojson/build.py index 2a349d92f..dc34465fb 100644 --- a/plugins/input/topojson/build.py +++ b/plugins/input/topojson/build.py @@ -43,7 +43,7 @@ libraries.append('boost_system%s' % env['BOOST_APPEND']) # libraries.append('boost_thread%s' % env['BOOST_APPEND']) if env['PLUGIN_LINKING'] == 'shared': - libraries.append('mapnik') + libraries.append(env['MAPNIK_NAME']) TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, SHLIBPREFIX='', diff --git a/src/build.py b/src/build.py index db71e002d..2b8f10012 100644 --- a/src/build.py +++ b/src/build.py @@ -391,9 +391,9 @@ if env['PLATFORM'] == 'Darwin' or not env['ENABLE_SONAME']: target_path = env['MAPNIK_LIB_BASE_DEST'] if 'uninstall' not in COMMAND_LINE_TARGETS: if env['LINKING'] == 'static': - mapnik = lib_env_final.StaticLibrary('mapnik', source) + mapnik = lib_env_final.StaticLibrary(env['MAPNIK_NAME'], source) else: - mapnik = lib_env_final.SharedLibrary('mapnik', source) + mapnik = lib_env_final.SharedLibrary(env['MAPNIK_NAME'], source) result = env.Install(target_path, mapnik) env.Alias(target='install', source=result) @@ -415,9 +415,9 @@ else: if 'uninstall' not in COMMAND_LINE_TARGETS: if env['LINKING'] == 'static': - mapnik = lib_env_final.StaticLibrary('mapnik', source) + mapnik = lib_env_final.StaticLibrary(env['MAPNIK_NAME'], source) else: - mapnik = lib_env_final.SharedLibrary('mapnik', source) + mapnik = lib_env_final.SharedLibrary(env['MAPNIK_NAME'], source) result = env.InstallAs(target=target, source=mapnik) env.Alias(target='install', source=result) if result: diff --git a/tests/cpp_tests/build.py b/tests/cpp_tests/build.py index 1e028836f..731123028 100644 --- a/tests/cpp_tests/build.py +++ b/tests/cpp_tests/build.py @@ -10,7 +10,7 @@ if not env['CPP_TESTS']: for cpp_test_bin in glob.glob('*-bin'): os.unlink(cpp_test_bin) else: - test_env['LIBS'] = ['mapnik'] + test_env['LIBS'] = [env['MAPNIK_NAME']] test_env.AppendUnique(LIBS=copy(env['LIBMAPNIK_LIBS'])) if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux': test_env.AppendUnique(LIBS='dl') diff --git a/tests/cpp_tests/svg_renderer_tests/build.py b/tests/cpp_tests/svg_renderer_tests/build.py index 73002fc8d..988880b17 100644 --- a/tests/cpp_tests/svg_renderer_tests/build.py +++ b/tests/cpp_tests/svg_renderer_tests/build.py @@ -4,7 +4,7 @@ from copy import copy Import ('env') -libraries = ['mapnik'] +libraries = [env['MAPNIK_NAME']] libraries.extend(copy(env['LIBMAPNIK_LIBS'])) for cpp_test in glob.glob('*_test.cpp'): diff --git a/utils/nik2img/build.py b/utils/nik2img/build.py index 304cc9be8..244edbef3 100644 --- a/utils/nik2img/build.py +++ b/utils/nik2img/build.py @@ -19,7 +19,7 @@ if env['HAS_CAIRO']: program_env.Append(CPPDEFINES = '-DHAVE_CAIRO') boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] -libraries = ['mapnik',boost_program_options] +libraries = [env['MAPNIK_NAME'],boost_program_options] libraries.extend(copy(env['LIBMAPNIK_LIBS'])) if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux': libraries.append('dl') diff --git a/utils/ogrindex/build.py b/utils/ogrindex/build.py index 2ef55dd6b..4e115f9df 100644 --- a/utils/ogrindex/build.py +++ b/utils/ogrindex/build.py @@ -37,7 +37,7 @@ headers = ['#plugins/input/ogr'] + env['CPPPATH'] program_env['LIBS'] = [env['PLUGINS']['ogr']['lib']] # Link Library to Dependencies -program_env['LIBS'].append('mapnik') +program_env['LIBS'].append(env['MAPNIK_NAME']) program_env['LIBS'].append(env['ICU_LIB_NAME']) program_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND']) program_env['LIBS'].append('boost_program_options%s' % env['BOOST_APPEND']) diff --git a/utils/pgsql2sqlite/build.py b/utils/pgsql2sqlite/build.py index caaf7ebbc..1e680b820 100644 --- a/utils/pgsql2sqlite/build.py +++ b/utils/pgsql2sqlite/build.py @@ -47,7 +47,7 @@ program_env.PrependUnique(CPPPATH=['#plugins/input/postgis']) libraries = [] boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] -libraries.extend([boost_program_options,'sqlite3','pq','mapnik','icuuc']) +libraries.extend([boost_program_options,'sqlite3','pq',env['MAPNIK_NAME'],'icuuc']) if env.get('BOOST_LIB_VERSION_FROM_HEADER'): boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) diff --git a/utils/shapeindex/build.py b/utils/shapeindex/build.py index ef7fed613..812091797 100644 --- a/utils/shapeindex/build.py +++ b/utils/shapeindex/build.py @@ -39,7 +39,7 @@ headers = ['#plugins/input/shape'] + env['CPPPATH'] boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] boost_system = 'boost_system%s' % env['BOOST_APPEND'] -libraries = ['mapnik', boost_program_options, boost_system] +libraries = [env['MAPNIK_NAME'], boost_program_options, boost_system] if env['RUNTIME_LINK'] == 'static': libraries.extend(copy(env['LIBMAPNIK_LIBS'])) if env['PLATFORM'] == 'Linux': diff --git a/utils/svg2png/build.py b/utils/svg2png/build.py index e8a9270ea..71725ff3a 100644 --- a/utils/svg2png/build.py +++ b/utils/svg2png/build.py @@ -41,7 +41,7 @@ if env['HAS_CAIRO']: program_env.Append(CPPDEFINES = '-DHAVE_CAIRO') boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] -libraries = ['mapnik',boost_program_options] +libraries = [env['MAPNIK_NAME'],boost_program_options] libraries.extend(copy(env['LIBMAPNIK_LIBS'])) if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux': libraries.append('dl')