diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-06-15 22:04:14 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-06-16 01:11:47 +0200 |
commit | c207e8d223bddd3f391f9ce06f770901356fc50f (patch) | |
tree | 5a5dbf147c2db2b235678b10da8ec8bf34191b3e | |
parent | 3806d875d3dbff96041638299a1974579e9a5b4a (diff) | |
download | nodejs-c207e8d223bddd3f391f9ce06f770901356fc50f.tar.gz nodejs-c207e8d223bddd3f391f9ce06f770901356fc50f.tar.bz2 nodejs-c207e8d223bddd3f391f9ce06f770901356fc50f.zip |
build: fix pkg-config output parsing in configure
Fix parsing of `pkg-config --cflags-only-I`. The configure_library()
step sometimes appended a list in a list instead of list of strings to
include_dirs.
This commit removes the default handling for includes and libpath
options. They don't have defaults at the moment and I don't see that
changing anytime soon. Fixing the code is more work and because it's
dead code anyway, I opted to remove it instead.
Fixes: https://github.com/nodejs/io.js/issues/1985
PR-URL: https://github.com/nodejs/io.js/pull/1986
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
-rwxr-xr-x | configure | 39 |
1 files changed, 14 insertions, 25 deletions
@@ -366,12 +366,6 @@ def pkg_config(pkg): return retval -def format_libraries(list): - """Returns string of space separated libraries""" - libraries = list.split(',') - return ' '.join('-l{0}'.format(i) for i in libraries) - - def try_check_compiler(cc, lang): try: proc = subprocess.Popen(shlex.split(cc) + ['-E', '-P', '-x', lang, '-'], @@ -689,29 +683,24 @@ def configure_library(lib, output): output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) if getattr(options, shared_lib): - default_cflags = getattr(options, shared_lib + '_includes') - default_lib = format_libraries(getattr(options, shared_lib + '_libname')) - default_libpath = getattr(options, shared_lib + '_libpath') - if default_libpath: - default_libpath = '-L' + default_libpath (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) - # Remove empty strings from the list of include_dirs + if pkg_cflags: - cflags = filter(None, map(str.strip, pkg_cflags.split('-I'))) - else: - cflags = default_cflags - libs = pkg_libs if pkg_libs else default_lib - libpath = pkg_libpath if pkg_libpath else default_libpath + output['include_dirs'] += ( + filter(None, map(str.strip, pkg_cflags.split('-I')))) # libpath needs to be provided ahead libraries - if libpath: - output['libraries'] += [libpath] - if libs: - # libs passed to the linker cannot contain spaces. - # (libpath on the other hand can) - output['libraries'] += libs.split() - if cflags: - output['include_dirs'] += [cflags] + if pkg_libpath: + output['libraries'] += ( + filter(None, map(str.strip, pkg_cflags.split('-L')))) + + default_libs = getattr(options, shared_lib + '_libname') + default_libs = map('-l{0}'.format, default_libs.split(',')) + + if pkg_libs: + output['libraries'] += pkg_libs.split() + elif default_libs: + output['libraries'] += default_libs def configure_v8(o): |