Skip to content

Commit 15c2324

Browse files
committed
Document internal dep support in pkgconfig.generate requires arg
Added in mesonbuild#14750 for 1.9.0. Also add FeatureNew.
1 parent 80917ca commit 15c2324

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

docs/markdown/Pkgconfig-module.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ keyword arguments.
4444
`${PREFIX}/include/foobar-1`, the correct value for this argument
4545
would be `foobar-1`
4646
- `requires` list of strings, pkgconfig-dependencies or libraries that
47-
`pkgconfig.generate()` was used on to put in the `Requires` field
47+
`pkgconfig.generate()` was used on to put in the `Requires` field.
48+
*Since 1.9.0* internal dependencies are supported if `pkgconfig.generate()`
49+
was used on them.
4850
- `requires_private` the same as `requires` but for the `Requires.private` field
4951
- `url` a string with a url for the library
5052
- `license` (*Since 1.9.0*) a string with a SPDX license to add to the generated file.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## pkgconfig.generate supports internal dependencies in `requires`
2+
3+
Internal dependencies can now be specified to `requires` if
4+
pkgconfig.generate was called on the underlying library.

mesonbuild/modules/pkgconfig.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def _process_reqs(self, reqs: T.Sequence[T.Union[str, build.StaticLibrary, build
157157
elif isinstance(obj, dependencies.ExternalDependency) and obj.name == 'threads':
158158
pass
159159
elif isinstance(obj, dependencies.InternalDependency) and all(lib.get_id() in self.metadata for lib in obj.libraries):
160+
FeatureNew.single_use('pkgconfig.generate requirement from internal dependency', '1.9.0',
161+
self.state.subproject, location=self.state.current_node)
160162
# Ensure BothLibraries are resolved:
161163
if self.pub_libs and isinstance(self.pub_libs[0], build.StaticLibrary):
162164
obj = obj.get_as_static(recursive=True)
@@ -166,8 +168,10 @@ def _process_reqs(self, reqs: T.Sequence[T.Union[str, build.StaticLibrary, build
166168
processed_reqs.append(self.metadata[lib.get_id()].filebase)
167169
else:
168170
raise mesonlib.MesonException('requires argument not a string, '
169-
'library with pkgconfig-generated file '
170-
f'or pkgconfig-dependency object, got {obj!r}')
171+
'library with pkgconfig-generated file, '
172+
'pkgconfig-dependency object, or '
173+
'internal-dependency object with '
174+
f'pkgconfig-generated file, got {obj!r}')
171175
return processed_reqs
172176

173177
def add_cflags(self, cflags: T.List[str]) -> None:

0 commit comments

Comments
 (0)