summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)Author
2025-10-20interpreter: port dependency include_type to typed_kargsDylan Baker
The cleanup this allows lower down points out that we don't properly validate the value passed to `as_system()`. I have no idea what happens if you pass a non-valid value, but it's a bug and I've simply made it a hard error. We can re-assess if necessary.
2025-10-20dependency: Use a TypedDict to describe the keyword arguments to DependencyDylan Baker
This allows us to check that all of the keyword arguments are of the correct type.
2025-10-16build: do not pass Interpreter to Generator.process_filesPaolo Bonzini
All that is needed is the subdir, pass it explicitly (and make it an optional argument so that the backend does not have to pass it). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-16build: store Environment in GeneratorPaolo Bonzini
Objects like targets already store the environment in which they were created, do the same for Generator: pass it to the constructor and use it in process_files. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-16qt: remove stale commentPaolo Bonzini
There is no generator list in the Interpreter. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-15revert local_program()Eli Schwartz
This reverts https://github.com/mesonbuild/meson/pull/15107 Explicit objections regarding the design were raised and not answered, so it shouldn't have been merged. It needs to be discussed and revisited.
2025-10-15build: remove validation for name prefix and suffixDylan Baker
2025-10-15build: use a TypedDict for Executable kwargsDylan Baker
2025-10-15build: Add a TypedDict for BuildTarget keyword argumentsDylan Baker
This has the "processed" keyword arguments that the interpreter is supposed to create for us, or that we expect internal users to build by build. This requires some hacking around in the rust module for the moment because we suddenly have a type.
2025-10-15Add common ABC for ExternalProgram and LocalProgramXavier Claessens
2025-10-15Replace OverrideExecutable and OverrideProgram with LocalProgramXavier Claessens
2025-10-15Add support for LocalProgram to override_find_program()Xavier Claessens
2025-10-15module/rust: set _FILE_OFFSET_BITS=64 for bindgenDavid Rheinsberg
Meson sets 64-bit offsets as the default for all platforms but MSVC. Lets do the same for bindgen, to ensure we get compatible definitions. Do this by calling `get_always_args()` on the first C'ish host compiler we can find. Note that the `libc` crate does not expose 64-bit types as the default and there is no intention to do so. Instead, it exposes 32-bit default types, plus the 64-bit extended types with the `*64` suffix. This is quite unfortunate, but it seems unlikely to change [1]. However, use of `bindgen` is usually not tied to the `libc` crate. Instead, it is tied to whatever other C code in the same project does. And Meson sets `_FILE_OFFSET_BITS=64` unconditionally for all this C code. It thus seems much more plausible for Meson to also imply it for bindgen. Given that Rust code that uses the `libc` crate very likely already uses the `*64` suffixed variants, they are unaffected by whether `_FILE_OFFSET_BITS=64` is set. If they use `libc::off_t`, they already explicitly state that they use the 32-bit variant on 32-bit platforms. Hence, it is inherently incompatible to C code that uses `_FILE_OFFSET_BITS=64`. And lastly, if a Meson project is Rust-only, but generates its internal code from its public C headers, then it is better suited to actually call `add_language('c')` and ensure that Meson knows what the compiler configuration for the target platform actually is. Otherwise, bindgen cannot know what platform options to enable. Hence, warn loudly if `rust.bindgen()` is used without a configured C compiler (even if the compiler used by bindgen does not necessarily match the configured one). [1] https://github.com/rust-lang/libc/issues/3223#issuecomment-2033298952
2025-10-14Detect dependency changes in Windows rc compilerCharles Brunet
The `rc.exe` resource compiler neither provides *depfile* support nor allows showing includes, as is possible with C or C++ compilers. Therefore, changes to files included by the `.rc` file did not trigger recompilation of the resource file. A workaround was added to *meson* by calling the preprocessor on the `.rc` file to detect the included headers and adding the result as a dependency to the resource compilation.
2025-10-14Make use of build TypeAliasesDylan Baker
There are a lot of spelled out unions for these types, lets reduce that number
2025-10-14pkgconfig: Improve handling of empty string depsEyal Itkin
Fix the original bug fix for #13950 to only warn about empty required strings, instead of failing the entire build. This will simplify the workflow for users that build the string from a possibly empty list, and save them the need for the added if-check. Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
2025-10-11pkgconfig: Handle malformatted string dependenciesEyal Itkin
Add missing checks for correctness of string dependency, including case for malformatted versioned dependency. Resolves #13950. Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
2025-10-06hotdoc: remove HotdocTargetBuilder.get_valuePaolo Bonzini
The method is unused since commit c8aecc768 ("hotdoc module: add partially typed kwargs", 2022-10-24). Found while looking for callers of OptionStore.get_value. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-06options: replace get_value with get_value_forPaolo Bonzini
The two methods are identical. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-01Allow CustomTarget source for i18n.xgettextCharles Brunet
Fixes #15054
2025-09-26modules/dlang: Fix typing issuesDylan Baker
The majority of this is just adding annotations to convince mypy that everything is okay. There is one place where there is a real change, which is validating that the keyword arguments (which are unbound) are of a valid type to be encoded as JSON.
2025-09-25mypy: enable allow-redefinition-new and fix falloutEli Schwartz
Reduces 3 errors that show up in newer mypy versions than pinned in CI. It is new since 1.16 and a likely future default for mypy 2.0. It allows things like: ``` for i in ['one', 'two', 'three']: frob_a(i) for i in [1, 2, 3]: frob_b(i) ``` since "i" is obviously used as a loop holder and its type can be freely reinvented. Note: allow-redefinition-new isn't actually about this at all, it has greater scope than loop holders and allows redefining "unannotated variables" of all kinds. No granularity in what to accept redefinition of. :P To enable this, we must also opt in to local-partial-types, which has some overlap with None-safety. Specifically: > the most common cases for partial types are variables initialized > using None, but without explicit X | None annotations. By default, mypy > won’t check partial types spanning module top level or class top level. > This flag changes the behavior to only allow partial types at local > level, therefore it disallows inferring variable type for None from two > assignments in different scopes. So with this, we also fix a couple of actual type errors this revealed. Where possible, stop None-initializing at all -- it's not strictly needed for global variables, anyway, and it's a coding error if it is possible to hit these variables without defining them first. Bug: https://github.com/python/mypy/issues/19280
2025-09-11Document internal dep support in pkgconfig.generate `requires` argBenjamin Gilbert
Added in #14750 for 1.9.0. Also add FeatureNew.
2025-09-04gnome: Add missing install tag for vapi .deps fileThomas Mühlbacher
2025-08-28python: add a python.build_config option (PEP 739)Filipe Laíns
Signed-off-by: Filipe Laíns <lains@riseup.net> Signed-off-by: Michał Górny <mgorny@quansight.com>
2025-08-26Print external project logfile on CI systemsTobias Diez
2025-08-20Revert "gnome: support generate_gir on cross builds"Jussi Pakkanen
This reverts commit 5e627c9b421a4cebb0e112af6a432fec66640c28.
2025-08-17gnome: Restore dependency of g-ir-scanner on gobject-introspectionL. E. Segovia
g-ir-scanner is a pair of Python script + pymod, and the latter must be available at any time the script is executed. The changes in the below commit removed the ordering guarantee, breaking GStreamer introspection building on Windows when using the monorepo. This reverts commit ab57be75148c2faac67dba7877167772410ca5ef. Fixes #14908
2025-08-01interpreter: move dependency kwargs to shared moduleDylan Baker
We're going to use this in the Python module as well.
2025-08-01move rpath functions from Backend to BuildTargetCharles Brunet
It is more logical, since those functions depend on a build target, and do not require anything specific to the backend. Furthermore, it will allow us to call determine_rpath_dirs from the linker in a following commit, without the need to depend on the backend.
2025-08-01modules/pkgconfig: Resolve dependencies in case of an internal dependencyCorentin Noël
When giving a dependency object as requires, allow to use the dependency from a subproject (that is an InternalDepdency).
2025-08-01gnome: make ToolType an alias and use itFlorian "sp1rit"​
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2025-08-01gnome: early exit from _gir_has_option if g-ir-scanner is executableFlorian "sp1rit"​
_gir_has_option runs g-ir-scanner --help | grep <option> to determine if the current version of g-ir-scanner supports a particular option. This already early exists if g-ir-scanner is a OverrideProgram, as it cannot be executed if it is (technically OverridePrograms can actually be executed during configure time, but not g-ir-scanner; as it depends on native modules). Do the same in case g-ir-scanner is an executable (it currently isn't but I might want to move it into one, as to avoid the rule-dependency issue with the aforementioned native module)
2025-08-01gnome: support generate_gir on cross buildsFlorian "sp1rit"​
This requires g-ir-scanner >=1.85.0, if this isn't the case we'll just fail.
2025-08-01gnome: Provide fallback for legacy gi-scanner without --versionFlorian "sp1rit"​
The --version argument was only added in g-ir-scanner 1.58, but the bionic ci still uses g-ir-scanner 1.56. Don't fail if that is the case and assume the version comparison is void.
2025-08-01gnome: Don't rely on gobject-introspection-1.0 anymoreFlorian "sp1rit"​
There isn't really any point in doing this, given that it doesn't provide any headers & libraries by itself and means projects that conditionally build introspection behind a feature only need to check for the existence of g-ir-scanner, not gobject-introspection-1.0 anymore.
2025-07-24Add suffix function to the fs moduleJouke Witteveen
2025-07-24Work around os.path.isabs bug in fs moduleJouke Witteveen
2025-07-24Restructure fs module in terms of os.pathJouke Witteveen
2025-07-21rust: only allow rust.doctests if the target is a cratePaolo Bonzini
Rust doctests implicitly use the base target as a crate. This is not possible unless the target uses the Rust ABI. If someone uses a C-ABI target with rust.doctest(), you get an unresolved module error and it is not clear what's really going on, so add a more specific error. Cargo does the same, though it only reports a warning. Fixes: #14813 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-21gnome.generate_gir: Use rspfiles on Windows when possibleL. E. Segovia
I ran into GStreamer's CI being overwhelmed by a 5k long command line to g-ir-scanner. This will help bypass the limitation. See https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/532 See #6710
2025-06-17modules: convert custom holders to InterpreterObject.methodPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-06-09modules/gnome: Allow to generate markdown and reStructuredText dbus docCorentin Noël
gdbus-docgen supports reStructuredText output since 2.71.1 and markdown since 2.75.2, allow to simply generate it.
2025-05-23gnome: initialize CFLAGS environment variable to linker argumentsPaolo Bonzini
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 Bonzini
Append to scan_env_ldflags instead of overwriting it. Fixes: #14631 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-22support .version() for overridden executablesFlorian "sp1rit"​
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: Use rspfiles on Windows when possibleL. E. Segovia
Fixes #6710
2025-05-13rust: skip doctests when build machine cannot run host binariesPaolo Bonzini
"rustdoc --test" relies on running host binaries, and has no way of wrapping them with Meson's exe_wrapper. Just skip the doctests in that case. Fixes: #14583 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-06Add license keyword to pkgconfig generateCharles Brunet
Fixes #14270.
2025-05-06do not use len to check emptynessCharles Brunet