summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/modules/pkgconfig.py8
-rw-r--r--test cases/common/283 pkgconfig subproject/meson.build13
-rw-r--r--test cases/common/283 pkgconfig subproject/simple.c6
-rw-r--r--test cases/common/283 pkgconfig subproject/simple.h6
-rw-r--r--test cases/common/283 pkgconfig subproject/subprojects/simple2/exports.def2
-rw-r--r--test cases/common/283 pkgconfig subproject/subprojects/simple2/meson.build9
-rw-r--r--test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.c5
-rw-r--r--test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.h6
-rw-r--r--test cases/common/283 pkgconfig subproject/test.json15
9 files changed, 70 insertions, 0 deletions
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index e3f7a972d..bef14e9ea 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -156,6 +156,14 @@ class DependenciesHelper:
pass
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):
+ # Ensure BothLibraries are resolved:
+ if self.pub_libs and isinstance(self.pub_libs[0], build.StaticLibrary):
+ obj = obj.get_as_static(recursive=True)
+ else:
+ obj = obj.get_as_shared(recursive=True)
+ for lib in obj.libraries:
+ processed_reqs.append(self.metadata[lib.get_id()].filebase)
else:
raise mesonlib.MesonException('requires argument not a string, '
'library with pkgconfig-generated file '
diff --git a/test cases/common/283 pkgconfig subproject/meson.build b/test cases/common/283 pkgconfig subproject/meson.build
new file mode 100644
index 000000000..3b1335b2b
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/meson.build
@@ -0,0 +1,13 @@
+project('simple', 'c', meson_version: '>=1.9.0')
+pkgg = import('pkgconfig')
+
+simple2_dep = dependency('simple2')
+
+simple_lib = library('simple',
+ 'simple.c',
+ dependencies: [simple2_dep]
+)
+
+pkgg.generate(simple_lib,
+requires: simple2_dep,
+)
diff --git a/test cases/common/283 pkgconfig subproject/simple.c b/test cases/common/283 pkgconfig subproject/simple.c
new file mode 100644
index 000000000..da1d909f7
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/simple.c
@@ -0,0 +1,6 @@
+#include"simple.h"
+#include <simple2.h>
+
+int simple_function(void) {
+ return simple_simple_function();
+}
diff --git a/test cases/common/283 pkgconfig subproject/simple.h b/test cases/common/283 pkgconfig subproject/simple.h
new file mode 100644
index 000000000..6896bfd17
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/simple.h
@@ -0,0 +1,6 @@
+#ifndef SIMPLE_H_
+#define SIMPLE_H_
+
+int simple_function(void);
+
+#endif
diff --git a/test cases/common/283 pkgconfig subproject/subprojects/simple2/exports.def b/test cases/common/283 pkgconfig subproject/subprojects/simple2/exports.def
new file mode 100644
index 000000000..42c911b93
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/subprojects/simple2/exports.def
@@ -0,0 +1,2 @@
+EXPORTS
+ simple_simple_function @1
diff --git a/test cases/common/283 pkgconfig subproject/subprojects/simple2/meson.build b/test cases/common/283 pkgconfig subproject/subprojects/simple2/meson.build
new file mode 100644
index 000000000..199fea648
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/subprojects/simple2/meson.build
@@ -0,0 +1,9 @@
+project('simple2', 'c', meson_version: '>=1.9.0')
+pkgg = import('pkgconfig')
+
+lib2 = library('simple2', 'simple2.c', vs_module_defs: 'exports.def')
+lib_dep = declare_dependency(link_with: lib2, include_directories: include_directories('.'))
+
+pkgg.generate(lib2)
+
+meson.override_dependency('simple2', lib_dep)
diff --git a/test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.c b/test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.c
new file mode 100644
index 000000000..215b2aef8
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.c
@@ -0,0 +1,5 @@
+#include"simple2.h"
+
+int simple_simple_function(void) {
+ return 42;
+}
diff --git a/test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.h b/test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.h
new file mode 100644
index 000000000..472e135f2
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/subprojects/simple2/simple2.h
@@ -0,0 +1,6 @@
+#ifndef SIMPLE2_H_
+#define SIMPLE2_H_
+
+int simple_simple_function(void);
+
+#endif
diff --git a/test cases/common/283 pkgconfig subproject/test.json b/test cases/common/283 pkgconfig subproject/test.json
new file mode 100644
index 000000000..db6b52fe4
--- /dev/null
+++ b/test cases/common/283 pkgconfig subproject/test.json
@@ -0,0 +1,15 @@
+{
+ "installed": [
+ { "type": "file", "file": "usr/lib/pkgconfig/simple.pc"},
+ { "type": "file", "file": "usr/lib/pkgconfig/simple2.pc"}
+ ],
+ "matrix": {
+ "options": {
+ "default_library": [
+ { "val": "shared" },
+ { "val": "static" },
+ { "val": "both" }
+ ]
+ }
+ }
+}