summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Gilbert <bgilbert@backtick.net>2025-09-03 12:26:25 -0500
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-09-11 02:24:31 +0300
commit3734ff4bb11e82e59cf66a82288b80db3def83ec (patch)
tree6cb3a0b78985cde932389c1a33cba2b8e8cfdce1
parente0ea239397ab585c8490ca704b14ce2bf66ed7c4 (diff)
downloadmeson-3734ff4bb11e82e59cf66a82288b80db3def83ec.tar.gz
Document internal dep support in pkgconfig.generate `requires` arg
Added in #14750 for 1.9.0. Also add FeatureNew.
-rw-r--r--docs/markdown/Pkgconfig-module.md4
-rw-r--r--docs/markdown/Release-notes-for-1.9.0.md5
-rw-r--r--mesonbuild/modules/pkgconfig.py8
3 files changed, 14 insertions, 3 deletions
diff --git a/docs/markdown/Pkgconfig-module.md b/docs/markdown/Pkgconfig-module.md
index 7ddd31026..eb4102627 100644
--- a/docs/markdown/Pkgconfig-module.md
+++ b/docs/markdown/Pkgconfig-module.md
@@ -44,7 +44,9 @@ keyword arguments.
`${PREFIX}/include/foobar-1`, the correct value for this argument
would be `foobar-1`
- `requires` list of strings, pkgconfig-dependencies or libraries that
- `pkgconfig.generate()` was used on to put in the `Requires` field
+ `pkgconfig.generate()` was used on to put in the `Requires` field.
+ *Since 1.9.0* internal dependencies are supported if `pkgconfig.generate()`
+ was used on the underlying library.
- `requires_private` the same as `requires` but for the `Requires.private` field
- `url` a string with a url for the library
- `license` (*Since 1.9.0*) a string with a SPDX license to add to the generated file.
diff --git a/docs/markdown/Release-notes-for-1.9.0.md b/docs/markdown/Release-notes-for-1.9.0.md
index 2cf5a54e4..aad105fa9 100644
--- a/docs/markdown/Release-notes-for-1.9.0.md
+++ b/docs/markdown/Release-notes-for-1.9.0.md
@@ -49,6 +49,11 @@ section of .editorconfig based on the parsed file name.
When specified, it will add a `License:` attribute to the generated .pc file.
+## pkgconfig.generate supports internal dependencies in `requires`
+
+Internal dependencies can now be specified to `requires` if
+pkgconfig.generate was called on the underlying library.
+
## New experimental option `rust_dynamic_std`
A new option `rust_dynamic_std` can be used to link Rust programs so
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index bef14e9ea..8eb382b4c 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -157,6 +157,8 @@ class DependenciesHelper:
elif isinstance(obj, dependencies.ExternalDependency) and obj.name == 'threads':
pass
elif isinstance(obj, dependencies.InternalDependency) and all(lib.get_id() in self.metadata for lib in obj.libraries):
+ FeatureNew.single_use('pkgconfig.generate requirement from internal dependency', '1.9.0',
+ self.state.subproject, location=self.state.current_node)
# Ensure BothLibraries are resolved:
if self.pub_libs and isinstance(self.pub_libs[0], build.StaticLibrary):
obj = obj.get_as_static(recursive=True)
@@ -166,8 +168,10 @@ class DependenciesHelper:
processed_reqs.append(self.metadata[lib.get_id()].filebase)
else:
raise mesonlib.MesonException('requires argument not a string, '
- 'library with pkgconfig-generated file '
- f'or pkgconfig-dependency object, got {obj!r}')
+ 'library with pkgconfig-generated file, '
+ 'pkgconfig-dependency object, or '
+ 'internal-dependency object with '
+ f'pkgconfig-generated file, got {obj!r}')
return processed_reqs
def add_cflags(self, cflags: T.List[str]) -> None: