2020-11-27 12:44:04 +00:00
|
|
|
#!/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
|
2022-11-29 16:48:03 +00:00
|
|
|
# threadshare we skip in meson static build as well
|
2021-10-19 06:45:07 +00:00
|
|
|
IGNORE = ['csound', 'threadshare', 'gtk4']
|
2020-11-27 12:44:04 +00:00
|
|
|
|
|
|
|
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)
|