aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
AgeCommit message (Collapse)AuthorFilesLines
2023-07-25modules/pkgconfig: Don't insert None into devenv listDylan Baker1-1/+2
When the pkgconfig module is imported, but not used, it will insert None on the end of the devenv list. This list is not expected to contain None, and causes Meson to crash. This can happen in complex build setups (reported from mesa), where pkgconfig is only used in some configurations Fixes: #12032
2023-07-19move various bits of type-checking only code to TYPE_CHECKING blocksEli Schwartz2-4/+4
Mostly detected with flake8-type-checking. Also quote T.cast() first arguments, since those are not affected by future annotations.
2023-07-19avoid module indirection in name resolution for imported objectsEli Schwartz1-56/+56
We already import a bunch of objects directly from ..build but don't use them nearly as much as we can. This resulted both in longer lines and s minor performance difference since python has to resolve the name binding the long way. There's no reason not to rewrite these names to use the direct imports. Found while investigating the fact that Executable was imported but never used. It's easier to just use it.
2023-07-19fix implicit_reexport issues and enforce them going forwardEli Schwartz6-15/+15
This detects cases where module A imports a function from B, and C imports that same function from A instead of B. It's not part of the API contract of A, and causes innocent refactoring to break things.
2023-07-19add better comments for mypy suppressionsEli Schwartz2-2/+3
2023-07-13cmake: fix directory separators in generated packageConfig.cmake filesMatthieu Rogez1-1/+2
On windows, meson would mix posix and windows dir separators in the computed PACKAGE_RELATIVE_PATH. Here we force posix directory separator even on Windows. This matches the CMake behavior and fixes interpretation of the resulting path. Fixes #6955 Fixes #9702
2023-07-10windows: Fix detection of the llvm-rc resource compilerMartin Storsjƶ1-0/+1
By default, clang-cl based environments use rc.exe as resource compiler. However, when cross compiling with clang-cl, one might want to use llvm-rc instead. Try to detect llvm-rc based on the output from "$CMD /?". This requires a very recent llvm-rc; previosly, the output of "/?" with llvm-rc was very generic and didn't explicitly indicate that it actually was llvm-rc. This was changed in https://github.com/llvm/llvm-project/commit/bab6902eba55026a829d232629f99ac276936ef0 which will be included in the upcoming LLVM 17.0.0 release. Contrary to the other regexes, don't include the preceding parts of the line in the log printout, as it includes an unhelpful "OVERVIEW:" prefix.
2023-07-05Merge pull request #11742 from xclaesse/link-whole-casesJussi Pakkanen1-1/+1
Fix niche cases when linking static libs
2023-06-27modules/rust: Add a keyword argument to pass extra args to the rust compilerDylan Baker1-1/+10
This may be necessary to, for example, stop rustc complaining about unused functions
2023-06-27modules/rust: Add a machine file property for extra clang args with bindgenDylan Baker1-1/+4
It's currently impossible to inject extra clang arguments when using bindgen, which is problematic when cross compiling since you may need critical arguments like `--target=...`. Because such arguments must be passed after the `--` it's impossible to inject them currently without going to something like a wrapper script. Fixes: #11805
2023-06-27modules/rust: Add a `link_with` kwarg to the test methodDylan Baker1-3/+10
This was requested by Mesa, where a bunch of `declare_dependency` objects are being created as a workaround for the lack of this keyword
2023-06-26Revert "modules: move gnome targets into gnome module"Eli Schwartz2-19/+20
This reverts commit a2def550c586aeba4269588e79a1a308467f2582. This results in a 2k line file being unconditionally imported at startup, and transitively loading two more (for a total cost of 2759 lines of code), and it's not clear it was ever needed to begin with...
2023-06-26dependencies: defer importing a custom dependency until it is usedEli Schwartz2-2/+4
This lessens the amount of code imported at Meson startup by mapping each dependency to a dictionary entry and using a programmable import to dynamically return it. Minus 16 files and 6399 lines of code imported at startup.
2023-06-26dependencies: move dub to a hidden package internal detailEli Schwartz1-4/+5
Do not import it and expose it at the package scope, it's never used elsewhere except inside the dub module.
2023-06-26tree-wide: reduce unneeded imports on specific Dependency implsEli Schwartz1-3/+2
We can check something's subtype using properties, without importing the module up front and doing isinstance checks on specific subclasses of the interface -- or worse, solving cyclic imports by doing the import inside the function. ;)
2023-06-26pkgconfig: move uninstalled devenv handling from setup to the module hookEli Schwartz1-2/+9
msetup.py doesn't need to know the gory details of PkgConfigDependency, or directly import it at program startup. It's also slightly wasteful to generate a devenv for the -uninstalled directory when a project doesn't even, in the end, use the pkgconfig module anyway.
2023-06-20interpreter: allow default_options and override_options as a dictDylan Baker1-1/+1
2023-06-15windows: Fix windres detection for Microsoft shipped ClangL. E. Segovia1-1/+2
Clang, clang-cl, and MSVC all rely on RC.EXE to build resource files. Fixes #11845
2023-06-01pkgconfig: Add include directories from internal deps in -uninstalled.pcXavier Claessens1-23/+18
Fixes: #8651
2023-06-01python: Use detect.find_external_dependency() for log consistencyXavier Claessens1-7/+3
py.find_installation().dependency() was not logging whether it is found or not. Use find_external_dependency() for consistency.
2023-05-31mlog: use a hidden class for stateDylan Baker1-2/+2
This is a pretty common pattern in python (the standard library uses it a ton): A class is created, with a single private instance in the module, and then it's methods are exposed as public API. This removes the need for the global statement, and is generally a little easier to reason about thanks to encapsulation.
2023-05-22i18n module: check for a good enough msgfmt before permitting merge_fileEli Schwartz1-1/+10
The concept of merge_file intrinsically requires some GNU-specific functionality, so let's emit a useful error message during configuration, when we don't have that. The relevant GNU gettext versions date back to around 2015 so *probably* anyone has that too, but we may as well verify that while we are here.
2023-05-22i18n module: be broadly supportive of portable gettext toolsEli Schwartz1-1/+1
There are a number of implementations for msgfmt, supporting various options. The simplest, and most common, use case is to compile .po files into .mo files, and this should be able to work on gettext implementations other than the GNU one. The problem is that we were passing some pretty portable arguments in an unportable manner. The `-o` option-argument and its associated argument came after the input file operand, which violates the POSIX Utility Syntax Guidelines, and happens to not be supported by Solaris gettext. The GNU gettext doesn't care; GNU invented GNU argument permutation. Switch the order around so that our use respects the POSIX style.
2023-05-13During reconfigure, show that no compiler was found, if compiler fails ā†µVolker WeiƟmann1-1/+1
sanity check.
2023-05-03cmake module: fix many typing issuesEli Schwartz1-23/+25
In #11761 it turned out that we failed to correctly handle all compiler.sizeof API changes in an old commit, breaking use of the module. And mypy could have caught this for us, except that the module is neither typed nor checked in CI. Partially solve this by adding lots of type annotations, greatly reducing the number of mypy errors in this file from 35 down to 12.
2023-05-03cmake module: make configured file correctly handle the do_conf_file APIEli Schwartz1-5/+5
This doesn't accept a dict, only an actual ConfigurationData object. Due to the way we poke at it, a dict can sort of work anyway, but might not if the internal layout isn't exactly correct. This is evidenced by the way we make the dict values be hard-to-read tuples containing emptiness, because that's how ConfigurationData objects handle descriptions. Simplify and make the seed dictionary readable, then actually convert it into a real ConfigurationData. Bonus: this now passes type checking.
2023-05-03cmake module: use more typed_pos_args for consistencyEli Schwartz1-14/+8
It's shorter and more descriptive. Although we always enforce the same rules either way, a unified decorator is one less line of code for each location, and also tells you how many "too few" arguments you *did* pass.
2023-05-03python bytecompile: use correct install tagEli Schwartz1-1/+1
2023-05-02bytecompile: switch to handling destdir in the script launcher envEli Schwartz1-6/+8
2023-05-02python module: add an automatic byte-compilation stepEli Schwartz1-4/+61
For all source `*.py` files installed via either py.install_sources() or an `install_dir: py.get_install_dir()`, produce `*.pyc` files at install time. Controllable via a module option.
2023-05-02update the devenv module hooks to support generic modifications to BuildEli Schwartz2-5/+6
We may want to do things like update install scripts as well, which have to happen before generating the backend. Instead of adding one module method per thing to do, use a single function that allows for modifying the Build object directly.
2023-05-02fix regression in precomputing CMAKE_SIZEOF_VOID_PMaxHearnden1-1/+1
In commit 808d5934dd6c6a6c16f66e9dc51dae6e83e02cef, compiler.sizeof was refactored to introduce caching, but cmake subprojects did not adapt to that API change and ended up embedding the python repr of a tuple as a cmake variable.
2023-05-02Log python name when not foundCharles Brunet1-3/+3
Fixes #11686.
2023-05-02Find python3.xx on windowsCharles Brunet1-2/+2
2023-05-02Ensure python fallback has the right versionCharles Brunet1-1/+2
Fixes #11057
2023-05-01build: Don't do a deep copy of kwargsXavier Claessens1-1/+1
It seems to only be used by the Rust module now, and it already does a copy.
2023-04-26Add env kwarg to gnome.generate_gir().Volker WeiƟmann1-1/+4
Fixes #384
2023-04-26Set the CC environment variable for g-ir-scanner.Volker WeiƟmann1-1/+4
Fixes #1035
2023-04-21modules/rust: Add -DNDEBUG to bindgen if b_ndebug is falseDylan Baker1-0/+3
Otherwise bindgen may generate different behavior than the compiled C code actually has.
2023-04-20extra_files keyword in declare_dependency()Charles Brunet2-2/+2
2023-04-18pkgconfig module: fix traceback on invalid missing descriptionEli Schwartz1-6/+8
If the optional first "mainlib" argument is there, then we infer several values. Otherwise, some of those values fall back to a generic default, and two of them -- name and description -- fall back to being mandatory. In commit e84f293f672a372d2434d0ce4fa39d3f902b6ce8, we removed validation for description as part of refactoring that never actually validated anything.
2023-04-11fix various spelling issuesJosh Soref3-3/+3
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11Change "can not" to "cannot" throughout projectHiPhish1-1/+1
The word "cannot" expresses inability to do something whereas "can not" expresses the ability to refrain from doing something.
2023-03-19CUDA: make "Ampere" equivalent to SM8.0+SM8.6David Seifert1-1/+8
2023-03-16modules/i18n: fix typo in gettext decoratorCorentin Noƫl1-1/+1
2023-03-16hotdoc: Install devhelp files at the right locationXavier Claessens1-1/+14
When devhelp is enabled, hotdoc generates a devhelp/ subdir that needs to be installed to /usr/share/devhelp/. Otherwise, the html/ subdir needs to be installed to /usr/share/doc/<project>/html/
2023-03-05hotdoc module: properly error out when configuring failsEli Schwartz1-1/+2
We used to just abort during configure because we ran in-process and hotdoc's argparse would leak into our own process space. Now we fail to handle this case and succeed at configuring, only for building to fail because the hotdoc config file doesn't exist.
2023-03-04typed_kwargs: Extend since_values and deprecated_values for typesXavier Claessens1-2/+2
2023-02-22merge the python dependency from the python module into dependenciesEli Schwartz1-206/+2
We have two copies of this code, and the python module one is vastly superior, not just because it allows choosing which python executable to base itself on. Unify this. Fixes various issues including non-Windows support for sysconfig, and pypy edge cases.
2023-02-22partial migration of the python module dependency into dependenciesEli Schwartz1-59/+2
In preparation for wholly merging the dependency handling from the python module into dependencies.*, move the unique class definitions from there into their new home in dependencies.python, which is semantically convenient.