aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-02-19 12:37:56 -0500
committerGitHub <noreply@github.com>2017-02-19 12:37:56 -0500
commit0cf18eb3bc6f872324971610f92d54d63049b9c9 (patch)
tree002840679e8cb2d179adb156c3c92f69bca3ae00 /mesonbuild/backend/ninjabackend.py
parentaba099a4910c2e578c0aefbd20bda666b6a6856e (diff)
parentf23a4a8b27b2a2e46185869bb736b1ab843cdcf3 (diff)
downloadmeson-0cf18eb3bc6f872324971610f92d54d63049b9c9.zip
meson-0cf18eb3bc6f872324971610f92d54d63049b9c9.tar.gz
meson-0cf18eb3bc6f872324971610f92d54d63049b9c9.tar.bz2
Merge pull request #1356 from centricular/cross-platform-unit-tests
Run unit tests on more platforms, and more
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index a22e0ab..27e1e9a 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -30,9 +30,11 @@ from collections import OrderedDict
if mesonlib.is_windows():
quote_char = '"'
execute_wrapper = 'cmd /c'
+ rmfile_prefix = 'del /f /s /q {} &&'
else:
quote_char = "'"
execute_wrapper = ''
+ rmfile_prefix = 'rm -f {} &&'
def ninja_quote(text):
return text.replace(' ', '$ ').replace(':', '$:')
@@ -1238,10 +1240,16 @@ int dummy;
'''
else:
command_template = ' command = {executable} $LINK_ARGS {output_args} $in\n'
+ cmdlist = []
+ if isinstance(static_linker, compilers.ArLinker):
+ # `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, rmfile_prefix.format('$out')]
+ cmdlist += static_linker.get_exelist()
command = command_template.format(
- executable=' '.join(static_linker.get_exelist()),
- output_args=' '.join(static_linker.get_output_args('$out'))
- )
+ executable=' '.join(cmdlist),
+ output_args=' '.join(static_linker.get_output_args('$out')))
description = ' description = Static linking library $out\n\n'
outfile.write(rule)
outfile.write(command)