Commit cf2be53b authored by Alessandro Decina's avatar Alessandro Decina Committed by Tim-Philipp Müller

meson: use gnome.mkenums_simple() to generate controller enumtypes

parent 58a2b5ab
......@@ -37,7 +37,6 @@ EXTRA_DIST = \
scripts/gst-uninstalled \
$(shell find "$(top_srcdir)" -type f -name meson.build ! -path "$(top_srcdir)/gstreamer-*" ) \
gst/gstenumtypes.c.template gst/gstenumtypes.h.template \
libs/gst/controller/controller_mkenum.py \
meson_options.txt \
gst/parse/gen_lex.py.in gst/parse/gen_grammar.py.in \
$(win32)
......
#!/usr/bin/env python3
# This is in its own file rather than inside meson.build
# because a) mixing the two is ugly and b) trying to
# make special characters such as \n go through all
# backends is a fool's errand.
import sys, os, shutil, subprocess
h_array = ['--fhead',
"#ifndef __GST_CONTROLLER_ENUM_TYPES_H__\n#define __GST_CONTROLLER_ENUM_TYPES_H__\n\n#include <glib-object.h>\n#include <gst/gstconfig.h>\n#include <gst/controller/controller-prelude.h>\n\nG_BEGIN_DECLS\n",
'--fprod',
"\n/* enumerations from \"@filename@\" */\n",
'--vhead',
'GST_CONTROLLER_API\nGType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n',
'--ftail',
'G_END_DECLS\n\n#endif /* __GST_CONTROLLER_ENUM_TYPES_H__ */',
]
c_array = ['--fhead',
"#include \"controller-enumtypes.h\"\n\n#include \"controller.h\" \n#include \"gstinterpolationcontrolsource.h\" \n#include \"gstlfocontrolsource.h\"",
'--fprod',
"\n/* enumerations from \"@filename@\" */",
'--vhead',
"GType\n@enum_name@_get_type (void)\n{\n static volatile gsize g_define_type_id__volatile = 0;\n if (g_once_init_enter (&g_define_type_id__volatile)) {\n static const G@Type@Value values[] = {",
'--vprod',
" { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" },",
'--vtail',
" { 0, NULL, NULL }\n };\n GType g_define_type_id = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n }\n return g_define_type_id__volatile;\n}\n",
]
cmd = []
argn = 1
# Find the full command needed to run glib-mkenums
# On UNIX-like, this is just the full path to glib-mkenums
# On Windows, this is the full path to interpreter + full path to glib-mkenums
for arg in sys.argv[1:]:
cmd.append(arg)
argn += 1
if arg.endswith('glib-mkenums'):
break
ofilename = sys.argv[argn]
headers = sys.argv[argn + 1:]
if ofilename.endswith('.h'):
arg_array = h_array
else:
arg_array = c_array
cmd_array = cmd + arg_array + headers
pc = subprocess.Popen(cmd_array, stdout=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:
sys.exit(pc.returncode)
open(ofilename, 'wb').write(stdo)
......@@ -26,19 +26,14 @@ gst_controller_headers = controller_mkenum_headers + [
]
install_headers(gst_controller_headers, subdir : 'gstreamer-1.0/gst/controller/')
mkenums = find_program('controller_mkenum.py')
gstcontroller_h = custom_target('gstcontrollerenum_h',
output : 'controller-enumtypes.h',
input : controller_mkenum_headers,
install : true,
install_dir : 'include/gstreamer-1.0/gst/controller/',
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
gstcontroller_c = custom_target('gstcontrollerenum_c',
output : 'controller-enumtypes.c',
input : controller_mkenum_headers,
depends : [gstcontroller_h],
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
controller_enums = gnome.mkenums_simple('controller-enumtypes',
sources : controller_mkenum_headers,
header_prefix : '#include <gst/controller/controller-prelude.h>',
decorator : 'GST_CONTROLLER_API',
install_header : true,
install_dir : 'include/gstreamer-1.0/gst/controller/')
gstcontroller_c = controller_enums[0]
gstcontroller_h = controller_enums[1]
if libtype != 'shared'
gst_controller_static = static_library('gstcontroller-@0@'.format(apiversion),
......
......@@ -417,9 +417,6 @@ gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' +
'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
'gst_init(NULL,NULL);' ]
# Used by the *_mkenum.py helper scripts
glib_mkenums = find_program('glib-mkenums')
gst_c_args = ['-DHAVE_CONFIG_H']
if libtype == 'static'
gst_c_args += ['-DGST_STATIC_COMPILATION']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment