[totem/wip/inigomartinez/meson-improve: 8/14] build: Improve backend build



commit 8ec9ba3a09205cca8c7168c744431092c414117d
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Feb 16 23:12:35 2018 +0100

    build: Improve backend build
    
    The backend build is creating different variables that are used only
    once, so the common variables can be reused.
    
    The `libbaconvideowidget` dependency also needs to reference the
    created enum header and the `clutter-gtk` library so they both have
    been added.
    
    The compiler flags and dependencies of `bvw-test` have also been
    revised.

 meson.build             |    1 +
 src/backend/meson.build |  117 ++++++++++++++++++++--------------------------
 src/meson.build         |    3 +-
 3 files changed, 54 insertions(+), 67 deletions(-)
---
diff --git a/meson.build b/meson.build
index 21882fa..505f83f 100644
--- a/meson.build
+++ b/meson.build
@@ -120,6 +120,7 @@ grilo_req_version = '>= 0.3.0'
 peas_req_version = '>= 1.1.0'
 totem_plparser_req_version = '>= 3.10.1'
 
+clutter_gst_dep = dependency('clutter-gst-3.0', version: '>= 2.99.2')
 gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0')
 glib_dep =  dependency('glib-2.0', version: glib_req_version)
 gobject_dep =  dependency('gobject-2.0', version: glib_req_version)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index c7850f0..35c0b41 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -1,35 +1,27 @@
 backend_inc = include_directories('.')
 
+gst_inspect_name = 'gst-inspect-1.0'
+
 gst_inspect = find_program(
-  'gst-inspect-1.0',
-  join_paths(gst_dep.get_pkgconfig_variable('toolsdir'), 'gst-inspect-1.0'),
+  gst_inspect_name,
+  join_paths(gst_dep.get_pkgconfig_variable('toolsdir'), gst_inspect_name),
   required: false
 )
 
 assert(gst_inspect.found(),
-       'Cannot find required GStreamer-1.0 tool "gst-inspect-1.0". It should be part of gstreamer-1_0-utils. 
Please install it.')
-
-gst_base_plugins = [
-  'playbin',
-  'videoscale'
-]
-
-foreach plugin: gst_base_plugins
-  r = run_command(gst_inspect, plugin)
-  assert(r.returncode() == 0,
-         'Cannot find required GStreamer-1.0 plugin "' + plugin + '". It should be part of gst-plugins-base. 
Please install it.')
-endforeach
-
-gst_good_plugins = [
-  'autoaudiosink',
-  'goom',
-  'scaletempo'
+       'Cannot find required GStreamer-1.0 tool "@0@". It should be part of gstreamer-1_0-utils. Please 
install it.'.format(gst_inspect_name))
+
+gst_plugins = [
+  ['playbin', 'base'],
+  ['videoscale', 'base'],
+  ['autoaudiosink', 'good'],
+  ['goom', 'good'],
+  ['scaletempo', 'good']
 ]
 
-foreach plugin: gst_good_plugins
-  r = run_command(gst_inspect, plugin)
-  assert(r.returncode() == 0,
-         'Cannot find required GStreamer-1.0 plugin "' + plugin + '". It should be part of gst-plugins-good. 
Please install it.')
+foreach plugin: gst_plugins
+  assert(run_command(gst_inspect, plugin[0]).returncode() == 0,
+         'Cannot find required GStreamer-1.0 plugin "@0@". It should be part of gst-plugins-@1@. Please 
install it.'.format(plugin[0], plugin[1]))
 endforeach
 
 sources = files(
@@ -42,23 +34,13 @@ sources = files(
   'totem-aspect-frame.c'
 )
 
-enums = 'bacon-video-widget-enums'
-enums_header = files('bacon-video-widget.h')
+enum = 'bacon-video-widget-enums'
+enum_headers = files('bacon-video-widget.h')
 
-libbacon_gen_sources = []
-
-libbacon_gen_sources += gnome.mkenums(
-  enums + '.h',
-  sources: enums_header,
-  fhead: '#ifndef BVW_ENUMS_H\n#define BVW_ENUMS_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n',
-  fprod: '/* enumerations from "@filename@" */\n',
-  vhead: 'GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define BVW_TYPE_@ENUMSHORT@ 
(@enum_name@_get_type())\n',
-  ftail: 'G_END_DECLS\n\n#endif /* !BVW_ENUMS_H */'
-)
-
-libbacon_gen_sources += gnome.mkenums(
-  enums + '.c',
-  sources: enums_header,
+enum_sources = []
+enum_sources += gnome.mkenums(
+  enum + '.c',
+  sources: enum_headers,
   fhead: '#include "bacon-video-widget.h"\n#include "bacon-video-widget-enums.h"',
   fprod: '\n/* enumerations from "@filename@" */',
   vhead: 'GType\n@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static 
const G@Type@Value values[] = {',
@@ -66,56 +48,59 @@ libbacon_gen_sources += gnome.mkenums(
   vtail: '      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static ("@EnumName@", values);\n  
}\n  return etype;\n}\n'
 )
 
-libbacon_video_widget_deps = [
-  gst_dep,
-  dependency('gstreamer-base-1.0', version: gst_req_version),
-  dependency('gstreamer-plugins-base-1.0', version: gst_req_version),
-  gst_tag_dep,
-  dependency('gstreamer-audio-1.0'),
-  gst_video_dep,
-  dependency('clutter-1.0', version: '>= 1.17.3'),
-  dependency('clutter-gst-3.0', version: '>= 2.99.2'),
+enum_sources += gnome.mkenums(
+  enum + '.h',
+  sources: enum_headers,
+  fhead: '#ifndef BVW_ENUMS_H\n#define BVW_ENUMS_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n',
+  fprod: '/* enumerations from "@filename@" */\n',
+  vhead: 'GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define BVW_TYPE_@ENUMSHORT@ 
(@enum_name@_get_type())\n',
+  ftail: 'G_END_DECLS\n\n#endif /* !BVW_ENUMS_H */'
+)
+
+deps = [
+  clutter_gst_dep,
   clutter_gtk_dep,
-  dependency('cairo', version: '>= 1.14.0'),
-  dependency('gsettings-desktop-schemas'),
+  libtotem_gst_helpers_dep,
   m_dep,
-  libtotem_gst_helpers_dep
+  dependency('gsettings-desktop-schemas'),
+  dependency('gstreamer-audio-1.0')
 ]
 
-libbacon_video_widget_cflags = common_flags + warn_flags + [
-  '-DDATADIR="@0@"'.format(totem_pkgdatadir)
-]
+cflags = warn_flags + ['-DDATADIR="@0@"'.format(totem_pkgdatadir)]
 
 if enable_easy_codec_installation
-  libbacon_video_widget_deps += gst_pbutils_dep
+  deps += gst_pbutils_dep
 endif
 
 libbacon_video_widget = static_library(
   'baconvideowidget',
-  sources: sources + libbacon_gen_sources,
+  sources: sources + enum_sources,
   include_directories: top_inc,
-  dependencies: libbacon_video_widget_deps,
-  c_args: libbacon_video_widget_cflags
+  dependencies: deps,
+  c_args: cflags
 )
 
 libbacon_video_widget_dep = declare_dependency(
-  link_with: libbacon_video_widget,
+  sources: enum_sources[1],
   include_directories: backend_inc,
-  dependencies: libbacon_video_widget_deps,
-  sources: libbacon_gen_sources
+  dependencies: clutter_gtk_dep,
+  link_with: libbacon_video_widget
 )
 
 if enable_easy_codec_installation
   backend_test = 'bvw-test'
 
+  cflags = warn_flags + [
+    '-DG_LOG_DOMAIN="@0@"'.format(backend_test),
+    '-DLOGO_PATH="@0@"'.format(join_paths(totem_pkgdatadir, meson.project_name(), 'totem_logo.png'))
+  ]
+
   executable(
     backend_test,
     backend_test + '.c',
     include_directories: top_inc,
-    dependencies: libbacon_video_widget_dep,
-    c_args: libbacon_video_widget_cflags + [
-      '-DLOGO_PATH="@0@"'.format(join_paths(totem_pkgdatadir, meson.project_name(), 'totem_logo.png')),
-      '-DG_LOG_DOMAIN="@0@"'.format(backend_test)
-    ]
+    dependencies: clutter_gtk_dep,
+    c_args: cflags,
+    link_with: libbacon_video_widget
   )
 endif
diff --git a/src/meson.build b/src/meson.build
index c6e2445..9762f2c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -53,9 +53,10 @@ totem_common_incs = [
   plugins_inc
 ]
 
-totem_common_deps = libbacon_video_widget_deps + [
+totem_common_deps = [
   glib_dep,
   gio_dep,
+  gst_tag_dep,
   gtk_dep,
   gdk_x11_dep,
   dependency('gmodule-2.0'),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]