diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2019-09-17 11:52:10 -0400 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.com> | 2020-03-04 08:23:52 -0500 |
commit | 35285c51b8d72f4567abe6599b24b74ea3a548f4 (patch) | |
tree | 1866556956666a597bac41dc266d704a9b9c84b7 /scripts | |
parent | 7cf00627beaa3e0aec12df6e70282bd981c792b3 (diff) | |
download | gstreamer-35285c51b8d72f4567abe6599b24b74ea3a548f4.tar.gz |
Add gstreamer-full library containing all plugins and their deps
When building with -Ddefault_library=static, also build a single library
containing all built plugins. Any external dependencies are still
dynamically linked.
A monolithic library is easier to distribute, and in some envs like
Android is required.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/generate_init_static_plugins.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/generate_init_static_plugins.py b/scripts/generate_init_static_plugins.py new file mode 100644 index 0000000000..d7a13e28ee --- /dev/null +++ b/scripts/generate_init_static_plugins.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +import argparse +import os +from string import Template + +TEMPLATE = Template(''' +#include <gst/gst.h> + +$plugins_declaration + +void +gst_init_static_plugins (void) +{ + $plugins_registration +} +''') + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument(dest="output", help="Output file") + parser.add_argument(dest="plugins", nargs=argparse.REMAINDER, help="The list of plugins") + + options = parser.parse_args() + + names = set() + for plugin in options.plugins: + filename = os.path.basename(plugin) + if filename.startswith('libgst') and filename.endswith('.a'): + names.add(filename[len('libgst'):-len('.a')]) + + registration = ['GST_PLUGIN_STATIC_REGISTER(%s);' % name for name in names] + declaration = ['GST_PLUGIN_STATIC_DECLARE(%s);' % name for name in names] + + with open(options.output, "w") as f: + f.write(TEMPLATE.substitute({ + 'plugins_declaration': '\n'.join(declaration), + 'plugins_registration': '\n '.join(registration), + })) |