While discussing error messages on IRC with xclaesse, we found 448b11cb7f which improves one of the error messages, but leaves out the others. This commit updates them, too.
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.
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.
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>
This is a first step towards making it possible to allow subprojects to
be built for both the build and host machine. Even though the concept
of a build-machine subproject doesn't exist yet, prepare for it by
making the list of (sub)projects per machine, and storing the machine
in the interpreter's subproject stack.
Extracted from a patch by Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
The SubProject alone will not be a unique key into build.projects.
Just store the object itself, as it allows retrieving the key.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Introduce a decorator that applies the transformation in
self.build.machine_map to kwargs['native']. In the future
this will also handle conversion of kwargs['native'] to
kwargs['for_machine'].
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cover various combination of the native keyword argument and whether the
property is in a native or cross file.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
We might encounter a Meson version check that always evaluates to true
or to false:
project('t', 'c', meson_version: '>=0.60.0')
if meson.version().version_compare('>=0.55.0')
v = 1
endif
if meson.version().version_compare('<0.60.0')
v = 2
endif
Print warnings in such cases.
Co-authored-by: Benjamin Gilbert <bgilbert@backtick.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Parse it just once, ahead of time, and pass it to
version_compare_condition_with_min.
This gives, for free, support for multi-argument
meson.version().version_compare().
There are two changes in outputs: first, the output of version
checks now canonicalizes the minimum Meson version; second, a '!='
or '<' meson_version does not count as a "minimum Meson version" in
error messages (after all, they do not specify a minimum for the
purpose of version_compare_condition_with_min) so a few testcases
have to be adjusted.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Add a class that can be used to encode a range of versions. It is
useful to express the project's minimum version and to reason on it,
for example to detect redundant Meson version checks.
Right now specifying >1.10.0 gives warnings like
meson.build:18: WARNING: Project targets '>1.10.0' but uses feature introduced in '1.10.0': meson.version().version_compare() with multiple arguments. From 1.8.0 - 1.9.* it failed to match str.version_compare
This is incorrect. A project targeting 1.10.1 or later can use features
introduced by 1.10.0. Fix the bug in version_compare_condition_with_min
and adjust the testcases.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This worked by chance at the edges ('<2.0' did not match '<2.0-pre')
just because RPM sorting order placed '2.0-pre' *after* '2.0'. With
SemVer it has to be implemented fully.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Semantic versions are quite different from RPM versions implemented in
Meson's Version class. Just implement them with a completely
different class.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Eliminate duplicate code for x.y.* and ~x.y, and generally
speaking simplify version.convert(), by canonicalizing each
of the requirements.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Check the acceptance directly against a set of versions, instead
of checking the result of the conversion.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Not all compilers (swiftc in case of #14261) concatenate linker
arguments with ','. This removes that assumption and instead always
passes the arguments in a list where applicable, and reworks the
linker argument wrapper syntaxes for the compilers to more accurately
represent the three different option styles.
Some Apple ld options, notably -install_name, are also not exposed
directly on the compiler options interface, hence add the linker
prefix here.
The virtual superclass feature of ABCMeta is never used by Meson. Replace
with a simpler version that only checks for abstract methods, so that
isinstance() against any of Meson's concrete subclasses now goes
through the CPython C fast path.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Support `--exclude name` where `name` is a full test name, optionally
including the subproject name. Wildcards are not currently supported.
Accept both `name` for the main project and `subproject:name`. We want `name`
for convenience so users don't have to write out their project name when
no subprojects are involved.
Extended matching could be added in future, but the primary usecase for
this is where distributions want to skip known-buggy or irrelevant tests,
rather than developers working on their own project.
The test changes are a bit noisy because needed to add a test with
the same name in the main project and a subproject to check that --exclude
w/ an unqualified name only affected the main parent, but adding 2 new failing
tests required all the numbers to be adjusted.
Closes: https://github.com/mesonbuild/meson/pull/11502
Closes: https://github.com/mesonbuild/meson/issues/6999
Signed-off-by: Sam James <sam@gentoo.org>
This provides faster skipping on macos and on Linux before bother to
call into pkg-config. This is needed on macOS to keep things running
after the next patch that is forced to take a heavy handed approach to
prevent the wrong python from being used.
Introduce a dataclass to wrap the result of get_option() for features.
This removes a layering violation, where UserFeatureOptions are created
outside options.py just to apply modifiers like disable_if().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Fix the logic responsible for handling python build configs to check
if paths from `build-details.json` start with sys_root, and do not
prepend it if they do. This matches the pkg-config behavior (of
`PKG_CONFIG_SYSROOT_DIR`). It permits using it both with sysroots that
are a regular system mounted in a subdirectory, and that are dedicated
prefixes (e.g. created via conda).
Signed-off-by: Michał Górny <mgorny@quansight.com>
Use a name that can be applied to rustc as well (because
RUSTFLAGS need not be added to rust_link_args and in fact
it breaks).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Instead of monkeypatching the compiler, just check that the
compiler (whichever it is) does the right thing for its
INVOKES_LINKER setting.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>