summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/pkgconfig.py
AgeCommit message (Collapse)Author
2025-10-14pkgconfig: Improve handling of empty string depsEyal Itkin
Fix the original bug fix for #13950 to only warn about empty required strings, instead of failing the entire build. This will simplify the workflow for users that build the string from a possibly empty list, and save them the need for the added if-check. Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
2025-10-11pkgconfig: Handle malformatted string dependenciesEyal Itkin
Add missing checks for correctness of string dependency, including case for malformatted versioned dependency. Resolves #13950. Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
2025-09-11Document internal dep support in pkgconfig.generate `requires` argBenjamin Gilbert
Added in #14750 for 1.9.0. Also add FeatureNew.
2025-08-01modules/pkgconfig: Resolve dependencies in case of an internal dependencyCorentin Noël
When giving a dependency object as requires, allow to use the dependency from a subproject (that is an InternalDepdency).
2025-05-06Add license keyword to pkgconfig generateCharles Brunet
Fixes #14270.
2025-05-06do not use len to check emptynessCharles Brunet
2025-03-10coredata: replace get_option with optstore.get_value_forDylan Baker
This is an old method, that is now just a wrapper around the OptionStore method, that doesn't add any value. It's also an option related method attached to the CoreData instead of the OptionStore, so useless and a layering violation.
2025-02-12modules/pkgconfig: use host machine to calculate install prefixDylan Baker
The `mesonlib.is_*` functions are not correct to use here, since they are for the build machine, not the host machine. This means if the build machine if Linux but the host is Haiku, then pkg-config files willb e installed into $libdir/pkgconfig, instead of $prefix/develop/lib/pkgconfig
2024-09-11Fix pkgconfig.generate handling of BothLibraries dependenciesCharles Brunet
Was caused by 7b3169f. Fixes #13657.
2024-08-30update various deprecation notices to call out meson 2.0Eli Schwartz
2024-07-17Remove module type from OptionKey.Jussi Pakkanen
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2024-05-23Refactor option classes to their own file.Jussi Pakkanen
2024-02-26interpreter: Dependency variables can be empty stringXavier Claessens
There is no reason to forbid empty variables, PkgConfigCLI.variable() even has code specifically for handling that case.
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-11-22Make the Requires.private line in generated .pkgconfig files reproducibleChris Lamb
Whilst working on the Reproducible Builds effort, we noticed that meson was generates .pkgconfig files that are not reproducible. For example, here is neatvnc's pkgconfig file when built with HEAD^1: Name: neatvnc Description: A Neat VNC server library Version: 0.7.0 -Requires.private: pixman-1, aml < 0.4.0, aml >= 0.3.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil +Requires.private: pixman-1, aml >= 0.3.0, aml < 0.4.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil Libs: -L${libdir} -lneatvnc Libs.private: -lm Cflags: -I${includedir} This is, ultimately, due to iterating over the contents of a set within a DefaultDict and can thus be fixed by sorting the output immediately prior to generating the Requires.private string. An alternative solution would be to place the sorted(…) call a few lines down: return ', '.join(sorted(result)) However, this changes the expected ordering of the entire line, and many users may be unhappy with that (alternative) change as a result. By contrast, this commit will only enforce an ordering when there are multiple version requirements (eg. a lower and a higher version requirement, ie. a version range). It will, additionally, order them with the lower part of the range first. This was originally filed (with a slightly different patch) by myself in the the Debian bug tracker <https://bugs.debian.org/1056117>. Signed-off-by: Chris Lamb <lamby@debian.org>
2023-10-16compilers/d: use DFeatures for get_features_argsDylan Baker
2023-09-18pkgconfig: Set PKG_CONFIG in env for devenv and g-ir-scannerXavier Claessens
2023-08-03PkgConfigDependency: Move CLI handling into its own abstractionXavier Claessens
This makes the code cleaner and will allow to have other implementations in the future.
2023-07-25modules/pkgconfig: Don't insert None into devenv listDylan Baker
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-19fix implicit_reexport issues and enforce them going forwardEli Schwartz
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 Schwartz
2023-06-26tree-wide: reduce unneeded imports on specific Dependency implsEli Schwartz
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 Schwartz
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-01pkgconfig: Add include directories from internal deps in -uninstalled.pcXavier Claessens
Fixes: #8651
2023-04-18pkgconfig module: fix traceback on invalid missing descriptionEli Schwartz
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-01-20Haiku pkgconfig directory layout supportX512
2023-01-04forbid using declare_dependency(objects: ...) with pkg-config modulePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-10-03pylint: enable unnecessary-comprehensionDylan Baker
2022-08-18modules/pkgconfig: make it a NewExtensionModuleDylan Baker
Since we no longer need Interpreter.extract_variables, we can remove the interpreter from the module!
2022-08-18modules/pkgconfig: mypy clean!Dylan Baker
2022-08-18modules/pkgconfig: Fix code to handle CustomTarget and CustomTargetIndexDylan Baker
2022-08-18modules/pkgconfig: remove type checking abstractionDylan Baker
Which confuses the heck out of mypy
2022-08-18modules/pkgconfig: get rid of modifications to the BuildTarget objectsDylan Baker
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 Baker
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 Baker
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 Baker
2022-08-18modules/pkgconfig: use typed_pos_argsDylan Baker
2022-08-18modules/pkgconfig: fix typo in blocked variableDylan Baker
require_private -> requires_private.
2022-08-18modules/pkgconfig: Fix some low hanging typing issuesDylan Baker
2022-08-17modules: use module level information about new and deprecationDylan Baker
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-07-06pkgconfig: do not add valgrind as requirementMarc-André Lureau
For the same reasons commit 7aa28456d ("Add dependency type for Valgrind") removed linking with valgrind, pkgconfig shouldn't generate "Requirements" for it, in general. This solves dbus meson port question/issue from: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/303#note_1444819 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-06-17fix parameter expansion in several error messagesMichael Mera
At several points in the code base, f-strings are not correctly expanded due to missing 'f' string prefix. This fixes all the occurrences I could find.
2022-04-19pkgconfig: Add relocatable module optionFredrik Salomonsson
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-03-09Move dataonly pkgconfig file to datadir/pkgconfigTristan Partin
dataonly files are architecture independent (lib vs lib64 for example). Fixes #9902
2022-02-15pkgconfig module: allow custom variables to reference builtin directoriesEli Schwartz
Automatically generate additional variables and write them into the generated pkg-config file. This means projects no longer need to manually define the ones they use, which is annoying for dataonly usages (it used to forbid setting the base library-relevant "reserved" ones, and now allows it only for dataonly. But it's bloat to manualy list them anyway). It also fixes a regression in commit 248e6cf4736ef9ec636228da66c28f9be03aa74f which caused libdir to not be set, and to be unsettable, if the pkg-config file has no libraries but uses the ${libdir} expansion in a custom variable. This could be considered likely a case for dataonly, but it's not guaranteed.
2022-02-01pkgconfig: set libdir only if usedAndrea Pappacoda
This should address some concerns outlined in https://github.com/yhirose/cpp-httplib/pull/1182
2021-12-22pkgconfig: Fix linking to a custom targetXavier Claessens
When generating pkgconfig file for a library that links to an uninstalled static library built by custom_target() Meson was crashing when trying to access some attributes that does not exist on that class. Also fix is_internal() implementation, it only really make sense on a CustomTargetIndex or if CustomTarget has only a single output.
2021-11-01various manual conversion of percent-formatted strings to f-stringsEli Schwartz
2021-10-27fix various flake8 whitespace errorsEli Schwartz