aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/build.py16
-rwxr-xr-xrun_project_tests.py4
-rw-r--r--test cases/common/145 whole archive/allofme/meson.build1
-rw-r--r--test cases/common/145 whole archive/exe/meson.build3
-rw-r--r--test cases/common/145 whole archive/exe2/meson.build2
-rw-r--r--test cases/common/145 whole archive/func1.c (renamed from test cases/common/145 whole archive/libfile.c)0
-rw-r--r--test cases/common/145 whole archive/func2.c (renamed from test cases/common/145 whole archive/dylib.c)0
-rw-r--r--test cases/common/145 whole archive/meson.build22
-rw-r--r--test cases/common/145 whole archive/sh_func2_linked_func1/meson.build3
-rw-r--r--test cases/common/145 whole archive/sh_only_link_whole/meson.build1
-rw-r--r--test cases/common/145 whole archive/shlib/meson.build4
-rw-r--r--test cases/common/145 whole archive/st_func1/meson.build1
-rw-r--r--test cases/common/145 whole archive/st_func2/meson.build1
-rw-r--r--test cases/common/145 whole archive/stlib/meson.build1
-rw-r--r--test cases/common/145 whole archive/wholeshlib/meson.build1
-rw-r--r--test cases/common/179 source in dep/bar.cpp5
-rw-r--r--test cases/common/179 source in dep/foo.c3
-rw-r--r--test cases/common/179 source in dep/meson.build6
-rw-r--r--test cases/frameworks/10 gtk-doc/meson.build13
19 files changed, 58 insertions, 29 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index c5fc7f6..6ed8843 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -365,9 +365,9 @@ class BuildTarget(Target):
# 1. Pre-existing objects provided by the user with the `objects:` kwarg
# 2. Compiled objects created by and extracted from another target
self.process_objectlist(objects)
- self.process_compilers()
self.process_kwargs(kwargs, environment)
self.check_unknown_kwargs(kwargs)
+ self.process_compilers()
if not any([self.sources, self.generated, self.objects, self.link_whole]):
raise InvalidArguments('Build target %s has no sources.' % name)
self.process_compilers_late()
@@ -500,6 +500,13 @@ class BuildTarget(Target):
# which is what we need.
if not is_object(s):
sources.append(s)
+ for d in self.external_deps:
+ if hasattr(d, 'held_object'):
+ d = d.held_object
+ for s in d.sources:
+ if isinstance(s, (str, File)):
+ sources.append(s)
+
# Sources that were used to create our extracted objects
for o in self.objects:
if not isinstance(o, ExtractedObjects):
@@ -651,10 +658,6 @@ just like those detected with the dependency() function.''')
self.link(linktarget)
lwhole = extract_as_list(kwargs, 'link_whole')
for linktarget in lwhole:
- # Sorry for this hack. Keyword targets are kept in holders
- # in kwargs. Unpack here without looking at the exact type.
- if hasattr(linktarget, "held_object"):
- linktarget = linktarget.held_object
self.link_whole(linktarget)
c_pchlist, cpp_pchlist, clist, cpplist, cslist, valalist, objclist, objcpplist, fortranlist, rustlist \
@@ -690,8 +693,7 @@ just like those detected with the dependency() function.''')
raise InvalidArguments('Arguments to d_import_dirs must be include_directories.')
dfeatures['import_dirs'] = dfeature_import_dirs
if dfeatures:
- if 'd' in self.compilers:
- self.d_features = dfeatures
+ self.d_features = dfeatures
self.link_args = extract_as_list(kwargs, 'link_args')
for i in self.link_args:
diff --git a/run_project_tests.py b/run_project_tests.py
index f9d4dbd..e9afa81 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -445,8 +445,8 @@ def skippable(suite, test):
if not suite.endswith('frameworks'):
return True
- # gtk-doc test is always skipped pending upstream fixes for spaces in
- # filenames landing in distros
+ # gtk-doc test may be skipped, pending upstream fixes for spaces in
+ # filenames landing in the distro used for CI
if test.endswith('10 gtk-doc'):
return True
diff --git a/test cases/common/145 whole archive/allofme/meson.build b/test cases/common/145 whole archive/allofme/meson.build
deleted file mode 100644
index f5c2027..0000000
--- a/test cases/common/145 whole archive/allofme/meson.build
+++ /dev/null
@@ -1 +0,0 @@
-stlib = static_library('allofme', '../libfile.c')
diff --git a/test cases/common/145 whole archive/exe/meson.build b/test cases/common/145 whole archive/exe/meson.build
index f47a246..91d298d 100644
--- a/test cases/common/145 whole archive/exe/meson.build
+++ b/test cases/common/145 whole archive/exe/meson.build
@@ -1,2 +1 @@
-exe = executable('prog', '../prog.c',
- link_with : dylib)
+exe = executable('prog', '../prog.c', link_with : sh_func2_linked_func1)
diff --git a/test cases/common/145 whole archive/exe2/meson.build b/test cases/common/145 whole archive/exe2/meson.build
index 5365f03..9184864 100644
--- a/test cases/common/145 whole archive/exe2/meson.build
+++ b/test cases/common/145 whole archive/exe2/meson.build
@@ -1 +1 @@
-exe2 = executable('prog2', '../prog.c', link_with : dylib2)
+exe2 = executable('prog2', '../prog.c', link_with : sh_only_link_whole)
diff --git a/test cases/common/145 whole archive/libfile.c b/test cases/common/145 whole archive/func1.c
index b2690a0..b2690a0 100644
--- a/test cases/common/145 whole archive/libfile.c
+++ b/test cases/common/145 whole archive/func1.c
diff --git a/test cases/common/145 whole archive/dylib.c b/test cases/common/145 whole archive/func2.c
index 9e287a4..9e287a4 100644
--- a/test cases/common/145 whole archive/dylib.c
+++ b/test cases/common/145 whole archive/func2.c
diff --git a/test cases/common/145 whole archive/meson.build b/test cases/common/145 whole archive/meson.build
index 617ae03..56da157 100644
--- a/test cases/common/145 whole archive/meson.build
+++ b/test cases/common/145 whole archive/meson.build
@@ -10,15 +10,23 @@ if cc.get_id() == 'msvc'
endif
endif
-subdir('allofme')
-subdir('shlib')
+# Test 1: link_whole keeps all symbols
+# Make static func1
+subdir('st_func1')
+# Make shared func2 linking whole func1 archive
+subdir('sh_func2_linked_func1')
+# Link exe with shared library only
subdir('exe')
-
+# Test that both func1 and func2 are accessible from shared library
test('prog', exe)
-# link_whole only
-subdir('stlib')
-subdir('wholeshlib')
+# Test 2: link_whole can be used instead of source list, see #2180
+# Make static func2
+subdir('st_func2')
+# Link both func1 and func2 into same shared library
+# which does not have any sources other than 2 static libraries
+subdir('sh_only_link_whole')
+# Link exe2 with shared library only
subdir('exe2')
-
+# Test that both func1 and func2 are accessible from shared library
test('prog2', exe2)
diff --git a/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build b/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build
new file mode 100644
index 0000000..2858f65
--- /dev/null
+++ b/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build
@@ -0,0 +1,3 @@
+# Nothing in func2.c uses func1, so the linker would throw it
+# away and thus linking the exe would fail.
+sh_func2_linked_func1 = shared_library('sh_func2_linked_func1', '../func2.c', link_whole : st_func1)
diff --git a/test cases/common/145 whole archive/sh_only_link_whole/meson.build b/test cases/common/145 whole archive/sh_only_link_whole/meson.build
new file mode 100644
index 0000000..64baabd
--- /dev/null
+++ b/test cases/common/145 whole archive/sh_only_link_whole/meson.build
@@ -0,0 +1 @@
+sh_only_link_whole = shared_library('sh_only_link_whole', link_whole : [st_func1, st_func2])
diff --git a/test cases/common/145 whole archive/shlib/meson.build b/test cases/common/145 whole archive/shlib/meson.build
deleted file mode 100644
index 34a1b78..0000000
--- a/test cases/common/145 whole archive/shlib/meson.build
+++ /dev/null
@@ -1,4 +0,0 @@
-# Nothing in dylib.c uses func1, so the linker would throw it
-# away and thus linking the exe would fail.
-dylib = shared_library('shlib', '../dylib.c',
- link_whole : stlib)
diff --git a/test cases/common/145 whole archive/st_func1/meson.build b/test cases/common/145 whole archive/st_func1/meson.build
new file mode 100644
index 0000000..c84d781
--- /dev/null
+++ b/test cases/common/145 whole archive/st_func1/meson.build
@@ -0,0 +1 @@
+st_func1 = static_library('st_func1', '../func1.c')
diff --git a/test cases/common/145 whole archive/st_func2/meson.build b/test cases/common/145 whole archive/st_func2/meson.build
new file mode 100644
index 0000000..2732f96
--- /dev/null
+++ b/test cases/common/145 whole archive/st_func2/meson.build
@@ -0,0 +1 @@
+st_func2 = static_library('st_func2', '../func2.c')
diff --git a/test cases/common/145 whole archive/stlib/meson.build b/test cases/common/145 whole archive/stlib/meson.build
deleted file mode 100644
index 07a434e..0000000
--- a/test cases/common/145 whole archive/stlib/meson.build
+++ /dev/null
@@ -1 +0,0 @@
-static = static_library('static', '../dylib.c')
diff --git a/test cases/common/145 whole archive/wholeshlib/meson.build b/test cases/common/145 whole archive/wholeshlib/meson.build
deleted file mode 100644
index 69a1995..0000000
--- a/test cases/common/145 whole archive/wholeshlib/meson.build
+++ /dev/null
@@ -1 +0,0 @@
-dylib2 = shared_library('link_whole', link_whole : [stlib, static])
diff --git a/test cases/common/179 source in dep/bar.cpp b/test cases/common/179 source in dep/bar.cpp
new file mode 100644
index 0000000..bda8cb6
--- /dev/null
+++ b/test cases/common/179 source in dep/bar.cpp
@@ -0,0 +1,5 @@
+extern "C" int foo();
+
+int main(int, char**) {
+ return foo() != 42;
+}
diff --git a/test cases/common/179 source in dep/foo.c b/test cases/common/179 source in dep/foo.c
new file mode 100644
index 0000000..1ecfa8c
--- /dev/null
+++ b/test cases/common/179 source in dep/foo.c
@@ -0,0 +1,3 @@
+int foo() {
+ return 42;
+}
diff --git a/test cases/common/179 source in dep/meson.build b/test cases/common/179 source in dep/meson.build
new file mode 100644
index 0000000..e2c007e
--- /dev/null
+++ b/test cases/common/179 source in dep/meson.build
@@ -0,0 +1,6 @@
+project('foo', 'c', 'cpp')
+
+dep = declare_dependency(sources : 'foo.c')
+
+executable('bar', 'bar.cpp',
+ dependencies : dep)
diff --git a/test cases/frameworks/10 gtk-doc/meson.build b/test cases/frameworks/10 gtk-doc/meson.build
index 71f341c..5c22ad0 100644
--- a/test cases/frameworks/10 gtk-doc/meson.build
+++ b/test cases/frameworks/10 gtk-doc/meson.build
@@ -13,8 +13,15 @@ inc = include_directories('include')
subdir('include')
-# We have to disable this test until this bug fix has landed to
-# distros https://bugzilla.gnome.org/show_bug.cgi?id=753145
-error('MESON_SKIP_TEST can not enable gtk-doc test until upstream fixes have landed.')
+# disable this test unless a bug fix for spaces in pathnames is present
+# https://bugzilla.gnome.org/show_bug.cgi?id=753145
+result = run_command(gtkdoc, ['--version'])
+gtkdoc_ver = result.stdout().strip()
+if gtkdoc_ver == ''
+ gtkdoc_ver = result.stderr().strip()
+endif
+if gtkdoc_ver.version_compare('<1.26')
+ error('MESON_SKIP_TEST gtk-doc test requires gtkdoc >= 1.26.')
+endif
subdir('doc')