summaryrefslogtreecommitdiff
path: root/test cases/unit
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2019-09-18 22:06:19 -0400
committerXavier Claessens <xclaesse@gmail.com>2019-10-01 13:06:45 -0400
commitdc5ad1fad953d8cc2191aed1bd6c7c7db83faf99 (patch)
tree8e590d391931dd4701bf61f5609bc409ae3663b9 /test cases/unit
parent484b721369957100ee6d2b76f17224a583e2bd86 (diff)
downloadmeson-dc5ad1fad953d8cc2191aed1bd6c7c7db83faf99.tar.gz
pkgconfig: Do not include uninstalled static libraries
Diffstat (limited to 'test cases/unit')
-rw-r--r--test cases/unit/69 static link/lib/func5.c4
-rw-r--r--test cases/unit/69 static link/lib/func6.c6
-rw-r--r--test cases/unit/69 static link/lib/meson.build12
-rw-r--r--test cases/unit/69 static link/meson.build8
-rw-r--r--test cases/unit/69 static link/test3.c6
5 files changed, 36 insertions, 0 deletions
diff --git a/test cases/unit/69 static link/lib/func5.c b/test cases/unit/69 static link/lib/func5.c
new file mode 100644
index 000000000..8e078641c
--- /dev/null
+++ b/test cases/unit/69 static link/lib/func5.c
@@ -0,0 +1,4 @@
+int func5()
+{
+ return 1;
+}
diff --git a/test cases/unit/69 static link/lib/func6.c b/test cases/unit/69 static link/lib/func6.c
new file mode 100644
index 000000000..276fe7d48
--- /dev/null
+++ b/test cases/unit/69 static link/lib/func6.c
@@ -0,0 +1,6 @@
+int func5();
+
+int func6()
+{
+ return func5() + 1;
+}
diff --git a/test cases/unit/69 static link/lib/meson.build b/test cases/unit/69 static link/lib/meson.build
index f5cc76b62..9bd3d1944 100644
--- a/test cases/unit/69 static link/lib/meson.build
+++ b/test cases/unit/69 static link/lib/meson.build
@@ -1,5 +1,7 @@
project('test static link libs', 'c')
+pkg = import('pkgconfig')
+
# libfunc2 should contain both func1() and func2() symbols
libfunc1 = static_library('func1', 'func1.c',
install : false)
@@ -14,3 +16,13 @@ libfunc3 = static_library('func3', 'func3.c',
libfunc4 = static_library('func4', 'func4.c',
link_with : libfunc3,
install : true)
+
+# Same as above, but also generate an pkg-config file. Use both_libraries() to
+# make sure a complete .pc file gets generated. libfunc5 should not be mentioned
+# into the .pc file because it's not installed.
+libfunc5 = static_library('func5', 'func5.c',
+ install : false)
+libfunc6 = both_libraries('func6', 'func6.c',
+ link_with : libfunc5,
+ install : true)
+pkg.generate(libfunc6)
diff --git a/test cases/unit/69 static link/meson.build b/test cases/unit/69 static link/meson.build
index 4d5d074ac..307139aba 100644
--- a/test cases/unit/69 static link/meson.build
+++ b/test cases/unit/69 static link/meson.build
@@ -9,3 +9,11 @@ test('test1', executable('test1', 'test1.c', dependencies : func2_dep))
# Verify that installed libfunc4.a is usable
func4_dep = cc.find_library('func4')
test('test2', executable('test2', 'test2.c', dependencies : func4_dep))
+
+# Verify that installed pkg-config file is usable for both shared and static link
+func6_static_dep = dependency('func6', static : true)
+test('test3-static', executable('test3-static', 'test3.c',
+ dependencies : func6_static_dep))
+func6_shared_dep = dependency('func6', static : false)
+test('test3-shared', executable('test3-shared', 'test3.c',
+ dependencies : func6_shared_dep))
diff --git a/test cases/unit/69 static link/test3.c b/test cases/unit/69 static link/test3.c
new file mode 100644
index 000000000..1216064dc
--- /dev/null
+++ b/test cases/unit/69 static link/test3.c
@@ -0,0 +1,6 @@
+int func6();
+
+int main(int argc, char *argv[])
+{
+ return func6() == 2 ? 0 : 1;
+}