aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)AuthorFilesLines
2022-04-30pkgconfig: Use EnvironmentVariables to build PKG_CONFIG_* envXavier Claessens1-3/+2
The new get_env() method that returns an EnvironmentVariables object will be needed in next commit that will pass it to CustomTarget. This has the side effect to use the proper os specific path separator instead of hardcoding `:`. It is the obvious right thing to do here, but has caused issues in the past. Hopefully issues have been fixed in the meantime. If not, better deal with fallouts than keep doing the wrong thing forever.
2022-04-30qt module: fix missing sanity check for install_dir + installEli Schwartz1-0/+2
Regression in commit 11f96380351a88059ec55f1070fdebc1b1033117. When `install: true` the install_dir must be set. The CustomTarget initializer no longer checks this for us, so we must include the check ourselves.
2022-04-30qt module: fix broken install_dir kwargEli Schwartz1-2/+1
Regression in commit 11f96380351a88059ec55f1070fdebc1b1033117. We expect exactly one string as an install_dir, but CustomTarget started expecting it to be a list. So we need to pass it as such when forwarding compile_translations() arguments to the CustomTarget initializer.
2022-04-27gnome: Use 'doc' install_tag for gnome.yelpFerdinand Thiessen1-4/+6
2022-04-19pkgconfig: Add relocatable module optionFredrik Salomonsson1-2/+14
If set to true it will generate the pkgconfig files as relocatable i.e the prefix variable will be relative to the install_dir. By default this is false. Will generate a MesonException if the pkgconfig file is installed outside of the package and pkgconfig.relocatable=true.
2022-04-14qt module: move comment to the correct location after refactoringEli Schwartz1-2/+2
In commit f291b637b13ba32e20d1081906e68780d2a5ae5a the tools were moved around but a comment got forgotten. Now, in order to be meaningful and remind us of anything, it needs to be in a different location.
2022-04-13wayland: Make sure wayland-scanner has same version as wayland librariesXavier Claessens1-1/+6
2022-04-12qt module: also prefer the changed name scheme for the toolsEli Schwartz1-1/+3
Although Qt6 has decided these are "internal" commands and should never be run directly, so they don't get symlinked to /usr/bin at all, and are only available in the qt_dep.bindir anyway. But, the general naming pattern should be followed on principle.
2022-04-12Add support for Qt 6.1+John Lindgren1-0/+2
Qt 6.1 moved the location of some binaries from QT_HOST_BINS to QT_HOST_LIBEXECS as noted in the changelog: c515ee178f Move build tools to libexec instead of the bin dir - Tools that are called by the build system and are unlikely to be called by the user are now installed to the libexec directory. https://code.qt.io/cgit/qt/qtreleasenotes.git/tree/qt/6.1.0/release-note.txt It's possible to help the 'qt' module find the tools by adding Qt's libexec directory to the PATH environment variable, but this manual workaround is not ideal. To compensate, meson now needs to look for moc, rcc, uic, etc. in QT_HOST_LIBEXECS as well as QT_HOST_BINS. Co-authored-by: Stefan Hajnoczi <stefanha@jammr.net>
2022-04-12python module: windows dll name for pypy needs special casingMatti Picus1-1/+9
2022-04-10Use a temp file to invoke the introspection command.Jussi Pakkanen1-1/+6
This is more reliable as '-c' can, for example, exhaust the maximum command line length.
2022-04-10python module: restore logging for broken pythonEli Schwartz1-5/+12
This check was erroneously removed in commit c5c02b72e132a03ae0284bdd5e15d1675301a37d
2022-04-07Revert "wayland: Also lookup scanner in pkgconfig"Eli Schwartz3-10/+22
This reverts commit 7954a4c9cbf8355d8c8ea9b3d98df45d9f96f66e.
2022-04-04wayland: Also lookup scanner in pkgconfigXavier Claessens3-22/+10
This moves generally useful logic from GNOME module's _get_native_binary() into find_program() implementation. We could decide later to expose it as public API.
2022-03-31i18n: don't let our maintainer targets run via wrapped envEli Schwartz1-2/+2
They are RunTargets because they are one-shot commands without outputs. But we implement them purely via our internal wrapper for gettext, so there is no reason to wrap them *again* in our internal wrapper for meson_exe and set a bunch of environment variables we know we absolutely do not need, use, or want. This avoids the ugly "wrapped due to env" status, and allows users to directly see the command being run without going into despair at obscure pickled nonsense. It also offers a tiny defense against upgrading Meson without reconfiguring. People should not do that, and we error out about this in a bunch of places, but `--internal gettext` has a perfectly stable interface just like most build tools that aren't part of Meson internals, since it uses command line arguments instead of pickling.
2022-03-31fix continued breakage in gnome module APIEli Schwartz1-2/+2
In commit 823da3990947a8f4a2152826f0d7229f8a7a0159 we tried to fix disappearing dependencies. Instead, we appended the replacement dependencies to the existing ones. But this, too, was wrong. The function doesn't return new dependencies... it returns a copied list of all the dependencies, then alone of all parts of that API, expects to overwrite the existing variable. (Sadly, part of the internals actually uses the entire list for something.) As a result, we produced a repeatedly growing list, which eventually scaled really badly and e.g. OOMed on gstreamer. Instead, let's just replace the dependencies with the updated copy.
2022-03-29move a bunch of imports into TYPE_CHECKING blocksEli Schwartz4-7/+18
These are only used for type checking, so don't bother importing them at runtime. Generally add future annotations at the same time, to make sure that existing uses of these imports don't need to be quoted.
2022-03-29Pass environment down to base Target classXavier Claessens9-10/+47
2022-03-29gnome: Fix gtkdoc when using multiple Apple frameworksJan Tojnar1-30/+48
The `-framework Foundation -framework CoreFoundation` ended up de-duplicated by OrderedSet into `-framework Foundation CoreFoundation`.
2022-03-29gnome: Fix typo in _get_dependencies_flagsJan Tojnar1-1/+1
This was introduced in https://github.com/mesonbuild/meson/commit/823da3990947a8f4a2152826f0d7229f8a7a0159
2022-03-28fix regression in propagating depends in gtkdocEli Schwartz1-6/+11
In commit 68e684d51f1e469e0d9f4b499ffda15146cad98a the function signature was changed, but several places did not adapt. Additionally, we now totally dropped the in-place update of gtkdoc's sole source of dependencies, but didn't propagate them upward to assign the newly collected dependencies anywhere. Fixes building gtkdoc with internal dependencies and failing when specified directly (when building the 'all' target with sufficiently random parallelism, deps may be built on time). Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008382 https://gitlab.gnome.org/GNOME/libmediaart/-/issues/4
2022-03-24Make compilers list per subprojectXavier Claessens1-1/+2
Previously subprojects inherited languages already added by main project, or any previous subproject. This change to have a list of compilers per interpreters, which means that if a subproject does not add 'c' language it won't be able to compile .c files any more, even if main project added the 'c' language. This delays processing list of compilers until the interpreter adds the BuildTarget into its list of targets. That way the interpreter can add missing languages instead of duplicating that logic into BuildTarget for the cython case.
2022-03-24hotdoc module: use typed_pos_args to check positional argumentsEli Schwartz1-6/+4
We cannot use typed_kwargs though, because we allow fully arbitrary kwargs and pass them as arguments to the hotdoc program.
2022-03-24dub module: use typed_pos_args to check positional argumentsEli Schwartz1-4/+2
We cannot use typed_kwargs though, because we allow fully arbitrary kwargs and add them as keys in the generated dub file.
2022-03-24python 3 module: type-check all posargsEli Schwartz1-3/+4
Yes, it's deprecated, but we can still stop people doing the wrong thing with it if they are still using it.
2022-03-23gnome module: properly fallback to gtk-update-icon-cacheAntoine Jacoutot1-1/+1
Commit a0cade8f introduced a typo and wrongly check for gtk4-update-icon-cache twice. If gtk4-update-icon-cache (gtk4) is not found, look for gtk-update-icon-cache (gtk3) instead.
2022-03-20modules/rust: set bindgen include_dirs for both build and source dirDylan Baker1-1/+2
Which we pretty obviously need if any of our headers are generated
2022-03-18gnome module: fix incorrect lookup of nonexistent dependencies in post_installEli Schwartz1-3/+3
While gtk+-3.0 / gtk4 do exist, they have never provided the location of the gtk-update-icon-cache program as a pkgconfig variable. Trying to find one anyway, resulted in two things happening: - a useless dep lookup - a fatal-meson-warnings error and build failure because the get_pkgconfig_variable() in question never existed The desktop-file-utils package is a package solely providing some command line programs, and has never provided a pkg-config file in the first place, so this always logged that the dependency was not found and fell back to normal find_program_impl(), although without fatal-meson-warnings build errors. Fixes #10139
2022-03-16python: Remove warning about invalid install pathXavier Claessens1-9/+0
It was originally added because proper detection was not working on Debian, but that has been fixed since. It was causing annoying warning by default when prefix is /usr/local that can only be avoided by setting options.
2022-03-15Revert "devenv: Set PYTHONPATH where we install python modules"Eli Schwartz1-43/+6
This reverts commit 79c6075b560dbf1c3e4e0b30f1c472dc2086421e. # Conflicts: # docs/markdown/snippets/devenv.md # mesonbuild/modules/python.py # test cases/unit/91 devenv/test-devenv.py PYTHONPATH cannot be reliably determined. The standard use case for installing python modules with Meson is mixed pure sources (at least `__init__.py`) and compiled extension_modules or configured files. Unfortunately that doesn't actually work because python will not load the same package hierarchy from two different directories, one a source directory and one a (mandatory) out of tree build directory. (It kind of can, but you need to do what this test case accidentally stumbled upon, which is namespace packages. Namespace packages are a very specific use case and you are NOT SUPPOSED to use them outside that use case, so people are not going to use them just to circumvent Meson devenv stuff as that would have negative install-time effects.) Adding PYTHONPATH anyway will just lead to documentation commitments which we cannot actually uphold, and confusing issues at time of use because some imports *will* work... and some will *not*. The end result will be a half-created tree of modules which just doesn't work together at all, but because it partially works, users attempting to debug it will spend time wondering why parts of it do import. For any case where the automatic devenv would work correctly, it will also work correctly to use `meson.add_devenv()` a single time, which is very easy to manually get correct and doesn't provide any significant value to automate. In the long run, an uninstalled python package environment will require "editable installs" support.
2022-03-14sourceset: reorder fields in SourceSetRulePaolo Bonzini1-10/+10
Keep conditions first, then "if true" fields, and the if_false sources last. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-14sourceset: document fields of SourceSetRulePaolo Bonzini1-0/+12
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-14sourceset: improve typing of SourceSetRulePaolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-14sourceset: reinstate extra_depsPaolo Bonzini1-2/+4
Dependencies in the "if_true" keyword argument do not prevent the sources from being used; in other words, they work just like dependencies with "disabler: false". However, this was broken in commit ab0ffc6a2 ("modules/sourceset: Fix remaining typing issues", 2022-02-23) which changed logic instead of just fixing typing issues. This was likely an attempt to avoid using "dependencies.Dependency" after the "dependencies" field was declared, but it also broke QEMU. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-14sourceset: rename "dependencies" fields to depsPaolo Bonzini1-6/+6
The dependencies field clashes with the dependencies module, so that mypy interprets "dependencies.Dependency" as a "Dependency" attribute of the "dependencies" field. Rename the field to something else, so that it does not clash. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-13gnome module: fix crash due to misused function while generating gir commandEli Schwartz1-3/+3
In commit 68e684d51f1e469e0d9f4b499ffda15146cad98a the _get_link_args function was modified from returning a list[str] of arguments, to a tuple of both that and a modified copy of the entire target's current/enhanced dependencies (why not just the new ones? I don't know). However, the existing use of the function was not adapted to this change, and tried to turn this entire tuple into a node of the command line. Tuples cannot flatten to lists, and mesonlib.File or HoldableObjects don't make good command line arguments. As a result we errored out with: ERROR: Argument (['-L/path/to/builddir/', '--extra-library=foo'], [<SharedLibrary 25a6634@@foo@sha: foo>, <SharedLibrary 25a6634@@foo@sha: foo>, <SharedLibrary 25a6634@@foo@sha: foo>]) in "command" is invalid Split out the flags and the dependencies and update the former while replacing the latter.
2022-03-13Merge pull request #9339 from dcbaker/submit/structured_sourcesJussi Pakkanen2-14/+13
Structured Sources
2022-03-10Remove a spurious debug print in Python moduleRalf Gommers1-1/+0
This prints many lines of unwanted "done /absolute/path", I noticed this when testing 0.62.0rc1 with SciPy. [ci skip]
2022-03-09Move dataonly pkgconfig file to datadir/pkgconfigTristan Partin1-0/+1
dataonly files are architecture independent (lib vs lib64 for example). Fixes #9902
2022-03-09fix python traceback when gtkdoc needs an exe_wrapper but doesn't have oneEli Schwartz1-2/+4
In commit c88bfdbefc2f79ac2dfa9bff5847c350de5f5db8 we added support for an exe_wrapper to gtkdoc, which checked twice whether the environment says it is needed, and didn't check at all whether one was provided. The result: File "/usr/lib/python3/dist-packages/mesonbuild/modules/gnome.py", line 1354, in gtkdoc t_args.append('--run=' + ' '.join(state.environment.get_exe_wrapper().get_command())) AttributeError: 'NoneType' object has no attribute 'get_command' Instead, check whether we have a valid exe_wrapper (if we don't need one, then even when one is defined in the cross file, we get an EmptyExternalProgram) and if we do, use it. If we don't have one, but need one, then we revert back to the behavior before commit c88bfdbefc2f79ac2dfa9bff5847c350de5f5db8, which probably means "executing the doc target causes the command to error out with "Exec format error".
2022-03-07fix correctly detecting whether python is found if link args are emptyEli Schwartz1-1/+1
There are two cases where we can assume we found the python dependency with its requisite libraries using sysconfig: - we found the library with find_library and are prepared to link to it - the library is not actually part of the dependency, so its presence or absence is irrelevant In the latter case, we should consider it found if link_libpython is False. Originally we did this, but the logic was inverted in commit 5b422fce87826beff3bca85e9c9081f22b3f45b7 in an unrelated change and without explanation, likely by accident. Normally this doesn't much matter, since a python invariably comes with a predictably located libpython and the first condition evaluates true. But that is not true for pypy, and in fact that is the reason the link_libpython check was originally added in commit 1bd14b52b26b0f4ec207bf7e38813b82bfc15f86. Restore that original logic. Fixes #8570
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz3-4/+4
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-03-07merge various TYPE_CHECKING blocks into oneEli Schwartz1-36/+29
A bunch of files have several T.TYPE_CHECKING blocks that each do some things which could just as well be done once, with a single `if` statement. Make them do so.
2022-03-07Fix @typed_pos_args on java.generate_native_headersTristan Partin1-5/+6
2022-03-07build: plumb structured sources into BuildTargetsDylan Baker2-14/+13
2022-03-07Merge pull request #10043 from dcbaker/submit/type-checking-for-subprojectJussi Pakkanen2-20/+46
Add typing for subproject()
2022-03-06i18n.merge_file: do not disable in the absence of gettext toolsEli Schwartz1-4/+1
Disabling targets because the tools used to build them aren't available is a pretty suspicious thing to do. Users who want this are probably, in general, advised to check themselves whether it is possible to build those targets with find_program(..., required: false) The i18n.gettext() invocation is a bit unusual because the product of running it is non-critical files, specifically, translation catalogs. If users don't have the tools needed to build them, they may not be able to use them either, because perhaps they have NLS disabled on their platform or it's difficult to put it in the bootstrap path. So, for this reason, it was made non-fatal and the message catalogs are just not created, and the resulting build is still perfectly usable *unless* you want to use it in another language, at which point it "works" but the text is all inscrutable to the end user, and that's a feature of the target platform. That's an acceptable tradeoff for translation catalogs. It is NOT an acceptable tradeoff for merge_file, which produces desktop files or MIME database catalogs or other files which have crucial roles to perform, without which the software in question simply doesn't work at all. In such cases, this just fails to install crucial files, users report bugs to the project in question, and the project adds `find_program('xgettext')` to guarantee the hard error due to lack of confidence in Meson. Fixes #6165 Fixes #8436
2022-03-06i18n module: report initial call site when disabling translation supportEli Schwartz1-4/+5
2022-03-06i18n module: detect gettext tools at configure timeEli Schwartz1-13/+27
Use this instead of shutil.which to detect whether they will be available, and pass the ExternalProgram object to CustomTarget invocations, or else make use of the new functionality to specify the correct program path in wrapper scripts. Drop duplicate reporting for itstool missing. Since we use find_program in required mode, its absence is already fatal, and already has a really good error description.
2022-03-06i18n module: fix bug that made msgfmthelper die on combinations of argsEli Schwartz1-2/+1
Due to misuse of argparse in commit 82492f5d765b70cc87385fb887008df89fac878e it was impossible to use both --datadirs and extra args passed directly to msgfmt at the same time. I'm not sure anyone actually knows how argparse works, so misusing it is easy. What is definitely known is that argparse is NOT a POSIX compliant parser and doesn't behave the way you'd expect a standards based parser to handle options. Instead it caters to the easy use case, and hopes and prays you don't need to do anything too complicated "with the wrong kind of complicated". Apparently, this particular type of complicated is when you have mixed option_arguments and operands while simultaneously passing some operands as nargs after a --. It totally breaks, and interprets --datadirs, which is supposed to be an option_argument, as an operand, eats it up as a msgfmt wrapped argument, and breaks. But if you don't pass additional arguments with -- then it interprets --datadirs after operands as an option_argument. This is what we were doing. Instead pass option_arguments before all operands (including the ones specified via `-- ...`). Add test case to pass meaningless datadirs (we don't actually care if $GETTEXTDATADIRS is set to something that doesn't contain gettext data).