aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
AgeCommit message (Collapse)AuthorFilesLines
2022-08-30fix obscure crash on unbound variableEli Schwartz1-4/+5
This can be triggered if someone tries to call a non-ID. The example reproducer was: ``` if (var = dependency(...)).found() ``` This produced a traceback ending in ``` raise InvalidArguments(f'Variable "{object_name}" is not callable.') UnboundLocalError: local variable 'object_name' referenced before assignment ``` After this commit, the error is reported as: ``` ERROR: AssignmentNode is not callable. ```
2022-08-30Add LLVM_CONFIG supportSamay Sharma1-0/+1
2022-08-29flake8: fix typing casts to not have actual objectsEli Schwartz1-1/+1
We use `__future__.annotations` to good effect everywhere we can, and one of the effects of this is that annotations are automatically stringized and don't need to be evaluated, using less memory and computation. But this only affects actual annotations -- a cast is just a function with an argument, so the compiler has no idea that it's an annotation to be stringized. Do this manually.
2022-08-29flake8: move typing-only imports into T.TYPE_CHECKINGEli Schwartz2-2/+6
2022-08-29flake8: fix warnings for unused importsEli Schwartz1-0/+2
This is supposed to expose all primitives together, but to do that we need to actually "use" each variable in `__all__`, which we... didn't. Sorry about that.
2022-08-29flake8: fix unnecessary f-strings without any format placeholdersEli Schwartz2-3/+3
These can just be ordinary strings.
2022-08-29flake8: fix lingering whitespace errorsEli Schwartz1-2/+0
2022-08-29flake8: fix missing importEli Schwartz1-0/+1
This sort of worked, because it was a typing-only import and this file isn't actually tested by mypy yet.
2022-08-26Fix indentation issues reported by flake8, requiring code restructuringAlf Henrik Sauge2-14/+20
Strictly speaking code restructuring isn't needed, but making this PEP8 compliant results in indentation of the code that reduces the readability. By moving the offending code on the outside of the method call, the readability is maintained.
2022-08-26Remove redundant backslash and fix white space issueAlf Henrik Sauge2-5/+6
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge22-190/+188
2022-08-25Revert "Windows: Improve Python 3.8+ module check on Windows"Eli Schwartz1-13/+1
This reverts commit 99ad11bd9c3249f548dda0b275d9f8dd1b3f6d14. This breaks working setups in conda. It is either wrong or incomplete and thus cannot be used. Fixes #10737
2022-08-25wrap: Support netrc filesFabian Orccon1-1/+37
2022-08-24fix linker regression for compilers that don't accept LDFLAGS directlyEli Schwartz7-14/+34
e.g. ldc -- the compiler needs to process args before consuming them. Fixes #10693
2022-08-24fix incorrect type annotations for coredata compile/link argsEli Schwartz1-2/+2
These make no sense as single strings.
2022-08-24build: don't add targets to link_whole_targets if we took their objectsDylan Baker1-3/+5
What happens is this: - liba is a convenience static library - libb is an installed static library - libb links in liba with --link-whole - libc links to libb - we generate a link line with libb *and* liba, even though libb is a strict superset of liba This is a bug that has existed since the we stopped using link-whole to combine convenience libraries, and to instead propagate their dependencies up. For most linkers this is harmless, if inefficient. However, for apple's ld64 with the addition calling `ranlib -c`, this ends up causing multiple copies of symbols to clash (I think that other linkers recognize that these symbols are the same and combine them), and linking to fail. The fix is to stop adding libraries to a target's `link_whole_targets` when we take its objects instead. This is an all around win since it fixes this bug, shortens linker command lines, and avoids opening archives that no new symbols will be found in anyway.
2022-08-24backend/ninja: properly track objects extracted from fortran sourcesDylan Baker3-17/+41
We need this to ensure that .mod files are created before we start compiling, and to ensure that the proper include directory arguments are generated.
2022-08-24build: add a `uses_fortran()` convenience methodDylan Baker1-0/+3
2022-08-24build: Don't attempt to link-whole with rust convenience librariesDylan Baker1-1/+9
There are two distinct cases here that need to be considered. The first issue is https://github.com/mesonbuild/meson/issues/10723 and https://github.com/mesonbuild/meson/issues/10724, which means that Meson can't actually generate link-whole arguments with rust targets. The second is that rlibs are never valid candidates for link-whole anyway. The promotion happens to work because of another bug in the promotion path (which is fixed in the next commit).
2022-08-23install modes should not apply sticky bit to filesEli Schwartz1-6/+27
This is generally a bad idea, e.g. it causes OSError on freebsd. It also gets ignored by solaris and thus causes unittest failures. The proper solution is to simply reject any attempt to set this, and log a warning. The install_emptydir function does apply the mode as well, and since it is a directory it actually does something. This is the only place where we don't reset the mode. Although install_subdir also installs directories, and in theory it could set the mode as well, that would be a new feature. Also it doesn't provide much granularity and has mixed semantics with files. Better to let people use install_emptydir + install_subdir. Fixes #5902
2022-08-23pkgconfig: Variables can be a single stringXavier Claessens1-3/+9
It used to be listified and libxml2 wrap relies on that.
2022-08-22introspection: untangle install_plan implemetation, fix a bunch of wrong onesEli Schwartz5-31/+36
Generally plumb through the values of get_option() passed to install_dir, and use this to establish the install plan name. Fixes several odd cases, such as: - {datadir} being prepended to "share" or "include" - dissociating custom install directories and writing them out as {prefix}/share/foo or {prefix}/lib/python3.10/site-packages This is the second half of #9478 Fixes #10601
2022-08-22interpreter: add a special class to track the lifecycle of get_option() stringsEli Schwartz3-2/+34
2022-08-22fix up some message strings that don't include "setup" in the configure commandEli Schwartz2-2/+2
2022-08-18modules/pkgconfig: make it a NewExtensionModuleDylan Baker1-5/+5
Since we no longer need Interpreter.extract_variables, we can remove the interpreter from the module!
2022-08-18modules/pkgconfig: mypy clean!Dylan Baker1-22/+25
2022-08-18modules/pkgconfig: Fix code to handle CustomTarget and CustomTargetIndexDylan Baker1-3/+4
2022-08-18modules/pkgconfig: remove type checking abstractionDylan Baker1-8/+7
Which confuses the heck out of mypy
2022-08-18modules/pkgconfig: get rid of modifications to the BuildTarget objectsDylan Baker1-24/+40
This would tack on extra attributes for meta data tracking. Do that with our own datastructures instead
2022-08-18modules/pkgconfig: ensure "name" is not NoneDylan Baker1-2/+9
The name can be None if a library is not passed as a positional argument, and the name keyword argument is not provided. We shouldn't allow that to happen.
2022-08-18modules/pkgconfig: Get most type annotations addedDylan Baker1-50/+80
There are still a lot of errors here due to a mixture of really bad design (adding extra attributes to objects), and legitimate type errors (passing a str where a List[str] is expected). I suspect a lot of these cases aren't hit for some reason.
2022-08-18modules/pkgconfig: Use typed_kwargsDylan Baker2-83/+98
2022-08-18modules/pkgconfig: use typed_pos_argsDylan Baker1-8/+6
2022-08-18modules/pkgconfig: fix typo in blocked variableDylan Baker1-1/+1
require_private -> requires_private.
2022-08-18modules/pkgconfig: Fix some low hanging typing issuesDylan Baker1-18/+20
2022-08-18build: Add a Union alias for all build targetsDylan Baker2-8/+10
2022-08-18interpreterbase: fix type annotations for KwargInfo::since_valuesDylan Baker1-4/+4
These are now allowed to be `Dict[_T | Type[list] | Type[dict], str]`, but the type annotations weren't updated
2022-08-18modules/fs: Replace configure_file(copy:) with fs.copyfileDylan Baker2-6/+64
`configure_file` is both an extremely complicated implementation, and a strange place for copying. It's a bit of a historical artifact, since the fs module didn't yet exist. It makes more sense to move this to the fs module and deprecate this `configure_file` version. This new version works at build time rather than configure time, which has the disadvantage it can't be passed to `run_command`, but with the advantage that changes to the input don't require a full reconfigure.
2022-08-18minstall: do not trample install_mode by rpath fixerEli Schwartz1-1/+2
install_mode can include the setuid bit, which has the special property (mentioned in the set_mode logic for minstall itself) of needing to come last, because it "will get wiped by chmod" (or at least chown). In fact, it's not just chown that wipes setuid, but other changes as well, such as the file contents. This is not an issue for install_data / custom_target, but for compiled outputs, we run depfixer to handle rpaths. This may or may not cause edits to the binary, depending on whether we have a build rpath to wipe, or an install rpath to add. (We also may run `strip`, but that external program already has its own mode restoration logic.) Fix this by switching the order of operations around, so that setting the permissions happens last. Fixes https://github.com/void-linux/void-packages/issues/38682
2022-08-17build: actually check for targets with no sourcesDylan Baker1-2/+4
Do to a bug in which a method, rather than an attribute, was checked we would never detect that a target had no sources, even though we meant to. As a result we would never actually error out when a target has no sources. When fixing the check, I've changed the error to a warning so that existing projects will continue to build without errors, only warnings.
2022-08-17interpreter: deprecate the ability import unstable modules as `unstable_*`Dylan Baker1-0/+3
This was never meant to work, it's an implementation detail of using `importlib.import_module` and that our modules used to be named `unstable_` that this ever worked.
2022-08-17interpreter: move handling of module stability to interpreterDylan Baker7-31/+50
Thanks to `ModuleInfo`, all modules are just named `foo.py` instead of `unstable_foo.py`, which simplifies the import method a bit. This also allows for accurate FeatureNew/FeatureDeprecated use, as we know when the module was added and if/when it was stabilized.
2022-08-17modules: Add stabilization information to ModuleInfoDylan Baker8-7/+9
We're going to do more with this in the next commit, but this just adds the information for now. This allows the next commit have 100% mv changes for some of the modules, which makes review easier
2022-08-17modules: use module level information about new and deprecationDylan Baker25-54/+114
Instead of using FeatureNew/FeatureDeprecated in the module. The goal here is to be able to handle information about modules in a single place, instead of having to handle it separately. Each module simply defines some metadata, and then the interpreter handles the rest.
2022-08-16fixup! deprecate running "meson builddir" without setup subcommandEli Schwartz1-1/+1
Also pass the setup command when rewriting --internal regenerate. This avoids the issue where `ninja` triggers a reconfigure, and this warning gets printed as a side effect.
2022-08-16deprecate running "meson builddir" without setup subcommandEli Schwartz1-0/+5
This is ambiguous, if the build directory has the same name as a subcommand then we end up running the subcommand. It also means we have a hard time adding *new* subcommands, because if it is a popular name of a build directory then suddenly scripts that try to set up a build directory end up running a subcommand instead. The fact that we support this at all is a legacy design. Back in the day, the "meson" program was for setting up a build directory and all other tools were their own entry points, e.g. `mesontest` or `mesonconf`. Then in commit fa278f351fe3d6924b4d1961f77b5b4a36e133f8 we migrated to the subcommand mechanism. So, for backwards compatibility, we made those tools print a warning and then invoke `meson <tool>`. We also made the `meson` tool default to setup. However, we only warned for the other tools whose entry points were eventually deleted. We never warned for setup itself, we just continued to silently default to setup if no tool was provided. `meson setup` has worked since 0.42, which is 5 years old this week. It's available essentially everywhere. No one needs to use the old backwards-compatible invocation method, but it continues to drag down our ability to innovate. Let's finally do what we should have done a long time ago, and sunset it.
2022-08-15make add_project_dependencies respect build version of include dirsEli Schwartz1-1/+1
Fixes #10695
2022-08-12mesonbuild/mtest.py: filter more invalid googletest JUnit4 attributesDimitri John Ledkov1-0/+4
googletest 1.12.1 generates new JUnit4 invalid attributes file and line. Maybe all gtest "invalid" attributes are actually valid JUnit5 attributes, and maybe schema should be upgraded to JUni5. Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
2022-08-12mcompile: provide user visibility into what actually happensEli Schwartz1-2/+8
This command is magical and I hate it. Mostly because it seems people have no clue what it does, and what it doesn't do. Provide informational messages to the user indicating how it works, e.g. for debugging. Point out if we ran vsenv before shelling out to the backend.
2022-08-11CI: fix error when mixing clang 14 with released valgrind versionsEli Schwartz1-0/+1
Because clang now defaults to a dwarf version that valgrind does not yet support. There's support in valgrind git master, though.