diff options
author | Johan Bergström <bugs@bergstroem.nu> | 2015-05-25 06:10:14 +0300 |
---|---|---|
committer | Johan Bergström <bugs@bergstroem.nu> | 2015-06-01 00:34:29 +0300 |
commit | c5a1009903e98bc087a53d5a12fed4b1c23582fb (patch) | |
tree | 77f0cbe28b894065d4cb853d764ef5854d92d959 | |
parent | 4d6b768e5d8d04c76eb1d13bb3750dcc8d9935b2 (diff) |
build: avoid passing empty strings to build flags
While checking the return values from icu-i18n, we didn't
validate the content before passing it to the build system.
Also make cflags parsing more robust by avoiding empty strings.
Fixes: https://github.com/nodejs/io.js/issues/1787
PR-URL: https://github.com/nodejs/io.js/pull/1789
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
-rwxr-xr-x | configure | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/configure b/configure index 4a30973a372..5c9b29bf2c2 100755 --- a/configure +++ b/configure @@ -690,7 +690,11 @@ def configure_library(lib, output): if default_libpath: default_libpath = '-L' + default_libpath (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) - cflags = pkg_cflags.split('-I') if pkg_cflags else default_cflags + # 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 @@ -846,10 +850,12 @@ def configure_intl(o): sys.exit(1) (libs, cflags, libpath) = pkgicu # libpath provides linker path which may contain spaces - o['libraries'] += [libpath] + if libpath: + o['libraries'] += [libpath] # safe to split, cannot contain spaces o['libraries'] += libs.split() - o['cflags'] += cflags.split() + if cflags: + o['include_dirs'] += filter(None, map(str.strip, cflags.split('-I'))) # use the "system" .gyp o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp' return |