summaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/dev.py
AgeCommit message (Collapse)Author
2025-12-17Dependencies: Make use of the DependencyCandidate classDylan Baker
This makes the type checking more reasonable (including fixing an issue that newer mypy is pointing out to us), consolidating special cases, and improving code readability.
2025-12-17dependencies: Require 'native' be passed in kwargsDylan Baker
This simplifies a bunch of cases, and likely fixes some annoying bugs in cross compile situations where should have been passing this and weren't.
2025-12-17dependencies: stop passing "language" as a keyword argumentDylan Baker
It's allowed in the `DependencyKeywordArguments` TypeDict already, so we now have two sources of truth. Additionally, it's often populated by reading from that dict, so we're just doing useless work.
2025-12-17dependencies: Pass the `name` to `ExternalDependency` constructorDylan Baker
So we don't create a default name that is overwritten except in the case of appleframeworks. This allows for some cleanup, including deleting some initializers that were only setting the name.
2025-12-17dependencies: Move type_name to class levelDylan Baker
This is really class constant for all dependencies, and by taking it out of the initializer we make the `__init__` call have a more consistent interface.
2025-11-19compilers: Remove Environment parameter from Compiler.get_defineDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_headerDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.find_libraryDylan Baker
2025-10-29environment: move tool detection functions to a new modulePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-20interpreter: port dependency version to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency optional_modules to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency native to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency modules to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency main to typed_kwargsDylan Baker
2025-10-20dependency: Use a TypedDict to describe the keyword arguments to DependencyDylan Baker
This allows us to check that all of the keyword arguments are of the correct type.
2025-04-02compilers: introduce get_exe() and get_exe_args()Paolo Bonzini
This will be used by rustdoc tests because the Test objects takes a single string for the command and everything else goes in the args. But apart from this, the need to split the executable from the arguments is common so create new methods to do it. While at it, fix brokenness in the handling of the zig compiler, which is checking against "zig" but failing to detect e.g. "/usr/bin/zig". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-03-24dependencies/dev: prepend sysroot when searching for GTest sourcesRoss Burton
Don't hardcode paths in /usr when looking for the GTest sources, as in cross-compile or other builds with a sysroot this will find the host sources, not ones that we want to use in the sysroot. Closes #12690.
2025-01-28dependencies: version_compare -> version_compare_manyDylan Baker
It's possible to get an array of versions here, so we need to handle that.
2024-09-21add diasdk dependencyunknown
2024-04-11dependencies/dev: make the warning about LLVM's CMake non-fatalDylan Baker
This isn't case where fatal is appropriate, as the end user has no control over this, and it may not be hit in all configurations of a project.
2024-04-11dependencies/llvm: Try to make warning about CMake betterDylan Baker
We have seen a number of bugs from people confused by warning that the need both a C and C++ compiler to use the CMake method. This attempts to provide a more helpful error message.
2024-02-12cmake dependency: avoid setting property to None as a workaroundEli Schwartz
It's an improper object model, but was used to signal to a subclass that self.traceparser did not exist. However, since it is always initialized from self.cmakebin, we can just check that instead.
2024-02-07Fix comment typosSam James
Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2023-12-20dependencies/llvm: strip default include dirs also for config-tool versionKarol Herbst
This should have been done in my earlier fix, but kinda forgot to test and fix it there as well. See https://github.com/mesonbuild/meson/pull/11733 for the discussion. Fixes: 8284be813 ("dependencies/llvm: strip default include dirs") Signed-off-by: Karol Herbst <kherbst@redhat.com>
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-09-22ZlibSystemDependency: pass libtype to clib_compiler.find_libraryAlan Coopersmith
Makes it stop reporting that it found a static zlib on Solaris which does not ship a static library file for libz, and thus allows "test cases/rust/13 external c dependencies" to pass. Fixes #10906
2023-06-26dependencies: switch the delayed-import mechanism for custom dependenciesEli Schwartz
Simply store the module it is expected to be found in. That module then appends to the packages dict, which guarantees mypy can verify that it's got the right type -- there is no casting needed.
2023-06-08dependencies/llvm: strip default include dirsKarol Herbst
Fixes an issue with rust.bindgen if a cmake LLVM dependency with the system include_type is getting used as a dependency.
2023-01-28cmake: allow dynamic linking with LLVMKonstantin
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-03Add fatal=False to many mlog.warnings()Dylan Baker
There are lots of warnings that become fatal, that are simply unfixable by the end user. Things like using old versions of software (because they're using some kind of LTS release), warnings about compilers not supporting certain kinds of checks, or standards being upgraded due to skipped implementations (MSVC has c++98 and c++14, but not c++11). None of these should be fatal, they're informative, and too important to reduce to notices, but not important enough to stop meson if they're printed.
2023-01-03dependencies/dev: refactor some code to make mypy happyDylan Baker
There should be a way to make mypy happy without casting, but I can't figure it out, since the mlog.error and mlog.debug actually have different signatures.
2022-12-15Change double quote doc comment to sinqle quoteTristan Partin
2022-12-15Try to find the jni dependency when javac is a Darwin stubTristan Partin
Darwin-based systems, at least macOS, provide various JDK executable stubs in /System/Library/Frameworks/JavaVM.framework/Versions/*/Commands. These stubs are placed in such a way that they break the heuristics of the JNI system dependency. If a javac being analyzed to find a Java home is a stub, use /usr/libexec/java_home. See https://stackoverflow.com/a/15133344/7572728 for more details. Closes #11173
2022-12-14Deduplicate code in JNISystemDependency conditionalTristan Partin
2022-11-29pylint: enable implicit-str-concatDylan Baker
Which catches a very real bug. The zlib system dependency failed to work on MSVC since initial implementation in commit c1a3b37ab7e4ccf3a946ee4ba6da81a4c230ecc4 -- it looked for the wrong name.
2022-11-29Fix crash when toolchain is missingSmallWood-D
Add a MissingCompiler class returned by compiler detecting methods intead of None - accessing such an object raises a DependencyException Fixes #10586 Co-authored-by: duckflyer <duckflyer@gmail.com>
2022-10-24Move JNISystemDependency to dependencies.base.detect_compilerTristan Partin
Only searches if the project already added that language before.
2022-10-09Fix some wording in a JNISystemDependency commentTristan Partin
2022-10-09Add BSD support to the JNISystemDependencyTristan Partin
Supports all BSDs that Meson currently supports. Fixes #10883
2022-09-19compilers: perform targeted imports for detectEli Schwartz
Only import the ones we need for the language we are detecting, once we actually detect that language. This will allow finally dropping the main imports of these files in a followup commit.
2022-09-19compilers: directly import from subpackagesEli Schwartz
It turns out we don't generally need to proxy every compiler ever through the top-level package. The number of times we directly poke at one is negligible and direct imports are pretty clean.
2022-09-12dependencies: simplify logging methodsEli Schwartz
A bunch of SystemDependency subclasses overrode log_tried() even though they used the same function anyway. Delete them -- they still print the same thing either way.
2022-08-29flake8: fix typing casts to not have actual objectsEli Schwartz
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-05-01cmake: Fix CMake LLVM dependency error (fixes #10322)Daniel Mensinger
2022-04-12cmake: Always use all compilers for LLVM (fixes #10249)Daniel Mensinger
2022-03-29move a bunch of imports into TYPE_CHECKING blocksEli Schwartz
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-04Add modules kwarg to JNI system depTristan Partin
This allows someone to link against libjvm.so and libjawt.so.
2022-03-02Rename JDK system dep to JNITristan Partin
JNI is a more apt name because it currently only supports the JNI. I also believe that CMake uses the terminology JNI here as well. JNI is currently the only way to interact with the JVM through native code, but there is a project called "Project Panama" which aims to be another way for native code to interact with the JVM.
2022-03-01mark a bunch of dependencies with the version they were introducedEli Schwartz
All these dependencies are impossible to find on versions of Meson older than the ones they got custom lookups in, because they don't provide pkg-config files. So they should not / cannot be reasonably used on older versions, and it is easy to say "yep, these should emit a FeatureNew for the versions they got added in".
2021-11-20dependencies/zlib: Allow for generic OS checksDudemanguy
Contrary to most system method checks, zlib currently functions as a whitelist of OSes. This isn't really needed however. The first special case for OSes that provide zlib as part of the base OS is worth keeping. However, the elif for windows is more than generic enough to allow any other potential OSes to try. Just make it a simplie if/else instead.