diff --git a/bindings/python/build.py b/bindings/python/build.py index e32c9a410..2ba242c26 100644 --- a/bindings/python/build.py +++ b/bindings/python/build.py @@ -43,19 +43,22 @@ prefix = env['PREFIX'] target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik') target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2') -libraries = ['mapnik',env['BOOST_PYTHON_LIB']] +py_env = env.Clone() +py_env.Append(CPPPATH = env['PYTHON_INCLUDES']) + +py_env['LIBS'] = ['mapnik',env['BOOST_PYTHON_LIB']] # TODO - do solaris/fedora need direct linking too? if env['PLATFORM'] == 'Darwin': if not env['PYTHON_DYNAMIC_LOOKUP']: if env['PNG']: - libraries.append('png') + py_env.AppendUnique(LIBS = 'png') if env['JPEG']: - libraries.append('jpeg') - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_regex%s' % env['BOOST_APPEND']) + py_env.AppendUnique(LIBS = 'jpeg') + py_env.AppendUnique(LIBS = env['ICU_LIB_NAME']) + py_env.AppendUnique(LIBS = 'boost_regex%s' % env['BOOST_APPEND']) if env['THREADING'] == 'multi': - libraries.append('boost_thread%s' % env['BOOST_APPEND']) + py_env.AppendUnique(LIBS = 'boost_thread%s' % env['BOOST_APPEND']) ##### Python linking on OS X is tricky ### # Confounding problems are: @@ -115,6 +118,9 @@ if env['CUSTOM_LDFLAGS']: else: linkflags = python_link_flag +if env['LINKING'] == 'static': + py_env.AppendUnique(LIBS=env['LIBMAPNIK_LIBS']) + paths = ''' """Configuration paths of Mapnik fonts and input plugins (auto-generated by SCons).""" @@ -147,9 +153,6 @@ except: pass # install the shared object beside the module directory sources = glob.glob('*.cpp') -py_env = env.Clone() -py_env.Append(CPPPATH = env['PYTHON_INCLUDES']) - if 'install' in COMMAND_LINE_TARGETS: # install the core mapnik python files, including '__init__.py' init_files = glob.glob('mapnik/*.py') @@ -183,8 +186,8 @@ if 'uninstall' not in COMMAND_LINE_TARGETS: py_env.ParseConfig('pkg-config --cflags pycairo') py_env.Append(CPPDEFINES = '-DHAVE_PYCAIRO') -libraries.append('boost_thread%s' % env['BOOST_APPEND']) -_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags) +py_env.AppendUnique(LIBS = 'boost_thread%s' % env['BOOST_APPEND']) +_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags) Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))