aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2019-11-22 13:26:53 -0500
committerXavier Claessens <xclaesse@gmail.com>2019-11-25 20:34:37 -0500
commit7dd302773dd2d6443ab52d608d1c86aef578f280 (patch)
treedd4d9b9ab16ab831265b93a4e0b691fdbdb397e2 /mesonbuild/build.py
parentf0565e6dc80c857b6035b9a754b0495137db64ae (diff)
downloadmeson-7dd302773dd2d6443ab52d608d1c86aef578f280.zip
meson-7dd302773dd2d6443ab52d608d1c86aef578f280.tar.gz
meson-7dd302773dd2d6443ab52d608d1c86aef578f280.tar.bz2
Fix link_whole with a custom target
t.pic won't be defined. We can only hope it has been built with -fPIC. Linker will complain otherwise any way. t.extract_all_objects_recurse() won't be defined. We could support this case by extracting the archive somewhere and pick object files.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 6601f01..4201e35 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1096,9 +1096,12 @@ You probably should put it in link_with instead.''')
raise InvalidArguments('Custom target {!r} is not linkable.'.format(t))
if not t.get_filename().endswith('.a'):
raise InvalidArguments('Can only link_whole custom targets that are .a archives.')
+ if isinstance(self, StaticLibrary):
+ # FIXME: We could extract the .a archive to get object files
+ raise InvalidArguments('Cannot link_whole a custom target into a static library')
elif not isinstance(t, StaticLibrary):
raise InvalidArguments('{!r} is not a static library.'.format(t))
- if isinstance(self, SharedLibrary) and not t.pic:
+ elif isinstance(self, SharedLibrary) and not t.pic:
msg = "Can't link non-PIC static library {!r} into shared library {!r}. ".format(t.name, self.name)
msg += "Use the 'pic' option to static_library to build with PIC."
raise InvalidArguments(msg)