summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-02-25Add a new test for `override_options: ['cython_language': 'cpp'])`Ralf Gommers
2025-02-25Use override value when setting up Cython language.Jussi Pakkanen
Closes #14284.
2025-02-22Fix yielding when top project does not define the option.Jussi Pakkanen
Closes #14281.
2025-02-22Permit all unknown b_ options.Jussi Pakkanen
Closes #14254.
2025-02-20Fix reconfiguration on --wipe.Jussi Pakkanen
Closes #14279.
2025-02-19build: Optimize transitive link dep resolutionCampbell Jones
In large repositories, transitive link dependency resolution using the current recursive algorithm can result in enough duplicate calls to cause the full system memory space to be used up. This commit simplifies link dep resolution by converting the currently used recursive algorithm to an iterative one that avoids performing work more than once. If a target's direct dependencies have already been processed, that target will not be processed again. These changes result in multiple orders of magnitude of improvements to dep resolution time and memory usage in the worst case. Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
2025-02-17Add restat = 1 to Swift compile ruleMarco Rebhan
The swift compiler does not update the modification time of output object files when the code has not changed. Without this, Swift targets may continuously be rebuilt.
2025-02-18Improve error message on nonexisting options.Jussi Pakkanen
2025-02-16c: add -Wno-vla-larger-than to the exceptions for -Wno*Paolo Bonzini
When supplying -Wno-vla-larger-than to compiler.get_supported_arguments, meson will inject -Wvla-larger-than as an argument which considered invalid by GCC, as the converse argument is -Wvla-larger-than=<value>. Just like CLikeCompiler._has_multi_arguments special-cases -Wno-attributes=, do the same for -Wno-vla-larger-than. Resolves: https://github.com/mesonbuild/meson/issues/14208 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-15Permit more missing b options. Closes #14254.Jussi Pakkanen
2025-02-13Make all Meson level options overridable per subproject.Jussi Pakkanen
2025-02-12build: fix typing of `Target.get_option`Dylan Baker
Which can return any of `ElementaryOptionValues`, but is currently typed as if it only returns `str | int | bool`.
2025-02-12options: Add a TypeAlias for option valuesDylan Baker
This gives us a simpler way to annotate things returning an option value, and gives us an easy single place to change that will affect everywhere if the option value types are changed.
2025-02-12modules/pkgconfig: use host machine to calculate install prefixDylan Baker
The `mesonlib.is_*` functions are not correct to use here, since they are for the build machine, not the host machine. This means if the build machine if Linux but the host is Haiku, then pkg-config files willb e installed into $libdir/pkgconfig, instead of $prefix/develop/lib/pkgconfig
2025-02-11Actually use return value of SwiftCompiler.get_working_directory_argsMarco Rebhan
2025-02-11Fix CMake import's linker args sorting algorithm mangling -framework argumentsMarco Rebhan
2025-02-11ninja backend: Use swiftc flag -working-directory if availableMarco Rebhan
This makes SourceKit-LSP work using a meson-generated compile_commands.json.
2025-02-06interpreter: fix swapped castsDylan Baker
We end up mixing Shared and Static so that we cast to Static args for Shared Libraries and vice versa.
2025-02-05options: Replace uses of `UserOption[T.Any]` with a Union of UserOption typesDylan Baker
The fact that UserOption is generic is really an implementation detail, not something to be used publicly. So by having an `AnyOptionType` alias, we can get better type checking, as can be seen by the patch as a whole. One of the big fixes it replace open-coded equivlalents of `MutableKeydOptionDictType` with that type alias.
2025-02-05options: Add a function to compare different option choicesDylan Baker
This allows us to hide type differences inside the options module, but still get accurate change information.
2025-02-05options: split UserIntegerOption and UserUmaskOptionDylan Baker
They are very similar, but they are not exactly the same. By splitting them we can get full type safety, and run mypy over the options.py file!
2025-02-05options: fix typing of add_to_argparseDylan Baker
Which wants a string, but then passes that string to a function that wants an OptionKey, which means that we'll always miss the lookup in BULITIN_DIR_NOPREFIX_OPTIONS, and return the default. The only case this gets used we cast an OptionKey to str, and then pass that. So instead, do the cast inside the function when necessary and pass the OptionKey
2025-02-05options: Add an EnumeratedUserOption classDylan Baker
This will allow us to take choices out of the UserOption class, which doesn't actually use this attribute.
2025-02-05options: use dataclasses for UserOptionDylan Baker
This reduces code, makes this clearer, and will be a nice step toward the goal of getting everything typesafe. For `UserIntegerOption` this makes a fairly nice, but substantial change in that the old method used a tuple of `(min, value, max)` to pass to the initializer, while all other types just passed `value`. The new `UserIntegerOption` does the same, with keyword arguments for the min and max values.
2025-02-05compilers: remove Compiler.create_optionDylan Baker
This saves a *tiny* bit of typing, but at the cost of requiring either the current solution of throwing up our hands and saying "typing is too hard, better to have bugs!" or an extensive amount of `TypedDict`s, `overloads`, and a very new version of mypy. Let's get our type safety back, even if it means writing a little bit more code.
2025-02-05compilers: use super().get_options() instead of CompilerClass.get_options()Dylan Baker
Because the latter doesn't always interact with the MRO correctly.
2025-02-05compilers: fix the UserStdOption name of the C and C++ compilersDylan Baker
2025-02-05options: Get rid of the invalid _U type, and use UserOption[_T]Dylan Baker
2025-02-05options: Add a printable_choices method to UserOptionDylan Baker
This provides a method to get choices for options in a printable form. The goal is to make refactoring options simpler.
2025-02-05options: fix the annotations of _to_tupleDylan Baker
2025-02-03minstall: help mypy out with our chown overridingDylan Baker
This is an annoying issue to look at, because shutil.chown has (for our purposes) three signatures: ```python chown(path: int | AnyPathLike, uid: int | str, group: None = None) -> None: ... chown(path: int | AnyPathLike, uid: None, group: int | str) -> None: ... chown(path: int | AnyPathLike, uid: int | str, group: int | str) -> None: ... ``` This is a really difficult thing to guarantee from our code. We more or less depend on being able to pass two parameters of `None | int | str`, and it working. In our only caller we do ensure that at least one of the variables is not None, but convincing mypy of this is more work than it's worth. This will show up in our CI only for python >= 3.13. An updated typshed will make this show up for earlier versions, however. Pyright (which is used by the VSCode Python extension) will spot this for earlier versions. I have changed the code in such a way to make our CI turn green.
2025-02-04ci: Update appleclang job to test Xcode-provided PythonL. E. Segovia
2025-02-04unittests: Unbreak Python bytecompile tests with Xcode PythonL. E. Segovia
Apple sets sys.pycache_prefix to an user-wide cache folder, so it needs to be prepended to the root for the glob to work correctly.
2025-02-04Python: fix typo in the inserted workaround for missing RPATHL. E. Segovia
See #14169
2025-02-03rust: use f-string to build rpath argumentsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-03ninjabackend: remove cratetype variablePaolo Bonzini
Since we're going to split generate_rust_target() in multiple functions, eliminate the only variable that spans large parts of it. The cratetype ninja variable has been unused since Meson started invoking rustc directly nine years ago (commit d952812b1, "Fix Rust to work with 1.3 release. Closes #277.", 2015-10-11). Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-03ninjabackend: start adjusting for differences between rustc and rustdocPaolo Bonzini
Add functions to RustCompiler() to account for differences between rustc and "rustdoc --test": rustdoc always generates a binary, does not support -g, and does not need --emit. Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-03rust: stop using --out-dir, move depfile into private directoryPaolo Bonzini
Since the introduction of dep-info=... it is possible to move the depfile away from the main build directory without using --out-dir. This is less surprising, since the rules for mixing --emit, --out-dir and -o are not really documented. Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-03ninjabackend: unify building rpath argsPaolo Bonzini
Implement RustCompiler.build_rpath_args, so that more code can be shared between non-Rust and Rust targets. Then, RustCompiler can override it to convert the arguments to "-C link-arg=" and add the rustup sysroot. Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-03ninjabackend: rust: remove code duplicationPaolo Bonzini
Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-02-03ninjabackend: rust: fix incorrect use of abspathPaolo Bonzini
os.path.abspath of the target subdir is not guaranteed to give a sensible answer; depending on what directory you run meson from, it could build an absolute path relative the source directory or the build directory or possibly neither one. In fact, using os.path.abspath is quite rare in Meson's code and generally only done in code like subdir = os.path.abspath(os.path.join(self.sourcedir, target['subdir'])) or ndir1 = os.path.abspath(os.path.realpath(dir1)) While at it, don't use getattr unnecessarily, the cratetype is available. Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-01-31Fix PATH for SharedModule in Windows devenvCharles Brunet
SharedModule (like Python extension modules) are loaded dynamically. Therefore, they cannot be detected from executable dependencies, and we must call `determine_windows_extra_paths` on them as well. Also, those extra paths need to be computed even if the module or the executable is not installed in the default location.
2025-01-31mformat: try to detect meson.format in source files' parent directorieswrvsrx
2025-01-31utils: Use dataclasses for PerMachine classesDylan Baker
This allows us to simplify the initializers, as well as remove our custom repr methods.
2025-01-31utils: Fix nullability of PerMachine from default_missingDylan Baker
A Defaultable PerMachine has a type of `None | T`, in other words, they have a base type of `PerMachine[None | T]`, but the purpose of `PerMachine.default_missing()` is to get a `PerMachine[T]` from that `PerMachine[None | T]`, therefore we should ensure that and annotate that.
2025-01-30Python: Work around missing rpath in Xcode python3-embedL. E. Segovia
This enables generating Python bindings and linking against `python3-embed` without resorting to later `install_name_tool` changes, as the pkg-config module provided by Xcode doesn't say that Python3.framework requires a rpath entry: $ otool -L /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Python3 /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Python3: @rpath/Python3.framework/Versions/3.9/Python3 (compatibility version 3.9.0, current version 3.9.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1933.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
2025-01-30Mention add_dist_script in meson dist docs (#14186)Otto Moerbeek
2025-01-30symbolextractor: generate symbol files for cross-compiled WindowsSteve Lhomme
2025-01-29Fix call to object_filename_from_source in vs2010Charles Brunet
There was a missing parameter in one call. This was caused by b95e1777ddbf0f8aebb56b84a6011468088c06ec
2025-01-29swift: Fix duplicate SDK include paths causing a compile errorPiotr BrzeziƄski
Some dependencies can bring include paths pointing to older macOS SDK's. In this case, it was libffi pointing to SDK from 12.0. When the Foundation framework is imported in Swift, swiftc attempts to import the FFI module from the most recent version of the SDK, which causes a compilation error because of conflicting definitions between the two SDK versions. SwiftPM also had this problem: https://github.com/swiftlang/swift-package-manager/pull/6772 The solution on our side is a simplified version of what SwiftPM did. Let's naively look for .sdk paths in the compile args of our dependencies and replace them with the most recent one. I included a test which is confirmed to fail without the workaround added in this patch. This was not tested on anything else than macOS, but I don't expect it to make the situation worse in any case.