build: change rspable to store RSP file syntax

g-ir-scanner and glib-mkenums read the response file and split it with
shlex.split(), even on Windows hosts.  However, Meson is currently
preparing MSVC-format response files on Windows hosts.

In preparation for fixing that, change CustomTarget's rspable field to
contain the actual response file syntax that the tool accepts.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini authored and Paolo Bonzini committed 2026-10-30 19:30:07 +01:00
1 parent 7f52d67ae3
commit 0fd4227352
3 files changed
+8 -6

No files matched your search

+1 -1
View File
@@ -1299,7 +1299,7 @@ class NinjaBackend(backends.Backend):
capture=ofilenames[0] if target.capture else None,
feed=srcs[0] if target.feed else None,
env=target.env,
can_use_rsp_file=target.rspable,
can_use_rsp_file=target.rsp_syntax is not None,
verbose=target.console)
if reason:
cmd_type = f' (wrapped by meson {reason})'
+3 -2
View File
@@ -46,6 +46,7 @@ if T.TYPE_CHECKING:
from .environment import Environment
from ._typing import ImmutableListProtocol
from .backend.backends import Backend
from .backend.rspfile import RSPFileSyntax
from .compilers.compilers import Compiler, CompilerDict, Language
from .compilers.rust import RustCompiler
from .interpreter.interpreter import CustomTargetSources, SourceOutputs, Interpreter
@@ -3174,7 +3175,7 @@ class CustomTarget(Target, CustomTargetBase, CommandTargetProto):
install_dir: T.Optional[T.List[T.Union[str, Literal[False]]]] = None,
install_mode: T.Optional[FileMode] = None,
install_tag: T.Optional[T.List[T.Optional[str]]] = None,
rspable: bool = False,
rsp_syntax: T.Optional[RSPFileSyntax] = None,
absolute_paths: bool = False,
backend: T.Optional['Backend'] = None,
description: str = 'Generating {} with a custom command',
@@ -3213,7 +3214,7 @@ class CustomTarget(Target, CustomTargetBase, CommandTargetProto):
self.absolute_paths = absolute_paths
# Whether to enable using response files for the underlying tool
self.rspable = rspable
self.rsp_syntax = rsp_syntax
self.extra_depends: T.List[T.Union[GeneratedList, BuildTargetProto]] = []
if extra_depends:
+4 -3
View File
@@ -22,6 +22,7 @@ from .. import build
from .. import interpreter
from .. import mesonlib
from .. import mlog
from ..backend.rspfile import RSPFileSyntax
from ..build import CustomTarget, CustomTargetIndex, Executable, GeneratedList, InvalidArguments, LocalProgram
from ..dependencies import Dependency, InternalDependency
from ..dependencies.pkgconfig import PkgConfigDependency, PkgConfigInterface
@@ -1044,7 +1045,7 @@ class GnomeModule(ExtensionModule):
run_env.merge(kwargs['env'])
# response file supported?
rspable = self._giscanner_version_compare(state, '>= 1.85.0')
rsp_syntax = RSPFileSyntax.GCC if self._giscanner_version_compare(state, '>= 1.85.0') else None
return GirTarget(
girfile,
@@ -1061,7 +1062,7 @@ class GnomeModule(ExtensionModule):
install_dir=[install_dir],
install_tag=['devel'],
env=run_env,
rspable=rspable,
rsp_syntax=rsp_syntax,
)
@staticmethod
@@ -2147,7 +2148,7 @@ class GnomeModule(ExtensionModule):
extra_depends=depends,
# https://github.com/mesonbuild/meson/issues/973
absolute_paths=True,
rspable=mesonlib.is_windows() or mesonlib.is_cygwin(),
rsp_syntax=RSPFileSyntax.GCC if mesonlib.is_windows() or mesonlib.is_cygwin() else None,
description='Generating GObject enum file {}',
)