Skip to content

Commit c5a1009

Browse files
committedMay 31, 2015
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: #1787 PR-URL: #1789 Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 4d6b768 commit c5a1009

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎configure

+9-3
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,11 @@ def configure_library(lib, output):
690690
if default_libpath:
691691
default_libpath = '-L' + default_libpath
692692
(pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib)
693-
cflags = pkg_cflags.split('-I') if pkg_cflags else default_cflags
693+
# Remove empty strings from the list of include_dirs
694+
if pkg_cflags:
695+
cflags = filter(None, map(str.strip, pkg_cflags.split('-I')))
696+
else:
697+
cflags = default_cflags
694698
libs = pkg_libs if pkg_libs else default_lib
695699
libpath = pkg_libpath if pkg_libpath else default_libpath
696700

@@ -846,10 +850,12 @@ def configure_intl(o):
846850
sys.exit(1)
847851
(libs, cflags, libpath) = pkgicu
848852
# libpath provides linker path which may contain spaces
849-
o['libraries'] += [libpath]
853+
if libpath:
854+
o['libraries'] += [libpath]
850855
# safe to split, cannot contain spaces
851856
o['libraries'] += libs.split()
852-
o['cflags'] += cflags.split()
857+
if cflags:
858+
o['include_dirs'] += filter(None, map(str.strip, cflags.split('-I')))
853859
# use the "system" .gyp
854860
o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp'
855861
return

0 commit comments

Comments
 (0)
Please sign in to comment.