diff options
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r-- | mesonbuild/backend/backends.py | 14 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 14 | ||||
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 2 |
3 files changed, 19 insertions, 11 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 46f8563..7372c4c 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -215,13 +215,13 @@ class Backend: exe_data = os.path.join(self.environment.get_scratch_dir(), scratch_file) with open(exe_data, 'wb') as f: if isinstance(exe, dependencies.ExternalProgram): - exe_fullpath = exe.fullpath + exe_cmd = exe.get_command() exe_needs_wrapper = False elif isinstance(exe, (build.BuildTarget, build.CustomTarget)): - exe_fullpath = [self.get_target_filename_abs(exe)] + exe_cmd = [self.get_target_filename_abs(exe)] exe_needs_wrapper = exe.is_cross else: - exe_fullpath = [exe] + exe_cmd = [exe] exe_needs_wrapper = False is_cross = exe_needs_wrapper and \ self.environment.is_cross_build() and \ @@ -235,7 +235,7 @@ class Backend: extra_paths = self.determine_windows_extra_paths(exe) else: extra_paths = [] - es = ExecutableSerialisation(basename, exe_fullpath, cmd_args, env, + es = ExecutableSerialisation(basename, exe_cmd, cmd_args, env, is_cross, exe_wrapper, workdir, extra_paths, capture) pickle.dump(es, f) @@ -444,9 +444,9 @@ class Backend: for t in tests: exe = t.get_exe() if isinstance(exe, dependencies.ExternalProgram): - fname = exe.fullpath + cmd = exe.get_command() else: - fname = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))] + cmd = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))] is_cross = self.environment.is_cross_build() and \ self.environment.cross_info.need_cross_compiler() and \ self.environment.cross_info.need_exe_wrapper() @@ -471,7 +471,7 @@ class Backend: cmd_args.append(self.get_target_filename(a)) else: raise MesonException('Bad object in test command.') - ts = TestSerialisation(t.get_name(), t.suite, fname, is_cross, exe_wrapper, + ts = TestSerialisation(t.get_name(), t.suite, cmd, is_cross, exe_wrapper, t.is_parallel, cmd_args, t.env, t.should_fail, t.timeout, t.workdir, extra_paths) arr.append(ts) 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) diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 666da7d..547889c 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -395,7 +395,7 @@ class Vs2010Backend(backends.Backend): if isinstance(i, build.BuildTarget): cmd.append(os.path.join(self.environment.get_build_dir(), self.get_target_filename(i))) elif isinstance(i, dependencies.ExternalProgram): - cmd += i.fullpath + cmd += i.get_command() else: cmd.append(i) cmd_templ = '''"%s" ''' * len(cmd) |