aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2023-02-13wrap: ensure the tempfile used for downloading is closedEli Schwartz1-1/+1
This is generally a good idea, and the tempfile is already instructed to not auto-delete on close. It also fixes a bug on PyPy, where the file isn't valid because it's not explicitly closed. This is probably due to the garbage collection modes -- in CPython, the object goes out of scope and gets automatically closed before we actually attempt to unpack it. Fixes #11246
2023-02-10cython: wire up support for emitting and using depfilesEli Schwartz2-2/+14
This solves rebuild issues when e.g. importing a .pxd header from a .pyx file, just like C/C++ source headers. The transpiler needs to run again in this case. This functionality is present in the 3.0.0 alphas of cython, and is also backported to 0.29.33. Fixes #9049
2023-02-10backends: handle cython ninja rules a bit more idiomaticallyEli Schwartz1-6/+7
We want to use as much default ninja behavior as we can, so reuse $out instead of repeating the output file as a string in $ARGS, and raise that into the build rule so it is only listed once.
2023-02-09respect the machine file binary overrides, even if it doesn't existEli Schwartz1-1/+3
If someone specifies a binary in a machine file, but the resulting prog.found() is false because it doesn't actually exist on disk, then the user was probably trying to disable finding that program. But find_program() currently doesn't distinguish between a machine file lookup returning a not-found program, and returning a dummy program because there's no entry at all. Explicitly check for a dummy program, rather than checking if the program was found, before deciding whether to discard the lookup results and continue trying other program lookup methods.
2023-02-08Replace dashes in Java package names with underscores when generating native ↵Tristan Partin1-3/+6
headers This was causing a ninja issue where the native headers were always being generated because io.github.hse-project.hse_Hse.h was being expected, but io.github.hse_project.hse_Hse.h was actually generated.
2023-02-08compilers: Optimize the /Zc:__cplusplus codeDylan Baker1-10/+6
This could also be handled once, in the initializer
2023-02-08compilers: Remove /utf-8 from Visual Studio command args onceDylan Baker1-3/+9
Instead of looking at it each time get_always_args() is called, do it once. Also avoid mutating global state.
2023-02-08compilers: Copy const always_args before returningDylan Baker1-1/+2
Eventually we would probably be better served (to avoid unnecessary copies) to use the ImmutableListProtocol here, but for the moment this is effective, it's also what we do in every other case.
2023-02-08mtest: fix annotaion of stdo_task and stde_taskDylan Baker1-2/+2
Which are `Task`s, not `Future`s, and they return `None`, not `str`. Spotted by newer versions of mypy
2023-02-07Visual Studio: Drop /utf-8 if it is not supportedChun-wei Fan1-0/+10
We assume /utf-8 for all C builds unless /source-charset or /execution-charset is specified, but then this will cause trouble for Visual Studio 2013 or earler since the /utf-8 flag is only supported since Visual Studio 2015. Specifically, if we try to check whether compiler flags are supported, those checks will fail since /utf-8 is never supported on these older Visual Studio versions. Drop /utf-8 from get_always_args() if we are using Visual Studio 2013 or earlier.
2023-02-07mconf: Use auto_features value for auto optionsXavier Claessens1-0/+3
When project is configured with -Dauto_features=disabled, meson configure should not print "auto" value but "disabled" instead.
2023-02-02set default install_tag of python.install_sources() to "python-runtime"Peter Urban1-1/+1
the default parameter for python.install_sources is set to "runtime" but should be "python-runtime" according to the existing documentation - https://mesonbuild.com/Python-module.html#install_sources - https://mesonbuild.com/Installing.html#installation-tags
2023-02-01pylint 2.16: join iterables without repeated appendEli Schwartz1-3/+1
We do += style joining in a loop, but we could just join with `''.join()` which is faster, neater, and simpler.
2023-02-01pylint 2.16: raise a more intentional exceptionEli Schwartz1-1/+1
Include a frivolous error message too. We never see it, but if someone reads the code and wonders why on *earth* there's a DSL function to raise a RuntimeError, the message string will clue them in.
2023-02-01pylint 2.16: remove pointless parens around equality assignmentsEli Schwartz3-3/+3
Given the construct `foo = (bar == baz)` some people like parentheses and some do not. They're pointless and don't mean anything, though. I don't feel this is particularly helpful to code clarity, tbh, and pylint now notices this and warns about it in our current pylint config. I think this is reasonable, so let's remove the odd parens.
2023-02-01remove unneeded type commentEli Schwartz1-1/+1
2023-02-01simplify instantiation of builtin type using builtins instead of functionsEli Schwartz6-17/+47
2023-02-01micro-optimize: define typing-only objects in TYPE_CHECKINGEli Schwartz9-54/+45
Union types that exist solely for use as annotations don't need to be created in normal runs.
2023-02-01treewide: add future annotations importEli Schwartz105-5/+122
2023-02-01pyupgrade: use set literalEli Schwartz1-1/+1
2023-02-01add cc.has_function_attribute('vector_size')Dudemanguy1-0/+2
2023-02-01remove /utf-8 option when /validate-charset- is presentCharles Brunet1-1/+3
2023-01-31cuda: enable C++20 for CUDA 12David Seifert1-2/+15
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-compilers
2023-01-31log running commands a bit better by doing proper shell quotingEli Schwartz1-3/+3
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.