aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-08-14interpreter: use typed_kwargs for shared_library(soversion)Dylan Baker3-9/+5
2023-08-14interpreter: use typed_kwargs for shared_library(version)Dylan Baker3-10/+19
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz38-214/+214
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-08-11rewrite a couple comment-style type annotations for oddly indented dictsEli Schwartz2-14/+20
Make them into real type annotations. These are the only ones that if automatically rewritten, would cause flake8 to error out with the message: "E128 continuation line under-indented for visual indent".
2023-08-11remove useless type annotationsEli Schwartz15-43/+43
These annotations all had a default initializer of the correct type, or a parent class annotation.
2023-08-11docs: Add more feature truth tablesJan Janssen1-10/+28
These are much easier to understand at a glance than free-form text.
2023-08-10hotdoc module: add a bunch more type annotationsEli Schwartz1-51/+74
2023-08-10hotdoc module: avoid monkeypatch crime by properly subclassing ExternalProgramEli Schwartz1-7/+8
2023-08-10python module: add a few more type annotationsEli Schwartz1-5/+8
2023-08-10allow some ObjectHolder subclasses to continue to be genericEli Schwartz3-11/+21
ExternalProgram and CustomTarget have some use cases for producing subclassed interpreter holders with more specific types and methods. In order for those subclasses to properly refer to their held_object, we need a shared base class that is still generic, though bound. For the derived held objects, inherit from the base class and specify the final types as the module-specific type.
2023-08-10Popen_safe_logged: Also log exceptionsXavier Claessens1-1/+7
Popen can raise OSError when program is not found, or PermissionError if not executable, etc.
2023-08-09Optimize CLikeCompiler._get_file_from_list()Charles Brunet1-13/+11
Simplify and optimize the function. When not on Mac OS, it was iterating two times the list when there were no files in it.
2023-08-08correct cmakedefine behaviorJan2001012-13/+63
- allow defines with leading whitespace - always do replacement for cmakedefine - output boolean value for cmakedefine01 - correct unittests for cmakedefine - add cmakedefine specific unittests
2023-08-08clang: use gcc syntax to enable diagnostics colorkiwixz1-3/+3
clang has supported gcc syntax since version 3.3.0 from 10 years ago. It's better than its own version because it takes a "when" verb which allows us to explicitely ask for "auto". This is useful when overriding flags that came from elsewhere. Before this patch, meson was just treating b_colorout="auto" as "always".
2023-08-08tests: fix "4 custom target depends extmodule" with Python 3.8+ on WindowsChristoph Reiter2-0/+6
Since CPython 3.8 .pyd files no longer look in PATH for loading libraries, but require the DLL directory to be explicitely added via os.add_dll_directory(). This resulted in those tests failing with 3.8+ on Windows. Add the DLL build directory with os.add_dll_directory() to fix them. This was never noticed in CI because it only uses Python 3.7 and the MSYS2 CPython still used the old behaviour until now.
2023-08-08tests: fix test_vsenv_option with Python 3.11+ on WindowsChristoph Reiter1-1/+3
meson tests enable PYTHONWARNDEFAULTENCODING by default and make EncodingWarning fatal too. Starting with Python 3.11 CPython not only warns if no encoding is passed to open() but also to things like subprocess.check_output(). This made the call in vsenv.py fail and in turn made test_vsenv_option fail. check_output() here calls a .bat file which in turn calls vcvars. I don't know what the encoding is supposed to be used there, so just be explicit with the locale encoding to silence the warning.
2023-08-08interpreter|dependencies: Fix issues spotted by mypyDylan Baker1-5/+4
Which is mostly that other annotations are wrong.
2023-08-08interpreter: delete dead code in func_declare_dependencyDylan Baker1-3/+0
2023-08-08interpreter: add type annotations to func_declare_dependencyDylan Baker2-3/+22
2023-08-08Detect version for Vulkan system dependencyLucas Alber1-5/+29
2023-08-07machine file: Fix crash on empty valueXavier Claessens1-2/+4
Fixes: #12025
2023-08-07Error when an installed static library links to internal custom targetXavier Claessens4-29/+86
When an installed static library A links to an internal static library B built using a custom_target(), raise an error instead of a warning. This is because to be usable, A needs to contain B which would require to extract the archive to get its objects files. This used to work, but was printing a warning and was installing a broken static library, because we used to overlink in many cases, and that got fixed in Meson 1.2.0. It now fails at link time with symbols from the custom target not being defined. It's better to turn the warning into a hard error at configure time. While at it, noticed this situation can happen for any internal custom or rust target we link to, recursively. get_internal_static_libraries_recurse() could be called on CustomTarget objects which do not implement it, and even if we did not call that method, it would still fail when trying to call extract_all_objects() on it. Fixes: #12006
2023-08-07c_std, cpp_std: Change to a list of desired versions in preference orderXavier Claessens9-95/+229
Projects that prefer GNU C but can fallback to ISO C can now set for example `default_options: 'c_std=gnu11,c11'` and it will use gnu11 when available, fallback to c11 otherwise. It is an error only if none of the values are supported by the current compiler. This allows to deprecate gnuXX values from MSVC compiler, that means that `default_options: 'c_std=gnu11'` will now print warning with MSVC but still fallback to 'c11' value. No warning is printed if at least one of the values is valid, i.e. `default_options: 'c_std=gnu11,c11'`. In the future that deprecation warning will become an hard error because `c_std=gnu11` should mean GNU is required, for projects that cannot be built with MSVC for example.
2023-08-07Compiler: Add werror kwarg to compiles(), links() and run() methodsXavier Claessens4-27/+68
Fixes: #5399
2023-08-07docs: add missing punctuationSebastian Crane1-1/+1
2023-08-06build.py: improve BuildTarget error messageAlexandre Janniaux1-2/+2
Improve the error message when a build target is assigned as dependency of another build target, which allows to better pinpoint where the issue lies on. In the example that follow, modules/meson.build:294 is in a for loop creating library targets from an array of dictionary, and doesn't point to the location where interop_sw_plugin is assigned with vlc_opengl: Before: modules/meson.build:294:17: ERROR: Tried to use a build target as a dependency. You probably should put it in link_with instead. After: modules/meson.build:294:17: ERROR: Tried to use a build target vlc_opengl as a dependency of target interop_sw_plugin. You probably should put it in link_with instead. It would probably be best to directly pinpoint where the assignment was made but it's probably harder so start simple by saying what is concerned by the error.
2023-08-06UserArrayOption: Make listify_value() a static methodXavier Claessens2-3/+7
2023-08-06UserArrayOption: Remove user_input argumentXavier Claessens4-16/+14
The only place it can be set to False is from optinterpreter. Better check value there and deprecate string usage.
2023-08-06tests: Assert that mips64 kernel is detected as mips64 with no compilersSimon McVittie1-0/+19
Reproduces: https://github.com/mesonbuild/meson/issues/12017 Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-06environment: Don't override mips64 to mips if no compilers are availableSimon McVittie1-2/+2
If we have a build- or host-architecture compiler, we can detect mips64 vs. mips by the fact that mips64 compilers define __mips64. However, machine_info_can_run() doesn't provide any compilers, because it is interested in the architecture of the underlying kernel. If we don't return mips64 when running on a mips64 kernel, machine_info_can_run() will wrongly say that we can't run mips64 binaries. If we're running a complete 32-bit mips user-space on a mips64 kernel, it's OK to return mips64 in the absence of any compilers, as a result of the previous commit "environment: Assume that mips64 can run 32-bit mips binaries". Resolves: https://github.com/mesonbuild/meson/issues/12017 Bug-Debian: https://bugs.debian.org/1041499 Fixes: 6def03c7 "detect_cpu: Fix mips32 detection on mips64" Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-06environment: Assume that mips64 can run 32-bit mips binariesSimon McVittie1-0/+1
The relationship between mips64 and mips is similar to the relationship between x86_64 and x86. Representing it here is necessary so that we will not require an exe_wrapper when cross-compiling for 32-bit mips on mips64, or when a complete 32-bit mips user-space runs on a 64-bit kernel without using linux32 to alter uname(2) to pretend to be 32-bit. Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-06tests: Pass a mock C compiler to detect_cpu(), detect_cpu_family()Simon McVittie1-4/+8
In some cases the desired result can be different if there are no compilers at all. The expectations here are based on there being at least one compiler, so reflect that by providing one; a later test enhancement can cover the case where there are no compilers provided. As a result of the mock any_compiler_has_define(), all that matters will be the distinction between an empty or non-empty dict: the compiler object itself is unused. Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-05fixup: since: 1.1.0 -> 1.3.0Milan Hauth2-2/+2
2023-08-05compiler: Add required keyword to has_* methodsXavier Claessens5-48/+222
add the "required" keyword to the functions has_function has_type has_member has_members has_argument has_multi_arguments has_link_argument has_multi_link_argument has_function_attribute Co-authored-by: Milan Hauth <milahu@gmail.com>
2023-08-04Add default_options argument to find_program()Nomura9-5/+45
2023-08-03PkgConfigDependency: Move CLI handling into its own abstractionXavier Claessens9-199/+254
This makes the code cleaner and will allow to have other implementations in the future.
2023-08-03MachineChoice: Implement __str__ for easier debugXavier Claessens1-0/+3
2023-08-03run_command: Remove useless node argumentXavier Claessens2-5/+4
There is no need to pass it, we already have self.current_node.
2023-08-03ExecutableSerialisation: capture and feed are optional stringsXavier Claessens2-10/+8
capture is the optional filename stdout is redirected to. feed is the optional filename stdin reads from.
2023-08-02convert booleans in summary function to correct representationEli Schwartz2-7/+10
str() is going to return titlecased "True" which is not how meson works. This is misleading, so use the meson-specific format instead.
2023-08-02Unify message(), format() and fstring formattingXavier Claessens10-32/+119
Share a common function to convert objects to display strings for consistency. While at it, also add support for formatting user options.
2023-08-02Fix syntax mistakes in two examplesVolker Weißmann2-2/+2
2023-08-02treewide: internally avoid deprecated machine file uses of "pkgconfig"Eli Schwartz11-14/+14
We support this in a machine file: ``` [binaries] pkgconfig = 'pkg-config' pkg-config = 'pkg-config' ``` and you can use either one, because internally we look up both. If you only set *one* of them, this plays awkwardly with setting $PKG_CONFIG, since we don't know which one you set in the machine file and the *other* one will be initialized from the environment instead. In commit 22df45a31981874310a78dde0df59a6a7c5ebb29 we changed program lookup of config-tool style dependencies to use the regular tool names and only fall back on the strange internal names. This affected the pkg-config class too. The result is that instead of preferring `pkgconfig =` followed by $PKG_CONFIG followed by `pkg-config =`, we inverted the lookup order. This is a good idea anyway, because now it behaves consistently with `find_program('pkg-config')`. Unfortunately, we documented the wrong name in a bunch of places, and also used the wrong name in various testsuite bits, which meant that if you set $PKG_CONFIG and then ran the testsuite, it would fail. Correct these references, because they are buggy. One test case expected to find_program() a native copy for convenience of testing against natively installed glib. Force it to resolve a native copy.
2023-08-02Optimize extract_dll_paths in ninja backendCharles Brunet1-24/+29
On my project, this function was a bottleneck in setup time. By properly caching it, the cumtime for this function went from 26s to 4.3s when I profiled it.
2023-08-01Fix typo in Cross-compilation.mdAlex Rao1-1/+1
2023-08-01Upgrade MSI builder from WiX3 to WiX 4.Jussi Pakkanen1-45/+53
2023-07-31Rename variables that clash with pdb commandsDan Hawson2-13/+13
By default, pdb assumes that any command run is python code to be evaluated, but only if that code isn't a builtin pdb command. You can force it to be evaluated as python code by prefixing it with `!`. It's handy to simply name a python variable and have its variable be printed. But single letter variables like 's' and 'p' make debugging with pdb commands (i.e. 's'tep, and 'p'rint evaluated expressions) less convenient, and potentially confusing.
2023-07-31fix lint errors revealed by pycodestyle 2.11Eli Schwartz2-5/+5
When performing isinstance checks, an identity comparison is automatically done, but we don't use isinstance here because we need strict identity equality *without allowing subtypes*. Comparing type() == type() is a value comparison, but could produce effectively the same results as an identity comparison, usually, despite being semantically off. pycodestyle learned to detect this and warn you to do strict identity comparison.
2023-07-31do better sanity check for vs_module_defs inputEli Schwartz1-1/+1
We allow custom_target() but check for it based on hasattr, ever since the initial implementation way back in the day, in commit 66a6ea984bc43d9ac144e22cf411c16e9f911bb3. This is a bit broken because various objects might support that but still aren't supposed to work. We can actually just use isintance checks like we do immediately above, which are more accurate and avoid crashes on things that aren't even targets at all, like run_target(). Although custom_target indexes are actually targets those didn't work either. Fixes #9648
2023-07-31Merge pull request #11986 from williamspatrick/clang-enable-cpp23Jussi Pakkanen2-2/+39
add support for newer C++ -std= flags on Clang/GCC