meson: libs: use gnome.mkenums_simple() to generate enumtypes files
authorAlessandro Decina <alessandro.d@gmail.com>
Thu, 20 Jul 2017 04:15:30 +0000 (14:15 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 22 Mar 2018 13:15:35 +0000 (13:15 +0000)
This way we no longer need custom wrapper scripts or template files.

16 files changed:
Makefile.am
gst-libs/gst/app/app_mkenum.py [deleted file]
gst-libs/gst/app/meson.build
gst-libs/gst/audio/audio_mkenum.py [deleted file]
gst-libs/gst/audio/meson.build
gst-libs/gst/pbutils/meson.build
gst-libs/gst/pbutils/pbutils_mkenum.py [deleted file]
gst-libs/gst/rtp/meson.build
gst-libs/gst/rtp/rtp_mkenum.py [deleted file]
gst-libs/gst/rtsp/meson.build
gst-libs/gst/rtsp/rtsp_mkenum.py [deleted file]
gst-libs/gst/tag/meson.build
gst-libs/gst/tag/tag_mkenum.py [deleted file]
gst-libs/gst/video/meson.build
gst-libs/gst/video/video_mkenum.py [deleted file]
meson.build

index 020e2e6..c279974 100644 (file)
@@ -33,13 +33,6 @@ EXTRA_DIST = \
        AUTHORS COPYING COPYING.LIB NEWS README RELEASE REQUIREMENTS \
        ChangeLog gst-plugins-base.doap autogen.sh \
        $(shell find "$(top_srcdir)" -type f -name meson.build ! -path "$(top_srcdir)/$(PACKAGE_TARNAME)-*" ) \
-       gst-libs/gst/audio/audio_mkenum.py \
-       gst-libs/gst/app/app_mkenum.py \
-       gst-libs/gst/pbutils/pbutils_mkenum.py \
-       gst-libs/gst/rtp/rtp_mkenum.py \
-       gst-libs/gst/rtsp/rtsp_mkenum.py \
-       gst-libs/gst/tag/tag_mkenum.py \
-       gst-libs/gst/video/video_mkenum.py \
        gst-libs/gst/gl/gstglconfig.h.meson \
        meson_options.txt
 
diff --git a/gst-libs/gst/app/app_mkenum.py b/gst-libs/gst/app/app_mkenum.py
deleted file mode 100755 (executable)
index 4d3123f..0000000
+++ /dev/null
@@ -1,55 +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, shutil, subprocess
-
-h_array = ['--fhead',
-           "#ifndef __GST_APP_ENUM_TYPES_H__\n#define __GST_APP_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/app/app-prelude.h>\nG_BEGIN_DECLS\n",
-           '--fprod',
-           "\n/* enumerations from \"@filename@\" */\n",
-           '--vhead',
-           'GST_APP_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_APP_ENUM_TYPES_H__ */',
-           ]
-
-c_array = ['--fhead',
-           "#include \"app-enumtypes.h\"\n\n#include \"app.h\" \n#include \"gstappsrc.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)
index fd1883b..952e803 100644 (file)
@@ -7,19 +7,15 @@ app_mkenum_headers = [
 app_headers = app_mkenum_headers + [ 'app.h', 'app-prelude.h', 'gstappsink.h' ]
 install_headers(app_headers, subdir : 'gstreamer-1.0/gst/app/')
 
-mkenums = find_program('app_mkenum.py')
-gstapp_h = custom_target('gstappenum_h',
-  output : 'app-enumtypes.h',
-  input : app_mkenum_headers,
-  install : true,
-  install_dir : 'include/gstreamer-1.0/gst/app/',
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+app_enums = gnome.mkenums_simple('app-enumtypes',
+  sources : app_mkenum_headers,
+  header_prefix : '#include <gst/app/app-prelude.h>',
+  decorator : 'GST_APP_API',
+  install_header: true,
+  install_dir : 'include/gstreamer-1.0/gst/app/')
+gstapp_c = app_enums[0]
+gstapp_h = app_enums[1]
 
-gstapp_c = custom_target('gstappenum_c',
-  output : 'app-enumtypes.c',
-  input : app_mkenum_headers,
-  depends : [gstapp_h],
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
 app_gen_sources = [gstapp_h]
 
 gstapp = library('gstapp-@0@'.format(api_version),
diff --git a/gst-libs/gst/audio/audio_mkenum.py b/gst-libs/gst/audio/audio_mkenum.py
deleted file mode 100755 (executable)
index af1b0a0..0000000
+++ /dev/null
@@ -1,55 +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, shutil, subprocess
-
-h_array = ['--fhead',
-           "#ifndef __GST_AUDIO_ENUM_TYPES_H__\n#define __GST_AUDIO_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/audio/audio-prelude.h>\nG_BEGIN_DECLS\n",
-           '--fprod',
-           "\n/* enumerations from \"@filename@\" */\n",
-           '--vhead',
-           'GST_AUDIO_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_AUDIO_ENUM_TYPES_H__ */',
-           ]
-
-c_array = ['--fhead',
-           "#include \"audio-enumtypes.h\"\n\n#include \"audio.h\" \n#include \"audio-format.h\" \n#include \"audio-channels.h\" \n#include \"audio-info.h\" \n#include \"gstaudioringbuffer.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)
index ace64fe..0dbaf7d 100644 (file)
@@ -60,19 +60,15 @@ audio_headers = audio_mkenum_headers + [
 ]
 install_headers(audio_headers, subdir : 'gstreamer-1.0/gst/audio/')
 
-mkenums = find_program('audio_mkenum.py')
-gstaudio_h = custom_target('gstaudioenum_h',
-  output : 'audio-enumtypes.h',
-  input : audio_mkenum_headers,
-  install : true,
-  install_dir : 'include/gstreamer-1.0/gst/audio/',
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+audio_enums = gnome.mkenums_simple('audio-enumtypes',
+  sources : audio_mkenum_headers,
+  header_prefix : '#include <gst/audio/audio-prelude.h>',
+  decorator : 'GST_AUDIO_API',
+  install_header: true,
+  install_dir : 'include/gstreamer-1.0/gst/audio/')
+gstaudio_c = audio_enums[0]
+gstaudio_h = audio_enums[1]
 
-gstaudio_c = custom_target('gstaudioenum_c',
-  output : 'audio-enumtypes.c',
-  input : audio_mkenum_headers,
-  depends : [gstaudio_h],
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
 audio_gen_sources = [gstaudio_h]
 
 gstaudio_deps = [tag_dep, gst_base_dep, libm]
index b56593e..fa44c21 100644 (file)
@@ -38,19 +38,14 @@ install_headers(pbutils_headers, subdir : 'gstreamer-1.0/gst/pbutils/')
 
 pbutils_mkenum_headers = pbutils_headers
 
-mkenums = find_program('pbutils_mkenum.py')
-gstpbutils_h = custom_target('gstpbutilsenum_h',
-  output : 'pbutils-enumtypes.h',
-  input : pbutils_mkenum_headers,
-  install : true,
-  install_dir : 'include/gstreamer-1.0/gst/pbutils/',
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
-
-gstpbutils_c = custom_target('gstpbutilsenum_c',
-  output : 'pbutils-enumtypes.c',
-  input : pbutils_mkenum_headers,
-  depends : [gstaudio_h, gstvideo_h, gstpbutils_h],
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+pbutils_enums = gnome.mkenums_simple('pbutils-enumtypes',
+  sources : pbutils_mkenum_headers,
+  header_prefix : '#include <gst/pbutils/pbutils-prelude.h>',
+  decorator : 'GST_PBUTILS_API',
+  install_header: true,
+  install_dir : 'include/gstreamer-1.0/gst/pbutils/')
+gstpbutils_c = pbutils_enums[0]
+gstpbutils_h = pbutils_enums[1]
 
 gstpbutils_deps = [video_dep, audio_dep, tag_dep]
 pbutils = library('gstpbutils-@0@'.format(api_version),
diff --git a/gst-libs/gst/pbutils/pbutils_mkenum.py b/gst-libs/gst/pbutils/pbutils_mkenum.py
deleted file mode 100755 (executable)
index 143a76c..0000000
+++ /dev/null
@@ -1,55 +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, shutil, subprocess
-
-h_array = ['--fhead',
-           "#ifndef __PB_UTILS_ENUM_TYPES_H__\n#define __PB_UTILS_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/pbutils/pbutils-prelude.h>\nG_BEGIN_DECLS\n",
-           '--fprod',
-           "\n/* enumerations from \"@filename@\" */\n",
-           '--vhead',
-           "GST_PBUTILS_API GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n",
-           '--ftail',
-           "G_END_DECLS\n\n#endif /* __PB_UTILS_ENUM_TYPES_H__ */"
-]
-
-c_array = ['--fhead',
-           "#include \"pbutils-enumtypes.h\"\n\n#include \"pbutils.h\" \n#include \"codec-utils.h\" \n#include \"descriptions.h\" \n#include \"encoding-profile.h\" \n#include \"encoding-target.h\" \n#include \"install-plugins.h\" \n#include \"missing-plugins.h\" \n#include \"gstdiscoverer.h\" \n#include \"gstaudiovisualizer.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)
index ab20bf7..4f95e59 100644 (file)
@@ -22,20 +22,14 @@ rtp_headers = [
 ]
 install_headers(rtp_headers, subdir : 'gstreamer-1.0/gst/rtp/')
 
-mkenums = find_program('rtp_mkenum.py')
-
-gstrtp_enum_h = custom_target('gstrtp_enum_h',
-  output : 'gstrtp-enumtypes.h',
-  input : rtp_headers,
-  install : true,
-  install_dir : 'include/gstreamer-1.0/gst/rtp/',
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
-
-gstrtp_enum_c = custom_target('gstrtp_enum_c',
-  output : 'gstrtp-enumtypes.c',
-  input : rtp_headers,
-  depends : [gstaudio_h, gstrtp_enum_h],
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+rtp_enums = gnome.mkenums_simple('gstrtp-enumtypes',
+  sources : rtp_headers,
+  header_prefix : '#include <gst/rtp/rtp-prelude.h>',
+  decorator : 'GST_RTP_API',
+  install_header: true,
+  install_dir : 'include/gstreamer-1.0/gst/rtp/')
+gstrtp_enum_c = rtp_enums[0]
+gstrtp_enum_h = rtp_enums[1]
 
 gstrtp_deps = [audio_dep, gst_base_dep]
 gst_rtp = library('gstrtp-@0@'.format(api_version),
diff --git a/gst-libs/gst/rtp/rtp_mkenum.py b/gst-libs/gst/rtp/rtp_mkenum.py
deleted file mode 100755 (executable)
index 9840612..0000000
+++ /dev/null
@@ -1,55 +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, shutil, subprocess
-
-h_array = ['--fhead',
-           "#ifndef __GST_RTP_ENUM_TYPES_H__\n#define __GST_RTP_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/rtp/rtp-prelude.h>\nG_BEGIN_DECLS\n",
-           '--fprod',
-           "\n/* enumerations from \"@filename@\" */\n",
-           '--vhead',
-           'GST_RTP_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_RTP_ENUM_TYPES_H__ */',
-           ]
-
-c_array = ['--fhead',
-           '#include "rtp.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)
index 69ba21e..03f88b7 100644 (file)
@@ -22,20 +22,14 @@ rtsp_headers = [
 ]
 install_headers(rtsp_headers, subdir : 'gstreamer-1.0/gst/rtsp/')
 
-mkenums = find_program('rtsp_mkenum.py')
-
-gstrtsp_h = custom_target('gstrtspenum_h',
-  output : 'gstrtsp-enumtypes.h',
-  input : rtsp_headers,
-  install : true,
-  install_dir : 'include/gstreamer-1.0/gst/rtsp/',
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
-
-gstrtsp_c = custom_target('gstrtspenum_c',
-  output : 'gstrtsp-enumtypes.c',
-  input : rtsp_headers,
-  depends : [gstrtsp_h],
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+rtsp_enums = gnome.mkenums_simple('gstrtsp-enumtypes',
+  sources : rtsp_headers,
+  header_prefix : '#include <gst/rtsp/rtsp-prelude.h>',
+  decorator : 'GST_RTSP_API',
+  install_header: true,
+  install_dir : 'include/gstreamer-1.0/gst/rtsp/')
+gstrtsp_c = rtsp_enums[0]
+gstrtsp_h = rtsp_enums[1]
 
 winsock2 = cc.find_library('ws2_32', required : false)
 
diff --git a/gst-libs/gst/rtsp/rtsp_mkenum.py b/gst-libs/gst/rtsp/rtsp_mkenum.py
deleted file mode 100755 (executable)
index 71ffecc..0000000
+++ /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, shutil, subprocess
-
-h_array = [
-    '--fhead',
-    "#ifndef __gst_rtsp_ENUM_TYPES_H__\n#define __gst_rtsp_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/rtsp/rtsp-prelude.h>\nG_BEGIN_DECLS\n",
-    '--fprod',
-    "\n/* enumerations from \"@filename@\" */\n",
-    '--vhead',
-    "GST_RTSP_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_rtsp_ENUM_TYPES_H__ */"
-]
-
-c_array = ['--fhead',
-           "#include \"gstrtsp-enumtypes.h\"\n\n#include \"rtsp.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)
index 53c928d..fe29466 100644 (file)
@@ -26,19 +26,14 @@ tag_headers = tag_mkenum_headers + [
 ]
 install_headers(tag_headers, subdir : 'gstreamer-1.0/gst/tag/')
 
-mkenums = find_program('tag_mkenum.py')
-gsttag_h = custom_target('gsttagenum_h',
-  output : 'tag-enumtypes.h',
-  input : tag_mkenum_headers,
-  install : true,
-  install_dir : 'include/gstreamer-1.0/gst/tag/',
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
-
-gsttag_c = custom_target('gsttagenum_c',
-  output : 'tag-enumtypes.c',
-  input : tag_mkenum_headers,
-  depends : [gsttag_h],
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+tag_enums = gnome.mkenums_simple('tag-enumtypes',
+  sources : tag_mkenum_headers,
+  header_prefix : '#include <gst/tag/tag-prelude.h>',
+  decorator : 'GST_TAG_API',
+  install_header: true,
+  install_dir : 'include/gstreamer-1.0/gst/tag/')
+gsttag_c = tag_enums[0]
+gsttag_h = tag_enums[1]
 tag_gen_sources = [gsttag_h]
 
 tag_deps = [gst_base_dep, libm]
diff --git a/gst-libs/gst/tag/tag_mkenum.py b/gst-libs/gst/tag/tag_mkenum.py
deleted file mode 100755 (executable)
index fb57cd1..0000000
+++ /dev/null
@@ -1,55 +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, shutil, subprocess
-
-h_array = ['--fhead',
-           "#ifndef __GST_TAG_ENUM_TYPES_H__\n#define __GST_TAG_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/tag/tag-prelude.h>\nG_BEGIN_DECLS\n",
-           '--fprod',
-           "\n/* enumerations from \"@filename@\" */\n",
-           '--vhead',
-           'GST_TAG_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_TAG_ENUM_TYPES_H__ */',
-           ]
-
-c_array = ['--fhead',
-           "#include \"tag-enumtypes.h\"\n\n#include \"tag.h\" \n#include \"gsttagdemux.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)
index 0c44d9a..ae745ed 100644 (file)
@@ -84,19 +84,14 @@ video_mkenum_headers = [
   'navigation.h',
 ]
 
-mkenums = find_program('video_mkenum.py')
-gstvideo_h = custom_target('gstvideoenum_h',
-  output : 'video-enumtypes.h',
-  input : video_mkenum_headers,
-  install : true,
-  install_dir : 'include/gstreamer-1.0/gst/video/',
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
-
-gstvideo_c = custom_target('gstvideoenum_c',
-  output : 'video-enumtypes.c',
-  input : video_mkenum_headers,
-  depends : [gstvideo_h],
-  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+video_enums = gnome.mkenums_simple('video-enumtypes',
+  sources : video_mkenum_headers,
+  header_prefix : '#include <gst/video/video-prelude.h>',
+  decorator : 'GST_VIDEO_API',
+  install_header: true,
+  install_dir : 'include/gstreamer-1.0/gst/video/')
+gstvideo_c = video_enums[0]
+gstvideo_h = video_enums[1]
 video_gen_sources = [gstvideo_h]
 
 orcsrc = 'video-orc'
diff --git a/gst-libs/gst/video/video_mkenum.py b/gst-libs/gst/video/video_mkenum.py
deleted file mode 100755 (executable)
index abf376b..0000000
+++ /dev/null
@@ -1,55 +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, shutil, subprocess
-
-h_array = ['--fhead',
-           "#ifndef __GST_VIDEO_ENUM_TYPES_H__\n#define __GST_VIDEO_ENUM_TYPES_H__\n\n#include <gst/gst.h>\n#include <gst/video/video-prelude.h>\nG_BEGIN_DECLS\n",
-           '--fprod',
-           "\n/* enumerations from \"@filename@\" */\n",
-           '--vhead',
-           "GST_VIDEO_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_VIDEO_ENUM_TYPES_H__ */"
-]
-
-c_array = ['--fhead',
-           "#include \"video-enumtypes.h\"\n\n#include \"video.h\" \n#include \"video-format.h\" \n#include \"video-color.h\" \n#include \"video-info.h\" \n#include \"colorbalance.h\" \n#include \"navigation.h\" \n#include \"video-chroma.h\" \n#include \"video-tile.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)
index 5c26811..88a488a 100644 (file)
@@ -1,6 +1,6 @@
 project('gst-plugins-base', 'c',
   version : '1.15.0.1',
-  meson_version : '>= 0.36.0',
+  meson_version : '>= 0.42.0',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
 
@@ -239,9 +239,6 @@ endif
 gst_controller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
   fallback : ['gstreamer', 'gst_controller_dep'])
 
-# Used by the *_mkenum.py helper scripts
-glib_mkenums = find_program('glib-mkenums')
-
 have_orcc = false
 orcc_args = []
 if get_option('use_orc') != 'no'