aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-22python module: break the association between dependency and installation objectsEli Schwartz1-18/+19
We pass around a PythonInstallation into the depths of the dependency factory, solely so that we can get at is_pypy in one particular branch. We don't need the DSL functions, we don't need access to the interpreter, let's just use the enhanced ExternalProgram object on its own. Add is_pypy to the object, and modify other references to get information from .info['...'] instead of direct access.
2023-02-22python module: fix a few mypy issuesEli Schwartz1-4/+8
Of particular note: We technically cannot pass a NotFoundDependency out of a factory lookup, because it doesn't support External interfaces.
2023-02-21backend/ninja: fix rust cfg parsingKarol Herbst1-1/+1
2023-02-20minstall: add a timeout when waiting for user input for elevationEli Schwartz1-2/+13
Do not allow hanging forever. It's fine to use selectors here, which are unix-only, because we require Unix + a system that has e.g. sudo installed, anyway.
2023-02-20minstall: check 5 times for an answer to the elevation promptEli Schwartz1-3/+6
The user might press enter by accident and miss the message.
2023-02-20minstall: drop privileges before running rebuild_allEli Schwartz3-3/+55
If the user runs `sudo meson install` this may run ninja to build everything that gets installed. This naturally happens as root also, by default, which is bad. Instead, detect root elevation tools and drop the uid/gid of the child ninja process back to the original invoking user before doing anything.
2023-02-20minstall: rework root elevation prompt for extensibility and behaviorEli Schwartz3-6/+39
There's a couple issues with the current approach: - pkexec is an unusual elevation method, the standard is sudo - it tries to elevate even in automated workflows - the user may not want to automatically rerun as root, that might be badly behaved Do some upfront checks instead, first to make sure it even makes sense to try becoming root, and then to ask the user "do you really want this". Also check for a couple common approaches to root elevation, including doas. Fixes #7345 Fixes #7809
2023-02-20minstall: when elevating to root, don't allow ninja to rerunEli Schwartz1-1/+1
We just finished running rebuild_all, and then actually running the install routine failed because of permission errors, so we magically reran as root. But we should *know* that all prerequisite targets are up to date already, we don't need to run it *again*. Nevertheless, when running meson install directly we could end up without --no-rebuild in the original argv. This meant that it wouldn't be in the re-executed argv either. Add it on just in case -- repeating it twice doesn't hurt anyway.
2023-02-20interpreter/mesonmain: Add build_options methodL. E. Segovia5-1/+60
This method allows meson.build to introspect on the changed options. It works by merely exposing the same set of data that is logged by MesonApp._generate. Fixes #10898
2023-02-20nasm: Detect and use MSVC linker if presentL. E. Segovia1-0/+3
Fixes #11082
2023-02-20nasm: Link with windows CRT libs when nasm is used as linker languageXavier Claessens6-2/+82
2023-02-20ci: Install NASM on MSVC jobsXavier Claessens1-0/+2
2023-02-20interpreter: Do not ignore all exceptions when adding compilerXavier Claessens1-1/+1
Suppressing all exceptions was hidding even syntax errors in compiler source code. If a compiler cannot be found, a MesonException is raised, we should only expect that type.
2023-02-19handle more corner cases where locking the build directory failsEisuke Kawashima1-0/+3
This can raise any OSError, but we only caught two of them that indicate a particular failure case. Also catch the generic error form with a more generic message. This produces better error messages in cases where e.g. exclusive lock is not supported.
2023-02-19vala: don't build .h, .vala, and .gir if export_dynamic is FalseDylan Baker1-1/+1
The current check results in *any* value to `export_dynamic` generating vala import targets, even `false`. This is pretty clearly wrong, as it really wants to treat an unset export_dynamic as false.
2023-02-17compilers: -fprofile-correction is only a valid switch with gcc itself.Luke Elliott1-1/+4
clang++ main.cpp -fprofile-correction clang-15: warning: optimization flag '-fprofile-correction' is not supported [-Wignored-optimization-argument]
2023-02-16docs/prebuilt: Add an example of how to use a wrap fileDylan Baker1-0/+27
When using a pre-built library
2023-02-16docs/prebuilt: add some sanity checking to the example.Dylan Baker1-0/+5
Instead of just giving a note about about how this is best practice, actually do it.
2023-02-16docs/prebuilt: use meson.override_dependency()Dylan Baker1-3/+5
2023-02-15interpreter: add FeatureOption.enable_if and .disable_ifDylan Baker4-5/+186
This adds two new methods, that are conceptually related in the same way that `enable_auto_if` and `disable_auto_if` are. They are different however, in that they will always replace an `auto` value with an `enabled` or `disabled` value, or error if the feature is in the opposite state (calling `feature(disabled).enable_if(true)`, for example). This matters when the feature will be passed to dependency(required : …)`, which has different behavior when passed an enabled feature than an auto one. The `disable_if` method will be controversial, I'm sure, since it can be expressed via `feature.require()` (`feature.require(not condition) == feature.disable_if(condition)`). I have two defences of this: 1) `feature.require` is difficult to reason about, I would expect require to be equivalent to `feature.enable_if(condition)`, not to `feature.disable_if(not condition)`. 2) mixing `enable_if` and `disable_if` in the same call chain is much clearer than mixing `require` and `enable_if`: ```meson get_option('feat') \ .enable_if(foo) \ .disable_if(bar) \ .enable_if(opt) ``` vs ```meson get_option('feat') \ .enable_if(foo) \ .require(not bar) \ .enable_if(opt) ``` In the first chain it's immediately obvious what is happening, in the second, not so much, especially if you're not familiar with what `require` means.
2023-02-15interpreter: add a feature.enable_auto_ifDylan Baker4-1/+39
It's always been strange to me we don't have an opposite method of the `disable_auto_if` method, but I've been pressed to find a case where we _need_ one, because `disable_auto_if` can't be logically contorted to work. I finally found the case where they're not equivalent: when you don't want to convert to a boolean: ```meson f = get_option('feat').disable_auto_if(not foo) g = get_option('feat').enable_auto_if(foo) dep1 = dependency('foo', required : f) dep2 = dependency('foo', required : g) ```
2023-02-15docs: add description of license_files kwargEli Schwartz1-0/+16
Added in commit 2fa074917597fea0cf3332c6620d3414034825e4 but I forgot to document it.
2023-02-15preprocess: Add dependencies kwargXavier Claessens5-2/+17
2023-02-15preprocess: Allow custom_tgt, custom_idx and generated_listXavier Claessens4-11/+39
It was documented to be supported but only File and str were actually working.
2023-02-14allow install script to run in dry-run modeCharles Brunet8-8/+58
2023-02-14asm: Use more backward-compatible invocation syntax for nasmSimon McVittie1-1/+1
Before version 2.14.01, -MD required an output filename argument, with `-MD outfile` equivalent to later versions' `-MD -MF outfile`. The older syntax is still supported, and is still listed as the preferred syntax in documentation. Reference: https://github.com/netwide-assembler/nasm/commit/3475462e Resolves: https://github.com/mesonbuild/meson/issues/11395 Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-13cmake: check that `re.search` returned a non-None valueDylan Baker1-6/+12
If an re call fails to find a match it returns None. We're not checking that, and crashing. Fixes: #11376
2023-02-13Fix displaying outputs with add_*_scriptCharles Brunet1-1/+1
#8259 induced a regression, causing Meson 0.57.0 and upward to stop printing outputs of scripts added using `meson.add_*_script()`. This makes _find_source_scripts() mark executables as verbose in meson_exe.
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-13add a CI runner testing that Meson runs correctly under PyPy3Eli Schwartz3-2/+17
Silence a couple of framework tests that need to be skipped since we don't install their dependencies for pypy3.
2023-02-13CI: log individual steps in run_testsEli Schwartz1-4/+8
2023-02-13tests: do not run the deprecated python3 tests unless python is python3Eli Schwartz1-2/+2
It's broken in e.g. pypy, but that's okay because the module is utterly deprecated, and people should use the python module instead.
2023-02-12CI: ensure pypy3 has the basic packagesEli Schwartz1-0/+3
2023-02-10docs: Add cython to the languages accepted by project()Daniele Nicolodi1-2/+3
Fixes #11373.
2023-02-10cython: add unittest to verify that depfiles workEli Schwartz4-0/+29
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-08CI: migrate pypy3 tests from bionic to ArchEli Schwartz2-17/+1
The bionic image is really old and mainly exists to test that Meson itself still works on really old distros (and really old python). Ideally we'd avoid depending too much on it. We can get a very modern pypy3 automatically this way, and potentially use it for more stuff too.
2023-02-08CI: skip valgrind test on ArchEli Schwartz1-1/+1
It's already run on other distros. This one fails though, due to missing debug info. ``` valgrind: Possible fixes: (1, short term): install glibc's debuginfo valgrind: package on this machine. (2, longer term): ask the packagers valgrind: for your Linux distribution to please in future ship a non- valgrind: stripped ld.so (or whatever the dynamic linker .so is called) ``` It doesn't seem possible to have this work out of the box. The debuginfo packages aren't reliably available, and debuginfod servers -- even if they worked, which they apparently don't -- would not help anyway since old version pruning can result in symbols disappearing before the image is rebuilt, and thereby causing failure. It's not really critical to test this, since as mentioned we already have coverage of Meson's side in other distro ciimages.
2023-02-08CI: skip gpgme-config test on ArchEli Schwartz1-1/+1
gpgme has decided that config-tool is bad, which makes sense. They've also decided that they will only install theirs, if gpg-error also installs one, which is a bit... confusing. Anyway, it's impossible to know whether it should or should not exist, so just accept that this test is ready to be skipped on distros that currently no longer have this ancient config-tool script. Victory is within reach!
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-08internaltests: Fix tests for /utf-8 removalDylan Baker1-5/+6
Now that we don't insert /utf-8 into the always args for MSVC < 19.00 we need to use a version > 19.00 for testing. This also means that /Zc:__cplusplus will be added to the always args.
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-07test cases/vala: Fix clang error during int to pointer coercionNirbheek Chauhan2-3/+3
``` clang [...] -c valaprog.p/GLib.Thread.c ../test cases/vala/5 target glib/GLib.Thread.vala:17:17: error: incompatible integer to pointer conversion passing 'gint' (aka 'int') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion] g_thread_exit (get_ret_code ()); ^~~~~~~~~~~~~~~ /usr/include/glib-2.0/glib/gthread.h:158:66: note: passing argument to parameter 'retval' here void g_thread_exit (gpointer retval); ^ 1 error generated. ```
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.