Previously, find_program only used the subproject fallback if it didn't
find the tool the normal way or global forcefallback was activated. Now
it should also fall back if the subproject that provides the fallback is
part of force-fallback-for.
This commit reenables and implements correct response file support for
Nasm.
Fortified with the knowledge of #15867 and #15872, and with a quick chat
with @nirbheek, I realised that the easiest way to fix this (since Ninja
does not support custom argument spacing) is to do it the obvious way,
with Meson's custom command support.
This commit implements an abridged version of that: when a non-standard
RspFileSyntax value is detected, the active NinjaBuildRule is temporarily
resolved to the corresponding NinjaRule on the fly and if the latter says
that a response file will be used, the NinjaBuildRule is immediately
converted into a CUSTOM_COMMAND, completing the arguments with
the bits for infile and outfile and triggering the executable
serialization. That serializes the response file and pickles the command.
Fixes building mpv with MSVC 2022+ and fdk-aac enabled.
ExternalProgram has as weird way of setting self.command to `list[str |
None]`, but it should only be `list[None]` if `self.command = [None]`.
Instead, just set self.command to `list[str]`, and use an empty list as
the sentinel value.
This also fixes a few issues where we use Any or reduce to Any.
This is a decorator that allows declaring a property as initialized
late. This allows for more ergonomic typing than using a union of `T |
None` for late initialized variables.
We have one, and only one case where we use the fact it can return None,
and otherwise assert (or should assert) that the value is not None.
Instead, raise if the command is None, and in the one case catch the
exception.
When a crate name is compiled for both the build and the host machine,
give it two different names to avoid conflicts. This is not needed
for subprojects, but it is still necessary for packages that are part
of the toplevel workspace.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Change the dependency resolution code to take a MachineChoice as an
argument. Create build- and/or host-side configurations
through the machines_from() method in Manifest.
Make the PackageConfiguration a PerMachine object. This makes it
possible to do dependency resolution separately for build- and/or host-side
libraries.
For now, all users only fill in or consume the host side, but that will change.
The current situation in Meson is that subprojects are always built for
the host machine. This means that while cross compiling, a tool that
must be run on the build machine must have all of its dependencies met
by the system (pkg-config, cmake, config-tool, etc); but dependencies
for the host machine can be built. With this patch subprojects may also
be built for the build machine.
Nothing should ever be installed from a subproject for the build
machine, while cross compiling. However, if we are not cross compiling
they are installed, since Meson can't really tell the difference between
a host and build dependency in that case.
Extracted from a patch by Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>