diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-11-27 15:44:04 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2021-01-04 14:26:45 +0300 |
commit | fdc3ea68e8276ca9eaac077997d5d2e975af58ad (patch) | |
tree | 739332ede93b6014aa926ac783b4c2a605b06280 /ci | |
parent | 9167e5e5616dd1dfe0dc59aa01d7238ebb44c053 (diff) |
ci: test linking on all static plugins
Will ensure that our static libraries and pkg-config files are properly
generated.
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/generate-static-test.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/ci/generate-static-test.py b/ci/generate-static-test.py new file mode 100755 index 000000000..b4c75d8ed --- /dev/null +++ b/ci/generate-static-test.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +# Generate a meson project statically linking on all plugins + +import sys +import os + +from utils import iterate_plugins + +# the csound version used on ci does not ship a .pc file +IGNORE = ['csound'] + +outdir = sys.argv[1] + +plugins = list(filter(lambda p: p not in IGNORE, iterate_plugins())) +deps = list( + map(lambda p: " dependency('gst{}', static: true)".format(p), plugins)) +deps = ',\n'.join(deps) + +meson = """ +project('test-gst-plugins-rs-static', 'c') + +gst_deps = [ + dependency('gstreamer-1.0'), +%s +] + +executable('test-gst-static', ['main.c'], + dependencies: gst_deps, +) +""" % (deps) + +declare = list( + map(lambda p: "GST_PLUGIN_STATIC_DECLARE({});".format(p), plugins)) +declare = '\n'.join(declare) + +register = list( + map(lambda p: "\tGST_PLUGIN_STATIC_REGISTER({});".format(p), plugins)) +register = '\n'.join(register) + +check = list( + map(lambda p: "\tg_assert (gst_registry_find_plugin(registry, \"{}\"));".format(p), plugins)) +check = '\n'.join(check) + +main = """ +#include <gst/gst.h> + +%s + +int main(int argc, char **argv) +{ + g_autoptr(GstRegistry) registry = NULL; + + gst_init(&argc, &argv); + +%s + + registry = gst_registry_get(); + +%s + + return 0; +} +""" % (declare, register, check) + +os.makedirs(outdir) + +meson_file = open(os.path.join(outdir, 'meson.build'), 'w') +meson_file.write(meson) + +main_file = open(os.path.join(outdir, 'main.c'), 'w') +main_file.write(main) |