diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2019-09-28 17:24:46 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2019-10-01 13:06:45 -0400 |
commit | dd5a0df3ecde0383f667909e6db473b326804c00 (patch) | |
tree | fa15da005182dc4e93109c26bc8ea765d0a76d34 | |
parent | a3153747b97512b57309e493b8b6545994d0a106 (diff) | |
download | meson-dd5a0df3ecde0383f667909e6db473b326804c00.zip meson-dd5a0df3ecde0383f667909e6db473b326804c00.tar.gz meson-dd5a0df3ecde0383f667909e6db473b326804c00.tar.bz2 |
Recursively include all objects from uninstalled static libraries
-rw-r--r-- | mesonbuild/build.py | 9 | ||||
-rw-r--r-- | test cases/unit/69 static link/lib/func14.c | 4 | ||||
-rw-r--r-- | test cases/unit/69 static link/lib/func15.c | 6 | ||||
-rw-r--r-- | test cases/unit/69 static link/lib/func16.c | 6 | ||||
-rw-r--r-- | test cases/unit/69 static link/lib/meson.build | 10 | ||||
-rw-r--r-- | test cases/unit/69 static link/meson.build | 4 | ||||
-rw-r--r-- | test cases/unit/69 static link/test5.c | 6 |
7 files changed, 44 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 96bacaa..4ec742d 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1110,9 +1110,16 @@ You probably should put it in link_with instead.''') if isinstance(self, StaticLibrary): # When we're a static library and we link_whole: to another static # library, we need to add that target's objects to ourselves. - self.objects.append(t.extract_all_objects()) + self.objects += t.extract_all_objects_recurse() self.link_whole_targets.append(t) + def extract_all_objects_recurse(self): + objs = [self.extract_all_objects()] + for t in self.link_targets: + if t.is_internal(): + objs += t.extract_all_objects_recurse() + return objs + def add_pch(self, language, pchlist): if not pchlist: return diff --git a/test cases/unit/69 static link/lib/func14.c b/test cases/unit/69 static link/lib/func14.c new file mode 100644 index 0000000..0277319 --- /dev/null +++ b/test cases/unit/69 static link/lib/func14.c @@ -0,0 +1,4 @@ +int func14() +{ + return 1; +} diff --git a/test cases/unit/69 static link/lib/func15.c b/test cases/unit/69 static link/lib/func15.c new file mode 100644 index 0000000..78303cc --- /dev/null +++ b/test cases/unit/69 static link/lib/func15.c @@ -0,0 +1,6 @@ +int func14(); + +int func15() +{ + return func14() + 1; +} diff --git a/test cases/unit/69 static link/lib/func16.c b/test cases/unit/69 static link/lib/func16.c new file mode 100644 index 0000000..379b682 --- /dev/null +++ b/test cases/unit/69 static link/lib/func16.c @@ -0,0 +1,6 @@ +int func15(); + +int func16() +{ + return func15() + 1; +} diff --git a/test cases/unit/69 static link/lib/meson.build b/test cases/unit/69 static link/lib/meson.build index 85e1880..5f04aab 100644 --- a/test cases/unit/69 static link/lib/meson.build +++ b/test cases/unit/69 static link/lib/meson.build @@ -56,3 +56,13 @@ libfunc12 = static_library('func12', 'func12.c', link_with : [libfunc10, libfunc11], install : false) libfunc13 = shared_library('func13', link_whole : libfunc12) + +# libfunc16 should contain func14(), func15() and func16() +libfunc14 = static_library('func14', 'func14.c', + install : false) +libfunc15 = static_library('func15', 'func15.c', + link_with : libfunc14, + install : false) +libfunc16 = static_library('func16', 'func16.c', + link_with : libfunc15, + install : true) diff --git a/test cases/unit/69 static link/meson.build b/test cases/unit/69 static link/meson.build index 8ebcf5e..dac17f8 100644 --- a/test cases/unit/69 static link/meson.build +++ b/test cases/unit/69 static link/meson.build @@ -26,3 +26,7 @@ test('test4-linkwhole', executable('test4-linkwhole', 'test4.c', func9_linkwith_dep = cc.find_library('func9_linkwith') test('test4-linkwith', executable('test4-linkwith', 'test4.c', dependencies : [func7_dep, func9_linkwith_dep])) + +# Verify that installed libfunc16.a is usable +libfunc16_dep = cc.find_library('func16') +test('test5', executable('test5', 'test5.c', dependencies: libfunc16_dep)) diff --git a/test cases/unit/69 static link/test5.c b/test cases/unit/69 static link/test5.c new file mode 100644 index 0000000..6020f0e --- /dev/null +++ b/test cases/unit/69 static link/test5.c @@ -0,0 +1,6 @@ +int func16(); + +int main(int argc, char *argv[]) +{ + return func16() == 3 ? 0 : 1; +} |