aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@sixbynine.org>2019-01-02 16:32:56 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2019-01-07 23:03:18 +0200
commitf2223fcf541e6e5d6d384c54ca3f911716f86c60 (patch)
treeb832914842b0b594c2375276b97ba753d0eec1a8
parent6c76b92dff836616402ab2ce39fa0ff274da1fd5 (diff)
downloadmeson-f2223fcf541e6e5d6d384c54ca3f911716f86c60.zip
meson-f2223fcf541e6e5d6d384c54ca3f911716f86c60.tar.gz
meson-f2223fcf541e6e5d6d384c54ca3f911716f86c60.tar.bz2
ninjabackend: Adding missing shell quotes for compiler arguments
Since trying to cross compile for Windows from Linux (WSL) and having paths like this: '-L/mnt/c/Program Files (x86)/Microsoft Visual Studio/2017/\ Community/VC/Tools/MSVC/14.15.26726/lib/x64' I found that the spaces and brackets in the paths weren't properly escaped by the Ninja backend.
-rw-r--r--mesonbuild/backend/ninjabackend.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 3688f29..debb4fb 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1473,7 +1473,7 @@ int dummy;
command_template = ' command = {executable} $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing\n'
command = command_template.format(
executable=' '.join(compiler.get_linker_exelist()),
- cross_args=' '.join(cross_args),
+ cross_args=' '.join([quote_func(i) for i in cross_args]),
output_args=' '.join(compiler.get_linker_output_args('$out'))
)
description = ' description = Linking target $out.\n'
@@ -1601,7 +1601,7 @@ rule FORTRAN_DEP_HACK%s
command_template = ' command = {executable} $ARGS {cross_args} {output_args} {compile_only_args} $in\n'
command = command_template.format(
executable=' '.join([ninja_quote(i) for i in compiler.get_exelist()]),
- cross_args=' '.join(compiler.get_cross_extra_flags(self.environment, False)) if is_cross else '',
+ cross_args=' '.join([quote_func(i) for i in compiler.get_cross_extra_flags(self.environment, False)]) if is_cross else '',
output_args=' '.join(compiler.get_output_args('$out')),
compile_only_args=' '.join(compiler.get_compile_only_args())
)
@@ -1659,7 +1659,7 @@ rule FORTRAN_DEP_HACK%s
command_template = ' command = {executable} $ARGS {cross_args} {dep_args} {output_args} {compile_only_args} $in\n'
command = command_template.format(
executable=' '.join([ninja_quote(i) for i in compiler.get_exelist()]),
- cross_args=' '.join(cross_args),
+ cross_args=' '.join([quote_func(i) for i in cross_args]),
dep_args=' '.join(quoted_depargs),
output_args=' '.join(compiler.get_output_args('$out')),
compile_only_args=' '.join(compiler.get_compile_only_args())
@@ -1703,7 +1703,7 @@ rule FORTRAN_DEP_HACK%s
output = ' '.join(compiler.get_output_args('$out'))
command = " command = {executable} $ARGS {cross_args} {dep_args} {output_args} {compile_only_args} $in\n".format(
executable=' '.join(compiler.get_exelist()),
- cross_args=' '.join(cross_args),
+ cross_args=' '.join([quote_func(i) for i in cross_args]),
dep_args=' '.join(quoted_depargs),
output_args=output,
compile_only_args=' '.join(compiler.get_compile_only_args())