Do a proper check for BOOST_PYTHON_LIB in scons, and change it to be only the library name. re: mapnik-packaging:#3

This commit is contained in:
Robert Coup 2011-10-21 16:39:35 -07:00
parent 480f8a390d
commit deb4e6b6c3
2 changed files with 21 additions and 18 deletions

View file

@ -329,7 +329,7 @@ opts.AddVariables(
('BOOST_TOOLKIT','Specify boost toolkit, e.g., gcc41.','',False), ('BOOST_TOOLKIT','Specify boost toolkit, e.g., gcc41.','',False),
('BOOST_ABI', 'Specify boost ABI, e.g., d.','',False), ('BOOST_ABI', 'Specify boost ABI, e.g., d.','',False),
('BOOST_VERSION','Specify boost version, e.g., 1_35.','',False), ('BOOST_VERSION','Specify boost version, e.g., 1_35.','',False),
('BOOST_PYTHON_LIB','Specify library name or full path to boost_python lib (e.g. "boost_python-py26" or "/usr/lib/libboost_python.dylib")',''), ('BOOST_PYTHON_LIB','Specify library name to specific Boost Python lib (e.g. "boost_python-py26")',''),
# Variables for required dependencies # Variables for required dependencies
('FREETYPE_CONFIG', 'The path to the freetype-config executable.', 'freetype-config'), ('FREETYPE_CONFIG', 'The path to the freetype-config executable.', 'freetype-config'),
@ -1105,14 +1105,14 @@ if not preconfigured:
if env['PRIORITIZE_LINKING']: if env['PRIORITIZE_LINKING']:
conf.prioritize_paths(silent=False) conf.prioritize_paths(silent=False)
for libinfo in LIBSHEADERS: for libname, headers, required, lang in LIBSHEADERS:
if not conf.CheckLibWithHeader(libinfo[0], libinfo[1], libinfo[3]): if not conf.CheckLibWithHeader(libname, headers, lang):
if libinfo[2]: if required:
color_print(1,'Could not find required header or shared library for %s' % libinfo[0]) color_print(1, 'Could not find required header or shared library for %s' % libname)
env['MISSING_DEPS'].append(libinfo[0]) env['MISSING_DEPS'].append(libname)
else: else:
color_print(4,'Could not find optional header or shared library for %s' % libinfo[0]) color_print(4, 'Could not find optional header or shared library for %s' % libname)
env['SKIPPED_DEPS'].append(libinfo[0]) env['SKIPPED_DEPS'].append(libname)
if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']: if env['ICU_LIB_NAME'] not in env['MISSING_DEPS']:
if not conf.icu_at_least_four_two(): if not conf.icu_at_least_four_two():
@ -1331,7 +1331,7 @@ if not preconfigured:
if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'): if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'):
color_print(1,'Could not find required header files for boost python') color_print(1,'Could not find required header files for boost python')
env['MISSING_DEPS'].append('boost python') env['MISSING_DEPS'].append('boost python')
if env['CAIRO']: if env['CAIRO']:
if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'): if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
env['HAS_PYCAIRO'] = True env['HAS_PYCAIRO'] = True
@ -1502,14 +1502,23 @@ if not preconfigured:
if not conf.CheckHeader(header='Python.h',language='C'): if not conf.CheckHeader(header='Python.h',language='C'):
color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION']) color_print(1,'Could not find required header files for the Python language (version %s)' % env['PYTHON_VERSION'])
env.Replace(**backup) env.Replace(**backup)
env['MISSING_DEPS'].append('python %s development headers' % env['PYTHON_VERSION']) Exit(1)
else: else:
env.Replace(**backup) env.Replace(**backup)
if (int(majver), int(minver)) < (2, 2): if (int(majver), int(minver)) < (2, 2):
color_print(1,"Python version 2.2 or greater required") color_print(1,"Python version 2.2 or greater required")
Exit(1) Exit(1)
if env['BOOST_PYTHON_LIB']:
env.Append(LIBS='python%s' % env['PYTHON_VERSION'])
if not conf.CheckLibWithHeader(libs=[env['BOOST_PYTHON_LIB']], header='boost/python/detail/config.hpp', language='C++'):
color_print(1, 'Could not find library %s for boost python' % env['BOOST_PYTHON_LIB'])
env.Replace(**backup)
Exit(1)
else:
env.Replace(**backup)
color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION']) color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION'])
color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_SYS_PREFIX'])) color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_SYS_PREFIX']))
color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION'])) color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION']))

View file

@ -48,13 +48,7 @@ if env['JPEG']:
libraries.append('jpeg') libraries.append('jpeg')
if env['BOOST_PYTHON_LIB']: if env['BOOST_PYTHON_LIB']:
if os.path.sep in env['BOOST_PYTHON_LIB']: libraries.append(env['BOOST_PYTHON_LIB'])
pylib_dir = os.path.dirname(env['BOOST_PYTHON_LIB'])
env.Prepend(LIBPATH = pylib_dir)
pylib_name = os.path.splitext(os.path.basename(env['BOOST_PYTHON_LIB']))[0].replace('lib','',1)
libraries.append(pylib_name)
else:
libraries.append(env['BOOST_PYTHON_LIB'].replace('lib','',1))
else: else:
if is_py3(): if is_py3():
libraries.append('boost_python3%s' % env['BOOST_APPEND']) libraries.append('boost_python3%s' % env['BOOST_APPEND'])