summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-12-19scripts: convert run_tool to asyncioPaolo Bonzini
This improves the handling of keyboard interrupt, and also makes it easy to buffer the output and not mix errors from different subprocesses. This is useful for clang-tidy and will be used by clippy as well. In addition, the new code supports MESON_NUM_PROCESSES. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19scripts: rename run_tool to run_clang_toolPaolo Bonzini
Differentiate from the "run_tool_on_targets" function that will be introduced in the next commit. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19scripts: make clang tools obey b_coloroutPaolo Bonzini
Right now, the clang-tidy and clang-format targets use the program default and do not let b_colorout decide whether to colorize output. However, the wrappers that run the tool are going to be changed to buffer output, and that would disable colorization unconditionally. So pass a --color option to the tools and use it when building the command line. clang-format's -fcolor-diagnostics option simply does not work, and the "right" (or at least working) option is --color which is undocumented. --color is present all the way back to clang 10, but I digged into clang-format's source code to figure out what's happening. The problem is that -fcolor-diagnostics is a complete no-operation; in fact it is a bool that is initialized to true. gdb shows: (gdb) p ShowColors $2 = {<llvm::cl::Option> = { ... <llvm::cl::opt_storage<bool, false, false>> = {Value = true, ... }, ...} on entry to clang-format's main, meaning that specifying the option on the command line does nothing at all. To see how clang-format determines whether to use colors you need to look at enters SMDiagnostic::print, which simply does ColorMode Mode = ShowColors ? ColorMode::Auto : ColorMode::Disable; showing once more that in fact the option cannot force-on the colors ( -fno-color-diagnostics instead works). Continuing in SMDiagnostic::print, this RAII constructor would write the escape sequence to the terminal: WithColor S(OS, raw_ostream::SAVEDCOLOR, true, false, Mode); It ends up in WithColor::changeColor, which does if (colorsEnabled()) OS.changeColor(Color, Bold, BG); Digging further down, colorsEnabled() is where the Mode member is consulted: bool WithColor::colorsEnabled() { switch (Mode) { case ColorMode::Enable: return true; case ColorMode::Disable: return false; case ColorMode::Auto: return AutoDetectFunction(OS); } llvm_unreachable("All cases handled above."); } and the "AutoDetectFunction" is static bool DefaultAutoDetectFunction(const raw_ostream &OS) { return *UseColor == cl::BOU_UNSET ? OS.has_colors() : *UseColor == cl::BOU_TRUE; } UseColor is controlled by the "--color" option, so if that option was unset you go to OS.has_colors() even in the presence of -fcolor-diagnostics. This has been around for over 5 years in clang-format, and it was present even earlier, so use it in meson as well. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19introspect: add machine to target_sourcesPaolo Bonzini
Even though the "targets" introspection info already includes the command line arguments used to invoke the compiler, this is not enough to correlated with the "compilers" introspection info and get extra information from there. Together with the existing "language" key, adding a "machine" key is enough to identify completely an entry in the compilers info. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19mtest: move determine_worker_count to utils, generalizePaolo Bonzini
It is useful to apply a limit to the number of processes even outside "meson test", and specifically for clang tools. In preparation for this, generalize determine_worker_count() to accept a variable MESON_NUM_PROCESSES instead of MESON_TESTTHREADS, and use it throughout instead of multiprocessing.cpu_count(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19mtest: do not import from mintroPaolo Bonzini
import mintro and its attendant module dependency tree just so we can programmatically get filenames which are documented as a stable API in https://mesonbuild.com/IDE-integration.html. Suggested-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19utils: optimize PerMachinePaolo Bonzini
There is no need to create and look up a dictionary when MachineChoice is an enum, and there is no need to create a PerMachine object on every __setitem__ of another PerMachine object. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-16dependencies: support old vulkan SDK versionVíctor Manuel Jáquez Leal
In old versions of Vulkan SDK, VK_SDK_PATH environment variable was used instead of VULKAN_SDK. This patch check both environment variables is fallback mode.
2024-12-16Handle top level options set in subprojects. Closes #13847.Jussi Pakkanen
2024-12-16Xcode backend: better quoting for spaces in HEADER_SEARCH_PATHSNick
Xcode treats this dict value as a space-separated string, any spaces in the path will make the path invalid by splitting it into pieces. Split out header path processing into a helper function.
2024-12-10compilers: Pass `vs_module_defs` with `/DEF:` to LLD-LINKLIU Hao
Recently, it is possible to install Clang with Visual Studio Installer. By default this Clang has a MSVC target, and invokes the Microsoft Linker; if `-fuse-ld=lld` is specified, it will invoke LLD-LINK. Both linkers take MSVC-style arguments, and take DEF files with `/DEF:<path>`. Previously DEF files were passed in the GNU way, directly on the linker command line like an object file, which caused errors like lld-link: error: ..\my.def: unknown file type While Clang-CL takes Unix-style options, it actually passes MSVC-style options to LINK or LLD-LINK with `-Wl,`. There is already a check for both linkers in `linker_to_compiler_args()`, so it's necessary to do the same in `gen_vs_module_defs_args()`. This commit closes https://github.com/mesonbuild/meson/issues/13988. Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-12-10separate mesondefine and cmakedefine logicJan200101
2024-12-10ci: fix Ubuntu Bionic jobSam James
Do the same as https://github.com/pytorch/test-infra/pull/5959 and download an old nodejs to keep Ubuntu Bionic working. Bug: https://github.com/actions/checkout/issues/1809 Bug: https://github.com/actions/runner/issues/3373
2024-12-09modernize Rust templatePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-06interpreter: fix type issues with vcs_tag updatesDylan Baker
The annotations weren't updated to reflect the changes.
2024-12-06format: allow input from stdinCharles Brunet
Fixes #13791
2024-12-06fix generate_gir with BothLibraries dependencyCharles Brunet
Co-authored-by: Xavier Claessens <xclaesse@gmail.com>
2024-12-06mtest: rust: allow parsing doctest outputPaolo Bonzini
Doctests have a slightly different output compared to what "protocol: rust" supports: running 2 tests test ../doctest1.rs - my_func (line 7) ... ignored test ../doctest1.rs - (line 3) ... ok test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.12s Add a little more parsing in order to accept this; a simple minded split() fails to unpack the tuple. I plan to contribute an extension of the rust module to invoke doctests, for now this allows running rustdoc --test with "protocol: 'rust'" and get information about the subtests: ▶ 4/8 ../doctest1.rs:my_func:7 SKIP ▶ 4/8 ../doctest1.rs:3 OK 4/8 rust_unit_tests:doctests / rust doctest OK 0.28s 1 subtests passed Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-06libgcrypt-config is no more on ubuntu-rollingPaolo Bonzini
2024-12-06add netinet/sctp.h to FedoraPaolo Bonzini
It is needed by objfw. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-06Fix ugly path after path join with the empty dirnameNick
2024-12-06Slightly fix compiler args order for the Xcode backendNick
Reorder compile args so that target has a chance to override options set by its dependencies. Fix piling up of custom target include paths.
2024-12-04env2mfile: add flag to use _FOR_BUILD envvars.Jussi Pakkanen
2024-12-03cargo: Fix crash when enabling feature on dev/build dependenciesXavier Claessens
2024-11-29environment: Never require an exe_wrapper for native buildsSimon McVittie
It is possible to run a container or chroot with one ABI on a CPU and kernel that would normally have a different ABI, most commonly by running a 32-bit container on a 64-bit CPU and kernel. When we do a native build in such an environment, the build and host architectures are both equal to the architecture of the container, and it is safe to assume that we can run executables from that architecture, because if we could not, we wouldn't be running Python successfully. Until now, we have been handling this by adding explicit special cases in `machine_info_can_run()` for each known-good combination of the detected CPU and the host architecture: every x86_64 can run x86 binaries, and every mips64 is assumed to be able to run 32-bit mips binaries. However, the equivalent would not be true on ARM systems: *most* aarch64 CPUs can run arm binaries, but not all (according to Wikipedia, ARM Cortex-A34 is an example of a purely 64-bit CPU that cannot execute 32-bit instructions). Instead, assume that if we are doing a native build (not a cross build), by definition we can run build-architecture executables, and since the host architecture is equal to the build architecture during a native build, this implies that we can run host-architecture executables too. This makes the behaviour of `need_exe_wrapper()` consistent with `meson.can_run_host_binaries()`, which in turn avoids `Compiler.run()` failing with error message "Can not run test applications in this cross environment" during native builds even though `meson.can_run_host_binaries()` has previously succeeded. Resolves: https://github.com/mesonbuild/meson/issues/13841 Signed-off-by: Simon McVittie <smcv@debian.org>
2024-11-27Add VS preview version.Jussi Pakkanen
2024-11-20rust: fix computation of library directoryPaolo Bonzini
Using a rustup-based toolchain fails the "rust/2 sharedlib" test for me: ./prog: error while loading shared libraries: libstd-211931512faabf29.so: cannot open shared object file: No such file or directory This happens because recent rustup places the standard library under SYSROOT/lib/rustlib/TARGET/lib. Retrieve the right directory using "--print target-libdir". This also provides a more accurate version for rustc installed in /usr. Before: $ echo $(/usr/bin/rustc --print sysroot)/lib /usr/lib After: $ /usr/bin/rustc --print target-libdir /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib While at it, cache the value to avoid repeated process invocation. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-11-20run_single_test.py: skip setup_symlinks() call on WindowsLuca Bacci
2024-11-20Remove trailing full stops from entries in list of usersNoah Gitsham
Makes all entries consistent
2024-11-20De-duplicate BuildTarget.sourcesNick
If the same source is provided by multiple dependencies it was added multiple times, as `added_sources` was only guarding against duplicates within the same source list. This was not a problem with ninja, but it triggers multiple sanity checks within xcode backend while attempting to create multiple ids for the same file. Rename `added_sources` to `seen_sources` as per reviewers request
2024-11-20interpreter: put back assertion message that was dropped in errorDylan Baker
2024-11-19ninjabackend: use an unordered set for NinjaBuildElementPaolo Bonzini
The deps and orderdeps are sorted on output, so there is no need to preserve their order. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-11-19compilers: avoid one or more version_compare per targetPaolo Bonzini
version_compare can take a few milliseconds. If you have a thousand object files or a multiple thereof, it adds up. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-11-19Fix building on AIX when no project languages are usedprajwal-ibm
Closes #13878
2024-11-19rust: avoid warnings from rust.testPaolo Bonzini
Any argument from the base target is copied to the test target, but some keyword arguments for libraries are not available in executable. Remove them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-11-19check if test 33 running under MinGWMihailJP
2024-11-19make the testsuite handle MSYS2's addition of cmdMihailJP
In some reason, recent version of MSYS2 is shipped with /usr/bin/cmd which makes the test fail
2024-11-19make external_project work again on MinGWMihailJP
On Python 3.12, self.prefix.relative_to(self.prefix.drive) no longer works and raises error like: ``` ValueError: 'C:/msys64/mingw64' is not in the subpath of 'C:' ```
2024-11-18tests: HDF5 no longer skips on MacOSDylan Baker
The `-show` switch was added into the cmake-generated scripts in HDFGroup/hdf5@6fa09bd and backported to 1.14.5.
2024-11-17docs: fix description of `py.install_sources` argumentsRalf Gommers
There is actually very little overlap between `install_sources` and `install_data` in arguments they accept: only 2/7 keywords for `install_data` apply to `install_sources`. Closes gh-12601
2024-11-17Update Users.md with netatalkDaniel Markstedt
2024-11-17mdevenv: exec directly into the program to runEli Schwartz
We don't need an extra process in the process tree (specifically the `meson devenv` process itself). Aside for the redundancy, it's actively problematic if you abort a program in the devenv by using CTRL+C, as meson itself will then emit a traceback (KeyboardInterrupt) which is quite ugly.
2024-11-15ast/introspection: Drop duplicate None checkDylan Baker
The AstInterpreter does this check as well, so don't do it twice.
2024-11-15interpreter: remove is_translatedDylan Baker
It's not actually useful, we can just add the root meson.build file to the depfiles when we translate the meson.build into ast. If there's a provided ast then we don't go down that path anyway.
2024-11-15interpreter: don't use `in dict.keys()` use `in dict`Dylan Baker
The former performs a linear search, which is slower than the set based search.
2024-11-15build: store Build.modules as a setDylan Baker
Since it's only used to check membership, a set makes more sense. Also add some documentation to the attribute
2024-11-15interpreter/dependencyfallbacks: Add copyright headerDylan Baker
2024-11-15interpreter: remove Interpreter.generatorsDylan Baker
Which is built, but never used
2024-11-15interpreter: only calculate build_filename if we're actually going to use itDylan Baker
2024-11-15interperter: Remove unused Interpreter.subproject_directory_nameDylan Baker