|
|
|
@ -74,12 +74,8 @@ def cmd_quote(arg: str) -> str: |
|
|
|
|
# (see https://ninja-build.org/manual.html#ref_rule_command) |
|
|
|
|
if mesonlib.is_windows(): |
|
|
|
|
quote_func = cmd_quote |
|
|
|
|
execute_wrapper = ['cmd', '/c'] # unused |
|
|
|
|
rmfile_prefix = ['del', '/f', '/s', '/q', '{}', '&&'] |
|
|
|
|
else: |
|
|
|
|
quote_func = quote_arg |
|
|
|
|
execute_wrapper = [] |
|
|
|
|
rmfile_prefix = ['rm', '-f', '{}', '&&'] |
|
|
|
|
|
|
|
|
|
def gcc_rsp_quote(s: str) -> str: |
|
|
|
|
# see: the function buildargv() in libiberty |
|
|
|
@ -2314,15 +2310,15 @@ class NinjaBackend(backends.Backend): |
|
|
|
|
rule = 'STATIC_LINKER{}'.format(self.get_rule_suffix(for_machine)) |
|
|
|
|
cmdlist: T.List[T.Union[str, NinjaCommandArg]] = [] |
|
|
|
|
args = ['$in'] |
|
|
|
|
# FIXME: Must normalize file names with pathlib.Path before writing |
|
|
|
|
# them out to fix this properly on Windows. See: |
|
|
|
|
# https://github.com/mesonbuild/meson/issues/1517 |
|
|
|
|
# https://github.com/mesonbuild/meson/issues/1526 |
|
|
|
|
if isinstance(static_linker, ArLikeLinker) and not mesonlib.is_windows(): |
|
|
|
|
if isinstance(static_linker, ArLikeLinker): |
|
|
|
|
# `ar` has no options to overwrite archives. It always appends, |
|
|
|
|
# which is never what we want. Delete an existing library first if |
|
|
|
|
# it exists. https://github.com/mesonbuild/meson/issues/1355 |
|
|
|
|
cmdlist = execute_wrapper + [c.format('$out') for c in rmfile_prefix] |
|
|
|
|
if mesonlib.is_windows(): |
|
|
|
|
cmd = ' '.join(['cmd /Q /D /S /V:OFF /C'] + self.environment.get_build_command() + ['--internal rm $out &&']) |
|
|
|
|
cmdlist += [NinjaCommandArg(cmd, Quoting.none)] |
|
|
|
|
else: |
|
|
|
|
cmdlist += ['rm', '-f', '$out', '&&'] |
|
|
|
|
cmdlist += static_linker.get_exelist() |
|
|
|
|
cmdlist += ['$LINK_ARGS'] |
|
|
|
|
cmdlist += NinjaCommandArg.list(static_linker.get_output_args('$out'), Quoting.none) |
|
|
|
|