aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2025-06-03gnome.mkenums: Fix get_executable_serialisation passing ExternalPrograms ↵L. E. Segovia1-3/+1
script without interpreter This is an indirect regression of e8c715786d85dcdbc367f3e379acae25a899c235; the code never accounted for ExternalPrograms that needed a harness.
2025-06-03cmake: Fix target_link_libraries against project targetsL. E. Segovia2-5/+23
These were supported for shared libraries, but for static libraries the link_with property was never populated with `LINK_LIBRARIES` or `INTERFACE_LINK_LIBRARIES`. Fixes #13101
2025-06-03wrap: Lock subproject directory when downloading wrapsFlorian "sp1rit"​1-2/+14
To avoid raceconditions, where one instance of meson currently downloads a subproject defined in a wrapfile, while another either a. starts the download itself too b. attemts to evaluate the partially downloaded subproject wraplock introduces a lockfile, which should prevent simultaneous access of subprojects by wrap between different instances of meson.
2025-06-03utils: Replace BuildDirLock with generic DirectoryLockFlorian "sp1rit"​4-23/+53
DirectoryLock provides a generic locking implementation the replaces the previously used BuildDirLock.
2025-05-31cargo: Add support for target specific dependenciesXavier Claessens3-5/+34
2025-05-31cargo: Do not convert cfg() to Meson ASTXavier Claessens1-57/+17
We'll need to evaluate those expressions before generating the AST. Instead take a config key-value dictionary and evaluate the expression to return a boolean.
2025-05-31cargo: Fix cfg() parsingXavier Claessens1-50/+51
Add cfg token to be able to parse the top level cfg() function. Fix parser which was creating a new iterator when recursing which caused the caller function's iterator to not have advanced when recursing function returns.
2025-05-31Vala: Fix GResource source directoriesJames Westman1-1/+1
The code that adds `--gresourcesdir=` arguments to valac based on the source directories of GResource dependencies was incorrect. It added the current target directory to the source path, but the GResource source directories are already relative to the build directory.
2025-05-30cargo: set edition for build machine as wellPaolo Bonzini1-0/+1
This fixes compilation of glib-macros-0.20.4: error[E0405]: cannot find trait `TryFrom` in this scope --> ../subprojects/glib-macros-0.20.4/src/clone.rs:22:10 | 22 | impl<'a> TryFrom<&'a Ident> for CaptureKind { | ^^^^^^^ not found in this scope | = note: 'std::convert::TryFrom' is included in the prelude starting in Edition 2021 help: consider importing this trait | 3 + use std::convert::TryFrom; | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-29cuda: use target-specific paths under CUDA Toolkit on LinuxMaxandre Ogeret1-9/+15
2025-05-29rewriter: Bugfix concerning `UnknownValue`Volker Weißmann3-5/+12
Without this commit, the static introspection tool crashes when introspecting systemd since certain values are `UnknownValue` which was unexpected. (I tested sytemd's commit hash fefcb935cd.)
2025-05-29rewriter: Rewrite how we add/remove source filesVolker Weißmann5-209/+278
Change the semantics of IntrospectionBuildTarget.source_nodes and IntrospectionBuildTarget.extra_files . The rewriter and the static introspection tool used to be very broken, now it is *less* broken, hence we add some tests in this commit. Fixes #11763
2025-05-29rewriter refactoring: Add rm_src_or_extraVolker Weißmann1-82/+63
De-duplicate some code by extracting the common code into the new `rm_src_or_extra` function.
2025-05-29rewriter: Improve find_target and find_dependencyVolker Weißmann2-49/+54
2025-05-29mesonbuild/ast: make mypy safeVolker Weißmann1-8/+6
2025-05-29Add AstInterpreter.funcvalsVolker Weißmann2-15/+112
`AstInterpreter.node_to_runtime_value` can now resolve function calls.
2025-05-29AstInterpreter: Replace resolve_node with node_to_runtime_valueVolker Weißmann4-121/+31
`resolve_node` is simply a half-broken, worse implementation of `node_to_runtime_value` that we recently introduced. In the example below, the static introspection tool/rewriter now understands that the name of the executable is foo instead of bar: ``` var = 'foo' name = var var = 'bar' executable(name, 'foo.c') ```
2025-05-29rewriter: Remove apparently useless code.Volker Weißmann1-20/+0
Without this commit, something like this crashes the static introspection/rewrite tool: ``` default_options : ['warning_level=' + run_command(['echo', '3']).stdout().strip()], ``` This commit does not reintroduce #14382.
2025-05-29Add AstInterpreter.dataflow_dagVolker Weißmann1-0/+229
Make the AstInterpreter create a directed acyclic graph (called `dataflow_dag`) that stores the how the data flowes from one node in the AST to another. Add `AstInterpreter.node_to_runtime_value` which uses `dataflow_dag` to find what value a variable at runtime will have. We don't use dataflow_dag or node_to_runtime_value anywhere yet, but it will prove useful in future commits.
2025-05-29AstInterpreter: Fix evaluate_* functionsVolker Weißmann1-33/+23
Some of the evaluate_* functions in AstInterpreter seem very broken and do not even evaluate all of the AST. I do not know what the original author thought, so I just fixed it.
2025-05-29rewriter: Refactoring of assignment trackingVolker Weißmann2-10/+8
Replace `AstInterpreter.reverse_assignment` with `AstInterpreter.all_assignment_nodes`. This does not give us an immediate advantage but will be useful in future commits.
2025-05-29rewriter: Replace assignments with cur_assignmentsVolker Weißmann5-29/+147
Replace the variable tracking of `AstInterpreter.assignments` with a slightly better variable tracking called `AstInterpreter.cur_assignments`. We now have a class `UnknownValue` for more explicit handling of situations that are too complex/impossible.
2025-05-29Add AstInterpreter.nestingVolker Weißmann1-0/+4
The AstInterpreter now stores how deep into if/elif/else we are. This is currently dead code, but it will be read in future commits.
2025-05-29rewriter.py: make type safeVolker Weißmann3-104/+136
2025-05-29rewriter: Add IntrospectionDependencyVolker Weißmann4-25/+35
To improve type-safety and readability we replace a dictionary with a new class `IntrospectionDependency`.
2025-05-29rewriter: Add IntrospectionBuildTargetVolker Weißmann4-63/+81
To improve type-safety and readability we replace a dictionary with a new class `IntrospectionBuildTarget`.
2025-05-29Refactoring and removal of dead codeVolker Weißmann3-30/+9
2025-05-29parser: Fix colno after multiline stringsVolker Weißmann1-1/+1
Without this commit, meson thinks that the `var` token in the code below starts at a different column number than it actually starts, because the old author forgot to account for the length of the triple quotes. ``` ''' some multiline strings abc''' + var ```
2025-05-29AstPrinter: Add parenthesis where neccessaryVolker Weißmann1-2/+44
2025-05-29parser: Simplify precedence levelsVolker Weißmann1-27/+25
The parser should behave exactly as before, but the code is a bit easier to understand now.
2025-05-29AstPrinter: Use str.translate instead of str.replaceVolker Weißmann1-1/+3
2025-05-29rewriter: Don't ignore the `name_prefix` kwargVolker Weißmann1-1/+1
2025-05-26vs2010backend: fix EmbedManifest state when /MANIFEST:EMBED is usedPeter Harris1-3/+5
With introduction of dfd8cfbd8d9c VS compile is broken for cases where /MANIFEST:EMBED linker flag is actually used. The fix keeps the default creation of <EmbedManifest> but adopts the same strategy as e3db7af0ea41, that is to scan the link flags for the embed case to decide state is emit 'true' or 'false' for EmbedManifest.
2025-05-26vs2010backend: Escape linker argumentsPeter Harris1-2/+3
This allows linker arguments containing a space (or other special character) to pass through to the linker correctly. For example, the spaces in "test cases/windows/25 embed manifest" when using meson.project_source_root().
2025-05-23cmake: Fix toolchain including unsupported languagesL. E. Segovia2-2/+8
The most egregious cases are Nasm (which needs to be transformed to `ASM_NASM`) and Rust (which is not yet supported by CMake). See https://cmake.org/cmake/help/v4.0/command/project.html
2025-05-23options: process project options before machine optionsPaolo Bonzini1-15/+15
Restore the behavior from before commit d37d649b0 ("Make all Meson level options overridable per subproject.", 2025-02-13). The old code was: options: T.MutableMapping[OptionKey, T.Any] = OrderedDict() # process project default options for k, v in default_options.items(): if not subproject or k.subproject == subproject: options[k] = v # override them with machine default and command line options options.update(env.options) env.options = options Fixes: #14608 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-23gnome: initialize CFLAGS environment variable to linker argumentsPaolo Bonzini1-1/+1
The CFLAGS environment variable is used for g-ir-scanner's linking pass, It is emptied since commit 237513dff ("modules/gnome, modules/Python: Allow injecting RPATH flags through LDFLAGS if needed", 2025-04-09); which could even be considered a bugfix if it didn't break Fedora quite badly. I could not write a testcase, but the culprit seems to be the -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 that Fedora places in CFLAGS. The file contains *cc1_options: + %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} and the lack of -fPIE option upsets the linker. Fix by priming the contents of the CFLAGS variable with the c_link_args being used for the build. Fixes: #14631 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-23gnome: fix typo in creating gir flagsPaolo Bonzini1-2/+2
Append to scan_env_ldflags instead of overwriting it. Fixes: #14631 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-23vulkan: Extract Vulkan version in SDK pathArjan Molenaar1-1/+1
This change ensures that Vulkan will be found in the path defined by the VULKAN_SDK env var. This is the case when the Vulkan SDK is not installed in a well-known location (/usr, /usr/local), but in a user's home folder.
2025-05-23vulkan: Make VK_SDK_PATH optionalArjan Molenaar1-6/+3
VULKAN_SDK is the preferred environment variable to point to the Vulkan installation. With this change the old variable (VK_SDK_PATH) is made optional.
2025-05-22support .version() for overridden executablesFlorian "sp1rit"​5-6/+32
Also ensure that .get_version() can be called on the output of _find_tool by the modules (kind of required for #14422).
2025-05-22gnome.mkenums: Allow passthrough of ExternalPrograms to enable converting ↵L. E. Segovia3-9/+16
only the real arguments to response file
2025-05-22gnome.mkenums: Use rspfiles on Windows when possibleL. E. Segovia4-2/+28
Fixes #6710
2025-05-21options: accept build options in --reconfigure or "meson configure"Paolo Bonzini1-0/+3
Make more of the first-invocation logic apply to subsequent configuration of the build tree. This also opens the door for using set_option_maybe_root for the first invocation. This is a huge cleanup but also a larger change, and therefore not something for stable branches. Leave it for later. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-21options: accept compiler and built-in options in --reconfigure and "meson ↵Paolo Bonzini1-2/+7
configure" Follow the same logic that is used at the end of the first invocation. This fixes meson setup --reconfigure -Db_ndebug=true on a project that has no language that defines b_ndebug. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-21options: commonize code to accept unknown optionsPaolo Bonzini2-17/+22
The check for unknown options is duplicated in OptionStore and MesonApp. Place the better version of the two as a new method of OptionStore, and use it in OptionStore.validate_cmd_line_options. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-21options: remove unnecessary Union[OptionKey, str]Paolo Bonzini1-7/+3
classify_D_arguments returns a list with OptionKeys in it. Rename the function so that the difference with set_option is clear. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-21cuda: look for stubbed libraries tooDavid Seifert1-1/+8
Some libraries in CUDA are stubbed out to load the actual implementation from the driver at runtime. One example is NVML, that only exists in `stubs/`. Ensure that the stubs dir is searched last, like FindCUDAToolkit.cmake: https://github.com/Kitware/CMake/blob/4f2482700b6a6231c697b1178239acf76955bfeb/Modules/FindCUDAToolkit.cmake#L1163-L1173
2025-05-21cuda: avoid `-l` arguments for linkingDavid Seifert1-21/+22
When trying to pick between a CUDA library that has both shared and static libraries and the same basename, e.g. `libnvidia-ml.a` and `libnvidia-ml.so`, it becomes impossible to pick a specific variant with `-l` arguments.
2025-05-21compilers: add option for ignoring system dirsDavid Seifert6-15/+15