aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2023-01-30runpython: make it work for -c as wellEli Schwartz1-2/+2
In commit 4e4f97edb3d475273108b203bc02b04bd6840b06 we added support for runpython to accept `-c 'code to execute'` in addition to just script files. However, doing so would mangle the sys.argv in the executed code -- which assumes, as python itself does, that argv is the stuff after the code to execute. We correctly handled this for script files, but the original addition of -c support pushed this handling into a script-file specific block.
2023-01-29mlog: do not squelch console output for errorsEli Schwartz1-1/+7
We have functionality to squelch logging, and we use this for situations where we run a fake interpreter and then emit output. e.g. `introspect`. It's reasonable to avoid logging your bog-standard noisy `mlog.log()` here, but unfortunately, we also avoided logging the output of `mlog.exception()` followed by `sys.exit(2)`, because that went through mlog! :P Special-case this to keep on printing, even if mlog.disable() was used -- in such a case, we really do want to emit log output no matter what. Users need this info to ensure they have any clue why Meson returned a non-zero exit code.
2023-01-29introspect: avoid crashing when add_languages for an optional language failsEli Schwartz1-6/+16
Because that is what the real interpreter does, too. It logs a failure and carries on.
2023-01-28cmake: allow dynamic linking with LLVMKonstantin2-28/+165
llvm-config is unsuitable for standard cross-compile, because we need to build llvm especially for it, which is not done is almost any distros, so, for example, standard bootstrap chroot will be unsuitable. This patch is trying to acheive feature parity between config-tool searching of LLVM and CMake-based one, which is arch-agnostic. Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-01-26gnome: Deduplicate include dirs to generate girThibault Saunier1-3/+3
Ensuring the order is respected
2023-01-22mtest: do not warn when the TAP stream version is 12Eli Schwartz1-4/+1
Partial rollback of commit b7a5c384a1f1ba80c09904e7ef4f5160bdae3345. The rationale was based on a confusing wording of the TAP14 spec, which is under discussion for clarification / amendment. TAP14 doesn't (shouldn't) really say that missing a version line is potentially an error. Rather, this is the correct way to denote TAP12, which a TAP14 harness may not understand or try to parse. The intention was never to suggest that harnesses "should" take exception to the missing version line on the grounds that one should really add a version line. So, stop emitting an annoying warning for something that's valid usage. Meson understands TAP12 and that's okay. However, we do need to keep the part of that commit which set the version to 12 if it was otherwise unspecified. But instead of distinguishing between None and a version, just default to 12.
2023-01-22Revert "debug cygwin CI"Eli Schwartz1-1/+0
This reverts commit 79d7891746a7864a1407d48eac8a753b225ec6c3. This debug print probably should not have ended up live. Moreover, the function it debugs is, surprisingly, called rather often. Adding I/O to it causes it to begin to noticeably lag, on the scale of adding actual *minutes* to a setup run. Fixes #11322
2023-01-22meson init --build should call meson setup and vsenvCharles Brunet1-2/+8
2023-01-20Haiku pkgconfig directory layout supportX5121-0/+3
2023-01-20haiku: set default prefix and library pathsX5122-9/+66
2023-01-20devenv should import env vars from vsenvCharles Brunet1-2/+1
2023-01-20optinterpreter: pass deprecated keyword directly to Option initializerDylan Baker1-15/+17
2023-01-20Deprecate passing strings to non-string optionsDylan Baker1-1/+3
Currently Meson allow the following (Muon does not): ```meson option('foo', type : 'boolean', value : 'true') option('bar', type : 'integer', value : '42') ``` This is possibly a holdover from very old code, but it's a bad idea and we should stop doing it. This deprecation is the first stop on that journey.
2023-01-20use typed_kwargs for the various option subparsersDylan Baker1-73/+122
We make use of allow_unknown=True here, which allows us to only look at the common arguments in the main option parser, and then look at the specific options in the dispatched parsers. This allows us to do more specific checking on a per overload basis.
2023-01-20decorators: don't unsort sorted values for printingDylan Baker1-2/+3
Currently in our deprecated/new feature printing we carefully sort all of the values, then put them in a set to print them. Which unsorts them. I'm assuming this was done because a set looks nice when printed (which is true). Let's keep the formatting, but print them in a stable order.
2023-01-20coredata: allow deprecation to be passed to Option initializerDylan Baker1-17/+24
Instead of requiring it to be set outside the initializer
2023-01-20coredata: get rid of UserArrayOption `**kwargs`Dylan Baker1-2/+5
Let's just pass the two arguments explicitly.
2023-01-20coredata: use DEFAULT_YIELDING as the default value for OptionsDylan Baker2-12/+12
Instead of setting it to `Optional[bool] = None`, and then in the initializer replacing `None` with `DEFAULT_YIELDING`, just set to to `bool = DEFAULT_YIELDING`
2023-01-20coredata: use a frozenset instead of a dict where values are always NoneDylan Baker1-21/+22
2023-01-20remove dead codeEli Schwartz1-47/+0
We shouldn't be hardcoding library dirs anyway. And we usually get this from the compiler. This function has been unused since its users were moved to use the compiler method, in the following commits: - a1a4f66e6d915c1f6aae2ead02cf5631b10c76f1 - a3856be1d50eaefe32fee5d3347d55d934d15b50 - 08224dafcba1b694fb624553e7d84deb565aae22
2023-01-18dependencies: fix pcap-config which now errors on --versionEli Schwartz2-2/+18
The latest release of libpcap added argument validation to pcap-config, but still doesn't support --version. The next version of libpcap will support --version. Add support for config-tool dependencies which expect to break on --version, to fallback to an option that does not error out or print version info, for sanity checking.
2023-01-18interpreter: use typed_pos_args for build_targetsDylan Baker1-11/+48
We have to allow through build.BuildTarget and build.ExtractedObjects, which is what our previous level of checking did, even though they are ignored. I've used FeatureDeprecated calls here, so that we have a clear time of "this was officially deprecated in 1.1.0"
2023-01-18coredata: Make a deepcopy of global state before mutatingDylan Baker1-1/+3
When a compiler is initialized, it adds specific options that it supports, but taking some global UserOption objects and adding them to itself. When it does so, it mutates then if necessary. This means that each compiler initialized mutates global state, this is bad. This is worse because in our test suite we do in process testing, so these mutations are preserved *between tests*, potentially leading to incorrect results. The simple fix is to do the right thing, and copy the UserOption before mutating. A deepcopy is required because the option might be an ArrayOption, and a shallow copy is not sufficient in that case.
2023-01-18devenv: Allow dumping into file and select a formatXavier Claessens2-11/+25
It is often more useful to generate shell script than dumping to stdout. It is also important to be able to select the shell format. Formats currently implemented: - sh: Basic VAR=prepend_value:$VAR - export: Same as 'sh', but also export VAR - vscode: Same as 'sh', but without substitutions because they don't seems to work. To be used in launch.json's envFile.
2023-01-18 Fix nasm when target has threads as added dependencyGijs Peskens1-0/+8
2023-01-17mparser: Use a literal for the ComparisonNodeDylan Baker1-11/+18
And fix a bug where `not in` is in the wrong order.
2023-01-16properly type utils/core.py and add it to mypyEli Schwartz2-6/+10
EnvironmentVariables was always broken, it used MutableMapping because everyone <3 abstract interfaces, especially when they are broken and don't actually do what you want. This needs a dict interface, exposing `.copy()`. We either use a dict or os._Environ, and the latter also supports that. Also fix a broken import, and the fallout from forgetting to update the signature of self.envvars in commit b926374205bd761085031755c87152d08bc10e9d.
2023-01-15BUG: Fix generated sources not being included as dependencies in cython ↵Thomas Li1-0/+14
transpilation
2023-01-11coredata: Remove dead codeXavier Claessens1-11/+0
2023-01-10backends: Stop passing generator exes to ExecutableSerialisation as stringsDylan Baker3-7/+6
The code below this already handles being passed an Executable or ExternalProgram, and it does it correctly, since it handles host binaries that need an exe_wrapper correctly, while the code in the generator paths doesn't. The xcode backend is, like always, problematic, it doesn't handle things the same way as the ninja and vscode backends, and generates a shell script instead of using meson as a wrapper when needed (it seems likely that just forcing the meson path for xcode would be better). I don't have a working mac to develop a fix for, so I've left a todo comment there. Fixes: #11264
2023-01-10linkers: detect ld64 as AppleDynamicLinkerjack2-6/+28
2023-01-10modules: fully type the Qt* modulesDylan Baker3-9/+26
The base module is fully typed, but the numbered version are not, though it's pretty trivial to do so.
2023-01-10modules: add type annotations to the `__init__` moduleDylan Baker1-8/+9
2023-01-10modules/external_project: `make` should be immutableDylan Baker1-1/+6
In some cases we'll get an `ImmutableListProtocol[str]` anyway (and actually, we should probably be getting one in call cases), since we don't mutate it anyway, just store it as immutable.
2023-01-10modules/i18n: fix type annotationsDylan Baker1-1/+1
Again, state.find_program is wrong
2023-01-10modules/icestorm: fix type annotationsDylan Baker1-1/+1
This is also due to the incorrect annotations of state.find_program()
2023-01-10modules/qt: Fix annotations for state.find_programDylan Baker1-3/+3
Because this too, has the wrong assumptions
2023-01-10modules/rust: Fix annotation for _bindgen_binDylan Baker1-2/+2
Which suffers from the same issue as the gnome module
2023-01-10modules/gnome: fix type annotations from `__init__`, which are wrongDylan Baker1-9/+10
Mainly thi sis that `state.find_program()` is annotated incorrectly, it returns `ExternalProgram | Executable | OverrideProgram`, but it's annotated to return only `ExteranlProgram`, and thus a bunch of the annotations in the gnome module are wrong.
2023-01-10build: Add a found method to ExecutableDylan Baker1-0/+4
Again, this is necessary for polymorphism with ExternalProgram
2023-01-10build: Add a get_path method to ExecutableDylan Baker1-0/+5
This is needed to make Executable Polymorphic with ExternalProgram. This can happen when a build program overrides a lookup.
2023-01-09linkers: Do not use numeric windows subsystems with lldJan Janssen1-12/+25
Fixes: #11258
2023-01-09linkers: Fix lld detectionJan Janssen1-1/+1
This was actually probing bfd without always_args passed. Fixes: #10763
2023-01-08avoid detecting masm as a MSVC-like compiler for detecting showincludesEli Schwartz1-2/+2
It's msvc-like but, just like Intel Fortran, doesn't support this argument.
2023-01-08msvc: handle filename extensions for incdetect based on the compiler languageEli Schwartz1-2/+3
It is possible, albeit possibly inadvisable, for the exact combination of MSVC and "$CXX has C++ specific flags in it" to occur. When this happens, and cl.exe is given a filename ending in .c, it complains that you cannot compile a .c file with that option. Instead, pick the first filename matching that language and use that as the temporary filename. This more or less matches what we do in compiler-time checks. And it's the proper thing to do, rather than assume that cl.exe, when detected as the current C++ compiler, can *also* compile C because it's *also* a C compiler. Fixes #11257
2023-01-04be more explicit about asyncio usageEli Schwartz1-1/+2
`get_event_loop()` would always implicitly create one on demand, but Python upstream has decided it's a bad/confusing API. Explicitly starting our own, then setting it, is exactly equivalent other than not being scheduled for deprecation.
2023-01-04mtest: simplify deprecated access to current loopEli Schwartz1-9/+11
These functions constantly want the current asyncio loop, and we run a function call each time to get it. And the function call is a deprecated one. Python 3.7 brings the more explicit get_running_loop for use when we know we're inside one, with the aim of getting rid of get_event_loop once support for python <3.7 disappears. Meson no longer supports python <3.7 either. Switch to the new API, and save the reference for reuse instead of constantly re-calculating it.
2023-01-04mtest: clean up asyncio event loop instantiationEli Schwartz1-7/+6
Fix a TODO comment about moving to asyncio.run, now that we use sufficiently new python to do it. Note that we create an event loop for Windows using the new python defaults, but in a completely different part of the code from where we need to use it. Since asyncio.run creates the loop on its own, we need to set the default policy instead -- which we probably should have done all along.
2023-01-04mtest: delay creation of asyncio lock until event loop existsEli Schwartz1-1/+4
In https://bugs.python.org/issue42392 this stopped implicitly creating an event loop if none exists. We created it before running _run_tests(), so it would auto-create an event loop and set the default, which means we cannot create one explicitly on our own schedule or we end up with two of them. Delay this until we actually start the logger. This happens inside the actual testsuite loop, so it finds the running loop and doesn't create a new one, even on python <3.10.
2023-01-04add a hidden environment variable to make Meson complain hard on deprecationsEli Schwartz1-0/+7
Useful for running the testsuite with this environment variable and catching obscure issues. Just like with the encoding warning later down, we have to do this inside meson itself, not externally injected.