diff options
author | Alessandro Decina <alessandro.d@gmail.com> | 2017-07-20 17:47:55 +1000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2018-03-22 14:34:05 +0000 |
commit | f49134095cf87008f8230201f4da85c53e5f75dd (patch) | |
tree | e22f92c52878578495fe71afb693bc27224155c2 /gst-libs/gst/mpegts | |
parent | 00727d2437d5a893c7c39f7ffcbdf0e790abd2e0 (diff) | |
download | gstreamer-plugins-bad-f49134095cf87008f8230201f4da85c53e5f75dd.tar.gz |
meson: use gnome.mkenums_simple() to generate enumtypes files
Means we no longer need our custom scripts, nor template files.
Diffstat (limited to 'gst-libs/gst/mpegts')
-rw-r--r-- | gst-libs/gst/mpegts/meson.build | 22 | ||||
-rwxr-xr-x | gst-libs/gst/mpegts/mpegts_enum.py | 57 |
2 files changed, 7 insertions, 72 deletions
diff --git a/gst-libs/gst/mpegts/meson.build b/gst-libs/gst/mpegts/meson.build index 2ee420926..e1638bbeb 100644 --- a/gst-libs/gst/mpegts/meson.build +++ b/gst-libs/gst/mpegts/meson.build @@ -18,23 +18,15 @@ mpegts_headers = [ ] install_headers(mpegts_headers, subdir : 'gstreamer-1.0/gst/mpegts') -mkenums = find_program('mpegts_enum.py') - -mpegts_h = custom_target('mpegtsenum_h', - output : 'gstmpegts-enumtypes.h', - input : mpegts_headers, - install : true, - install_dir : 'include/gstreamer-1.0/gst/mpegts', - command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@']) -gen_sources = [mpegts_h] - -mpegts_c = custom_target('mpegtsenum_c', - output : 'gstmpegts-enumtypes.c', - input : mpegts_headers, - command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@']) +mpegts_enums = gnome.mkenums_simple('gstmpegts-enumtypes', + sources : mpegts_headers, + header_prefix : '#include <gst/mpegts/mpegts-prelude.h>', + decorator : 'GST_MPEGTS_API', + install_header: true, + install_dir : 'include/gstreamer-1.0/gst/mpegts/') gstmpegts = library('gstmpegts-' + api_version, - mpegts_sources, mpegts_h, mpegts_c, + mpegts_sources, mpegts_enums, c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], include_directories : [configinc, libsinc], version : libversion, diff --git a/gst-libs/gst/mpegts/mpegts_enum.py b/gst-libs/gst/mpegts/mpegts_enum.py deleted file mode 100755 index 320bb8872..000000000 --- a/gst-libs/gst/mpegts/mpegts_enum.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/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, subprocess - -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:] - -inc = '\n'.join(['#include"%s"' % os.path.basename(i) for i in headers]) - -h_array = ['--fhead', - "#ifndef __GST_MPEGTS_ENUM_TYPES_H__\n#define __GST_MPEGTS_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/mpegts/mpegts-prelude.h>\nG_BEGIN_DECLS\n", - '--fprod', - "\n/* enumerations from \"@filename@\" */\n", - '--vhead', - "GST_MPEGTS_API GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n", - '--ftail', - "G_END_DECLS\n\n#endif /* __GST_MPEGTS_ENUM_TYPES_H__ */"] - -c_array = [ - '--fhead', - "#include \"gstmpegts-enumtypes.h\"\n%s\n#define C_ENUM(v) ((gint) v)\n#define C_FLAGS(v) ((guint) v)\n" % inc, - '--fprod', - "\n/* enumerations from \"@filename@\" */", - '--vhead', - "GType\n@enum_name@_get_type (void)\n{\n static gsize id = 0;\n static const G@Type@Value values[] = {", - '--vprod', - " { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" },", - '--vtail', - " { 0, NULL, NULL }\n };\n\n if (g_once_init_enter (&id)) {\n GType tmp = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&id, tmp);\n }\n\n return (GType) id;\n}" - ] - -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) |