libpython: don't link to Python core library on Linux

metadata
Wenzel Jakob 2014-08-05 14:38:46 +02:00
parent 5e222601c0
commit 38cd04828c
1 changed files with 12 additions and 6 deletions

View File

@ -2,14 +2,20 @@ Import('env', 'sys', 'os', 'hasPython')
for ver in hasPython: for ver in hasPython:
sver = ver.replace('.', '') sver = ver.replace('.', '')
python_include = list(env['PYTHON'+sver+'INCLUDE']) if env.has_key('PYTHON'+sver+'INCLUDE') else []
python_libdir = list(env['PYTHON'+sver+'LIBDIR']) if env.has_key('PYTHON'+sver+'LIBDIR') else []
python_lib = list(env['PYTHON'+sver+'LIB']) if env.has_key('PYTHON'+sver+'LIB') else []
if 'linux' in sys.platform:
# On Linux, don't link to the core Python library. The associated symbols will be resolved
# when the plugin is imported into a running interpreter
python_lib = [ lib for lib in python_lib if not lib.startswith('python') ]
pythonEnv = env.Clone() pythonEnv = env.Clone()
if pythonEnv.has_key('PYTHON'+sver+'INCLUDE'): pythonEnv.Prepend(CPPPATH=python_include)
pythonEnv.Prepend(CPPPATH=pythonEnv['PYTHON'+sver+'INCLUDE']) pythonEnv.Prepend(LIBPATH=python_libdir)
if pythonEnv.has_key('PYTHON'+sver+'LIBDIR'): pythonEnv.Prepend(LIBS=python_lib)
pythonEnv.Prepend(LIBPATH=pythonEnv['PYTHON'+sver+'LIBDIR'])
if pythonEnv.has_key('PYTHON'+sver+'LIB'):
pythonEnv.Prepend(LIBS=pythonEnv['PYTHON'+sver+'LIB'])
pythonEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_PYTHON']]) pythonEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_PYTHON']])
pythonEnv['SHLIBPREFIX']='' pythonEnv['SHLIBPREFIX']=''