18130 Commits
Author SHA1 Message Date
Charles Brunet fb511f0ab1 Fix missing build project prefixes
A build project prefix ("build.") was introduced in 499f73da1 to separate build
files from host and build targets when cross compiling subprojects.
Additional work was done in 83fba12da. However, this prefix was missing from
some places:
- for generated files, with or without `build_subdir`: those files were
  generated at the same place for both host and build targets.
- for include dirs: was erroring if it was only available in the build
  tree.
- for subdirs
- for generated ast
Additionally, extra_build_dirs were double-prefixed.
2026-11-04 18:58:43 +01:00
Charles Brunet 9706cac6af define build prefix in one place
Define BuildProject prefix and CMakeInterpreter prefix from
MachineChoice, instead of duplicating the definition.
2026-11-04 18:58:43 +01:00
Courtney Richard Pitcher 1030586678 A unit test that runs on the Meson CI logs the entire os.environ, potentially leaking secrets. Consumers may also run these test suits on their CI, exposing their own secrets. 2026-11-03 06:12:58 -08:00
GeorgiaPreda 9a685a84fa qt: register existing .qrc to fix build dependencies 2026-11-02 11:32:42 -08:00
Dylan Baker 27f69b22e5 ruff: Enable PERF by default, disable PERF203 for now
Which is about try/except in loops. There are preformance issues with
this, but it's also a good improvement to have this.
2026-10-30 20:04:49 -07:00
Dylan Baker 84cda10a08 ruff: Enable PERF402
These are all manual fixes, which is more use of extends vs appending in
a loop.
2026-10-30 20:04:49 -07:00
Dylan Baker c523578ab1 ruff: Enable PERF401: Use list-comprehensions when possible
This not only creates less LOC, but also improves performance
2026-10-30 20:04:49 -07:00
Dylan Baker 6933aaf2e5 ruff: enable PERF102
Which replaces uses of mapping.items() with mapping or mapping.values()
when the key or value is not used.
2026-10-30 20:04:49 -07:00
Harald Nordgren 0ef4bf221d clang: build PCHs without timestamps when using a compiler cache
Clang records the modification time of every header that goes into a
precompiled header. When a header gets a new modification time but
keeps its content, for example after switching branches back and
forth, the rebuilt PCH differs and ccache misses for every object file
that uses it.

Pass -Xclang -fno-pch-timestamp when creating the PCH if a compiler
cache is in use, as the ccache manual recommends.

Fixes #14662
2026-10-30 12:49:44 -07:00
Paolo Bonzini f5e4bb9bf7 cmake: do not use exe wrapper for build-side subprojects
Fixes: #16314
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:32:29 +01:00
Paolo Bonzini 18d883118f cmake: use correct build directory in CMakeInterpreter
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:32:29 +01:00
Paolo Bonzini faa6a938b3 interpreter: always use machine_map when adding languages
project(), and add_languages() with no "native" keyword argument, were
looking for a host compiler even in build-machine subprojects.
Every caller other than `add_languages(native: bool)` was passing a
raw MachineChoice, so add the mapping in Interpreter.add_languages
and remove it from func_add_languages().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:32:29 +01:00
Paolo Bonzini 06fec0aafb gnome: search the build directory when scanning resources
When scanning for the dependencies of a resource file, which is only
needed with glib older than 2.51.1, the first --sourcedir is documented
as "Current build dir" but is actually relative to the source directory,
which is the working directory of the command.

Search the build directory of the current meson.build and of each
user-specified directory before the corresponding source directory, as
the comment intended.
2026-10-30 19:32:29 +01:00
Paolo Bonzini 83fba12da2 interpreter, modules: add current_build_dir and use it for joining to environment.get_build_dir()
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:32:29 +01:00
Paolo Bonzini 9bf28f40e9 gtkdochelper: receive the build subdirectory
The helper uses a single --subdir to locate the documentation in both
the source tree and the build tree.  In a subproject built for the build
machine the build directory has a different prefix than the source
directory, so the helper wrote into and installed from the wrong place.

Pass the directory in the build tree separately as --build-subdir and use
it for the output and for the install source, while --subdir remains the
source directory.
2026-10-30 19:32:29 +01:00
Paolo Bonzini 042479d3f7 gtkdochelper: pass --headerdirs as nargs=*
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:32:29 +01:00
Paolo Bonzini 94aee3a0c8 build: add subdir and builddir to BuildProject
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:32:29 +01:00
Paolo Bonzini 5be72e1fa3 interpreter: fix validate_within_subproject for InstallDir(from_source_dir=False)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:32:29 +01:00
Paolo Bonzini df369aa3fd compilers: cython: make the sanity check advisory
Cython can be used with more than one Python installation, and the
sanity check cannot know which one a project will use.  A failure to
build the transpiled source against the default Python therefore does
not mean that the project will fail.

Split out the compiler invocation part of Compiler.sanity_check, so
that the Cython compiler can print a warning in that case and proceed
nevertheless.  Failures to transpile, however, remain an error.

Fixes: #15740
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:31:10 +01:00
Paolo Bonzini caacbd5634 ci: make one of the clang jobs use MESON_RSP_THRESHOLD=0
Ensure that any changes to clang or errors in meson's rspfile implementation
are caught, since this has just happened for GCC 16.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:30:07 +01:00
Paolo Bonzini 9150bb8004 unittests: mark tests that break with MESON_RSP_THRESHOLD 2026-10-30 19:30:07 +01:00
Paolo Bonzini d0bf2f31e6 backend: pass RSPFileSyntax to as_meson_exe_cmdline
Combine three arguments in one, while also fixing two bugs.  First,
on Windows g-ir-scanner and glib-mkenums broke for any path that had
backslashes but not spaces, because they produced a MSVC-format rsp file.
Most of the time shlex.split() would cope with it, but the Windows
quote_arg leaves arguments without spaces unquoted and shlex.split()
would treat those backslashes as escapes.

Second, the NASM format can now stop quoting arguments, which was incorrect
because nasm expects one-line-per-argument response files with unquoted
arguments.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:30:07 +01:00
Paolo Bonzini 0fd4227352 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>
2026-10-30 19:30:07 +01:00
Paolo Bonzini 7f52d67ae3 backend: introduce rsp_quote_func
Remove duplication of the choice of quoting function for MSVC/TASKING
on one side, and GCC on the other.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:30:07 +01:00
Paolo Bonzini 7d165d9640 backend: move RSP file syntax and quoting to rspfile.py
Move functions to handle RSP files out of linkers/base.py and ninjabackend.py,
so that backends.py can use them when it writes response files for custom
targets.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:30:07 +01:00
Paolo Bonzini 31204d39ec backend, compilers: fix response file format for nasm linking
When nasm is used as the link_language, the NinjaRule.write() and
NinjaBuildElement.write() methods quote respectively the rspfile_content
and the variables with gcc_rsp_quote, because NASM is neither MSVC nor
TASKING.  However, if this is used with an MSVC toolchain, link.exe then
gets GCC-style quoting.

Teach Compiler to expose different RSP file syntaxes when used for
compilation vs. linking, and use the latter when writing the ninja rule
for linking.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 19:30:07 +01:00
GeorgiaPreda a16910ba49 compilers: Fix ifx standard arguments
ifx ignores the joined argument -stand=f08. What needs to change here is that we need to emit separate arguments.

Fixes #16304
2026-10-30 07:39:42 -07:00
Dylan Baker 95cc93bbac tests: Delete temporary files being written into source dir (again)
They were accidentally committed in 67d7ddb36
Then deleted in 45bfeba38
And were accidentally committed again in e6c4e8d04

So let's not just delete them, let's add a gitignore so they don't
get re-added
2026-10-30 14:53:05 +01:00
Paolo Bonzini 9684d6b922 override_find_program: allow overriding multiple times with the same executable
override_find_program collapses `native: true` to `native: false` when
not cross compiling.  When wishing to add an override for both machines,
for example because a program has machine-independent output, this
causes the same (name, machine) pair to be overridden twice.  As a
special exception allow repeated override_find_program when the
executable is the same.

Add documentation about how to call override_find_program properly
for such a program.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-30 14:52:37 +01:00
Paolo Bonzini e323ad224b build: keep extra_files from internal dependencies
BuildTarget.__init__ assigned self.extra_files after add_deps().
The assignment discarded files that add_deps() had appended from
declare_dependency(extra_files: ...); prior to commit 97a1c567c,
files from the interpreter were added with self.extra_files.append,
instead now it has to be assigned before add_deps().

Fixes: 97a1c567c ("interpreter: Move validation of BuildTarget(extra_files) to Interpreter", 2025-11-05)
Fixes: #15863
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-28 21:06:37 +01:00
Paolo Bonzini dade896325 add notes about emscripten to platform support page
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-28 15:35:07 +01:00
Paolo Bonzini dc1ff3a4c4 add notes about windows to platform support page 2026-10-28 15:35:07 +01:00
Paolo Bonzini 0a910c9896 add notes about AIX to new platform support page
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-28 15:35:07 +01:00
Paolo Bonzini c68fddfb85 move note about macOS deployment target to new platform support page
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-28 15:35:07 +01:00
Paolo Bonzini 9114f095dc move notes about QNX to a separate platform support page 2026-10-28 15:35:07 +01:00
Paolo Bonzini f16178b261 add missing release notes for 1.13
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-28 15:35:07 +01:00
Paolo Bonzini 3797fba8c4 interpreter: avoid that add_languages_for modifies its arguments
The list can be reused in the next call to add_languages:

            success = len(langs) == len(args[0])
            success &= self.add_languages(langs, required, MachineChoice.HOST)
            success &= self.add_languages(langs, False, MachineChoice.BUILD)

Fixes: 17eb224aa
Fixes: aee7f375b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-28 06:19:39 -07:00
Paolo Bonzini 5e0f6e9865 docs: improve documentation for native in find_program and override_find_program
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
Paolo Bonzini 2b45961e1e interpreter: roll back sub-subprojects when a subproject fails
When a subproject failed, sub-subprojects were left in self.subprojects
but rolled back from the Build object.  This caused different issues
in previous versions of Meson.

Until 1.10, and specifically until commit 1eac5a5, the rollback was partly
ineffective because Build instances shared the content of PerMachine fields
(e.g. dependency_overrides) by reference.  Thus, the content of the
fields propagated to the superproject even without a merge()!
Subprojects-of-failed-subprojects were still included in the build,
because process_target_dependencies() saved the day while still leaving
behind tests, installed files and targets other than used libraries.

Since 1eac5a5 (and 1.11) the sharing bug was fixed, but on the other hand
the overrides were lost, causing warnings such as:

 glib| WARNING: Subproject 'pcre2' did not override 'libpcre2-8' dependency and no variable name specified

Rolling back sub-subprojects ensures that Meson tries them again and
that their expceted overrides are recorded in Build.

The attached test covers both failure modes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
Paolo Bonzini b46369e807 build, interpreter: move Summary to BuildProject
This has two effects.  First, it makes it possible to track summaries
separately for host- and build-machine subprojects, which was a bug
in the 1.12 implementation of build-machine subprojects.

Second, it rolls back summaries on failed subprojects, instead of having
to skip them at the end of the run.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
Paolo Bonzini 7d1df1cefb build: move Summary to build.py
In preparation for storing the summaries in Build itself, which
allows them to be rolled back for failing subprojects, make
Summary only store values that were already formatted and move
it to the build module.

The formatting and the validation of the values stay in
Interpreter.summary_impl.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
Paolo Bonzini d763cf1070 interpreter: fix inconsistent machine between do_subproject() and _do_subproject_*()
In order to check for recursive inclusion, do_subproject() looks up the
subproject using `self.build.machine_map[kwargs['for_machine']]`.
However, _do_subproject_meson() registered the holder and
pushed the subproject stack using just `kwargs['for_machine']`.
The two differ when build-machine subprojects request a subproject
with `native: false`, causing two bugs that are now fixed:

- first, a second request for the same sub-subproject did not find the first
  one, and configured it again causing a "Second call to project()" error.

- second, the host machine was incorrectly passed to the CMakeInterpreter
  for subprojects of build-machine subprojects.  CMakeInterpreter
  uses it directly to look up env.coredata, without going through the
  machine map, so the mapping must be done in the interpreter.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
Paolo Bonzini c469bd779c interpreter: fix inconsistent machine between do_subproject() and calls to self.disabled_subproject()
In order to correctly check for failing subprojects inclusion,
calls to self.disabled_subproject() need to use the correct
machine.  Ensure this is the case by making for_machine a
non-optional parameter.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
Paolo Bonzini d275d164b5 ninjabackend: allow build- and host-machine subprojects to define same-named RunTargets
Building glib as both a build- and a host-machine subproject causes
a failure in the ninja backend due to "Multiple producers for Ninja
target 'glib@@glib20-pot'".  Fix it by adding the "build." prefix to the
build-side subproject; while this does not necessarily make much sense
for the specific case of the POT update, it is the right thing to do in
general for run_target and alias_target.

The other backends do not have the same problem because they name
run targets after target.get_id().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
Paolo Bonzini 9401844c00 modules: look up overrides again in case they came from a subproject
A dependency may provide a program not just as a variable, but also
(if the dependency used a subproject fallback) as an override. So look
up overrides again in ModuleState.find_tool.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-10-27 18:34:02 +01:00
hassan 7608a50522 detect: support target-prefixed clang-cl and share sibling tool computation
Signed-off-by: hassan <144530465+h55n@users.noreply.github.com>
2026-10-27 11:49:57 +01:00
Charles Brunet ff325c87ca Raise Python to 3.13 for VC2022 pipelines
Python 3.10.11 was removed from the runner's tool cache. Images
20261012.333 and earlier had it; 20261022.344 has only 3.13, 3.14 and
the new 3.15.0

While meson still supports Python 3.10+, raising it to 3.13 here seems
reasonable since 3.10 will still be tested in other pipelines.
2026-10-26 14:05:28 -07:00
Charles Brunet 9a4f830790 msvc: use right arguments for compiling std module
With the `cpp_importstd` option and the MSVC compiler, meson now builds the
module with the arguments of the targets that matter to the compiler when it
imports the module: the C runtime, the character set, the C++ standard, the
exception and floating point options, the macros read by the standard library,
and so on. This prevents reporting a C5050 warning, which would become an error
if using `werror`. Arguments that do not matter, such as warnings, optimization
and include directories, are ignored. A module is built for each different set
of arguments, and shared by the targets that have the same one, so the files in
the build directory are named `std.<id>.ifc`.

The module is no longer built through a compiler cache, which cannot restore it.
2026-10-26 12:04:40 -07:00
Charles Brunet f552a759b7 format: fix indentation of continuation lines 2026-10-26 11:59:20 -07:00
Charles Brunet 8215a380e9 format: fix formatting of nested parentheses 2026-10-26 11:59:20 -07:00