Meson: Stop depending on libtool to make android static link
Submitted by Xavier Claessens
Link to original bug (#794770)
Description
When building GStreamer with meson it won't generate .la files. So we can rely only on .pc files to make static builds. As part of bug 794568, we are going to generate a .pc file for each plugin, but that's just one step.
Currently ndk-build/gstreamer-1.0.mk builds a shared library that static link all gstreamer plugins and their dependencies. To find dependencies it calls libtool-link function from tools.mk which parse .la files.
With pkg-config getting the list of all libraries is easier:
$ pkg-config --libs --static <list of plugins>
But that's going to give too many -lfoo flags, we don't want to static link libs provided by the android NDK (e.g. libc), only those from gstreamer SDK. Currently that distinction is made based on .la files: Android NDK does not have .la files and GStreamer SDK does. So the decision is basically "static link if a .la is found, dynamic otherwise".
I see 2 possibilities:
- Hard-ode a blacklist of libs to not static link; or
- For each -lfoo ask gcc to resolve to the absolute path to the .a and if found, and has as prefix GStreamer's SDK path, replace the -lfoo by the path to .a in the link command. That's what meson will do if this PR is accepted: https://github.com/mesonbuild/meson/pull/2816
Version: 1.12.x