[rygel/wip/meson: 10/12] meson: Fix dependency issues for GIR generation



commit 14e7ee35f97b3b8d0395d92abee65ab667e56461
Author: Jens Georg <mail jensge org>
Date:   Sun Sep 9 14:19:35 2018 +0200

    meson: Fix dependency issues for GIR generation

 src/librygel-core/meson.build         | 33 ++++++++++++++++++++++-----------
 src/librygel-renderer-gst/meson.build | 33 +++++++++++++++++----------------
 src/librygel-renderer/meson.build     | 33 ++++++++++++++++++---------------
 src/librygel-server/meson.build       | 30 ++++++++++++++++--------------
 4 files changed, 73 insertions(+), 56 deletions(-)
---
diff --git a/src/librygel-core/meson.build b/src/librygel-core/meson.build
index 4b61c2e7..6f471932 100644
--- a/src/librygel-core/meson.build
+++ b/src/librygel-core/meson.build
@@ -35,6 +35,9 @@ build_config = declare_dependency(include_directories : config_include,
                                   sources : 'rygel-build-config.vapi')
 
 
+# Rygel GIR generation is a tad special. We need to hammer in custom namespaces
+# since the libraries used to be in one binary. So
+# Step one: Build the library, generate the GIR from vala but do not install it
 core_lib = library('rygel-core-2.6', core_sources,
         dependencies : core_deps,
         include_directories: [config_include, include_directories('.')],
@@ -46,24 +49,32 @@ core_lib = library('rygel-core-2.6', core_sources,
         install_dir : [true, rygel_includedir, true, false])
 install_data('rygel-core-2.6.deps', install_dir : rygel_vapidir)
 
-custom_target('RygelCore-2.6.typelib',
-               command: [g_ir_compiler, '--output', '@OUTPUT@', '@INPUT@'],
-               output: 'RygelCore-2.6.typelib',
-               input: 'RygelCore-2.6.gir',
-               depends: core_lib,
-               install: true,
-               install_dir: typelib_dir)
-
-custom_target('RygelCore-2.6.gir',
+# Step two: Do the namespace magic with sed
+# We cannot use input: here since the generated ninja build file does not seem
+# to know that Rygel-2.6.gir is a result of building rygel-core-2.6 target
+# The custom_target call depends on the core_lib to make sure it is build before
+# and the name of the generated GIR is passed directly to sed as part of the
+# commandline
+core_gir = custom_target('RygelCore-2.6.gir',
               command: [sed, '-e', 's,Rygel[.],RygelCore.,g',
                         '-e', 's,namespace name="Rygel",namespace name="RygelCore",g',
-                        '@INPUT@'],
-              input: 'Rygel-2.6.gir',
+                        join_paths(meson.current_build_dir(), 'Rygel-2.6.gir')],
+              depends: core_lib,
               output: 'RygelCore-2.6.gir',
               capture: true,
               install: true,
               install_dir: gir_dir)
 
+# Step three: Compile the typelib. The dependency issue is similar to step two,
+# so we depend on the custom_target from that step and pass the input through
+# commandline.
+custom_target('RygelCore-2.6.typelib',
+               command: [g_ir_compiler, '--output', '@OUTPUT@', join_paths(meson.current_build_dir(), 
'RygelCore-2.6.gir')],
+               output: 'RygelCore-2.6.typelib',
+               depends: core_gir,
+               install: true,
+               install_dir: typelib_dir)
+
 # need to add to get the current build dir as include dir
 rygel_core = declare_dependency(include_directories: include_directories('.'),
                                 dependencies: core_deps,
diff --git a/src/librygel-renderer-gst/meson.build b/src/librygel-renderer-gst/meson.build
index 88e5b708..bdcf8187 100644
--- a/src/librygel-renderer-gst/meson.build
+++ b/src/librygel-renderer-gst/meson.build
@@ -13,31 +13,32 @@ renderer_gst_lib = library('rygel-renderer-gst-2.6', renderer_gst_sources,
         install_dir : [true, rygel_includedir, true, false])
 install_data('rygel-renderer-gst-2.6.deps', install_dir : rygel_vapidir)
 
-custom_target('RygelRendererGst-2.6.typelib',
-               command: [g_ir_compiler,
-                        '--output', '@OUTPUT@',
-                        '--includedir', core_girdir,
-                        '--includedir', renderer_girdir,
-                        '@INPUT@'],
-               output: 'RygelRendererGst-2.6.typelib',
-               input: 'RygelRendererGst-2.6.gir',
-               depends: [renderer_gst_lib, renderer_lib],
-               install: true,
-               install_dir: typelib_dir)
-
-custom_target('RygelRendererGst-2.6.gir',
+# For details on the GIR/typelib generating process, see
+# librygel-core/meson.build
+renderer_gst_gir = custom_target('RygelRendererGst-2.6.gir',
               command: [sed, '-e', 's,Rygel[.],RygelRendererGst.,g',
                              '-e', 's,RygelRendererGst[.]MediaRenderer,RygelRenderer.MediaRenderer,g',
                              '-e', 's,RygelRendererGst[.]MediaPlayer,RygelRenderer.MediaPlayer,g',
                              '-e', 's,namespace name="Rygel",namespace name="RygelRendererGst",g',
                              '-e', 's,RygelRendererGst[.]Plugin,RygelCore.Plugin,g',
                              '-e', 's,<package name="rygel-renderer-gst-2.6"/>,<include name="RygelCore" 
version="2.6"/><include name="RygelRenderer" version="2.6"/><package name="rygel-renderer-gst-2.6"/>,',
-                        '@INPUT@'],
-              input: 'Rygel-2.6.gir',
+                        join_paths(meson.current_build_dir(), 'Rygel-2.6.gir')],
               output: 'RygelRendererGst-2.6.gir',
+              depends: renderer_gst_lib,
               capture: true,
               install: true,
-              install_dir: join_paths(get_option('datadir'),'gir-1.0'))
+              install_dir: gir_dir)
+
+custom_target('RygelRendererGst-2.6.typelib',
+               command: [g_ir_compiler,
+                        '--output', '@OUTPUT@',
+                        '--includedir', core_girdir,
+                        '--includedir', renderer_girdir,
+                        join_paths(meson.current_build_dir(), 'RygelRendererGst-2.6.gir')],
+               output: 'RygelRendererGst-2.6.typelib',
+               depends: [renderer_gst_lib, renderer_lib, renderer_gst_gir],
+               install: true,
+               install_dir: typelib_dir)
 
 rygel_renderer_gst = declare_dependency(include_directories : include_directories('.'),
                                         dependencies : renderer_gst_deps,
diff --git a/src/librygel-renderer/meson.build b/src/librygel-renderer/meson.build
index 1d8997c6..94948977 100644
--- a/src/librygel-renderer/meson.build
+++ b/src/librygel-renderer/meson.build
@@ -21,29 +21,32 @@ renderer_lib = library('rygel-renderer-2.6', renderer_sources,
         install_dir : [true, rygel_includedir, true, false])
 install_data('rygel-renderer-2.6.deps', install_dir : rygel_vapidir)
 
-custom_target('RygelRenderer-2.6.typelib',
-               command: [g_ir_compiler,
-                        '--output', '@OUTPUT@',
-                        '--includedir', core_girdir,
-                        '@INPUT@'],
-               output: 'RygelRenderer-2.6.typelib',
-               input: 'RygelRenderer-2.6.gir',
-               depends: renderer_lib,
-               install: true,
-               install_dir: typelib_dir)
-
-custom_target('RygelRenderer-2.6.gir',
+# For details on the GIR / typelib generation process, see
+# librygel-core/meson.build
+renderer_gir = custom_target('RygelRenderer-2.6.gir',
               command: [sed, '-e', 's,Rygel[.],RygelRenderer.,g',
                                           '-e', 's,namespace name="Rygel",namespace name="RygelRenderer",g',
                                           '-e', 's,RygelRenderer[.]Plugin,RygelCore.Plugin,g',
                                           '-e', 's,RygelRenderer[.]MediaDevice,RygelCore.MediaDevice,g',
                                           '-e', 's|<package name="rygel-renderer-2.6"/>|<include 
name="RygelCore" version="2.6"/><package name="rygel-renderer-2.6"/>|',
-                        '@INPUT@'],
-              input: 'Rygel-2.6.gir',
+                        join_paths(meson.current_build_dir(), 'Rygel-2.6.gir')],
               output: 'RygelRenderer-2.6.gir',
+              depends: renderer_lib,
               capture: true,
               install: true,
-              install_dir: join_paths(get_option('datadir'),'gir-1.0'))
+              install_dir: gir_dir)
+
+custom_target('RygelRenderer-2.6.typelib',
+               command: [g_ir_compiler,
+                        '--output', '@OUTPUT@',
+                        '--includedir', core_girdir,
+                        join_paths(meson.current_build_dir(), 'RygelRenderer-2.6.gir')],
+               output: 'RygelRenderer-2.6.typelib',
+               depends: renderer_gir,
+               install: true,
+               install_dir: typelib_dir)
+
+
 rygel_renderer = declare_dependency(include_directories : include_directories('.'),
                                     dependencies : renderer_deps,
                                     link_with: renderer_lib)
diff --git a/src/librygel-server/meson.build b/src/librygel-server/meson.build
index aa0b948a..a57ac7c3 100644
--- a/src/librygel-server/meson.build
+++ b/src/librygel-server/meson.build
@@ -99,30 +99,32 @@ server_lib = library('rygel-server-2.6', server_sources,
         install_dir : [true, rygel_includedir, true, false])
 install_data('rygel-server-2.6.deps', install_dir : rygel_vapidir)
 
-custom_target('RygelServer-2.6.typelib',
-               command: [g_ir_compiler,
-                        '--output', '@OUTPUT@',
-                        '--includedir', core_girdir,
-                        '@INPUT@'],
-               output: 'RygelServer-2.6.typelib',
-               input: 'RygelServer-2.6.gir',
-               depends: server_lib,
-               install: true,
-               install_dir: typelib_dir)
 
-custom_target('RygelServer-2.6.gir',
-              command: [sed, '-e', 's,Rygel\.,RygelServer.,g',
+# For details on the GIR/typelib generation process, see
+# librygel-core/meson.build
+server_gir = custom_target('RygelServer-2.6.gir',
+              command: [sed, '-e', 's,Rygel[.],RygelServer.,g',
                                           '-e', 's,namespace name="Rygel",namespace name="RygelServer",g',
                                           '-e', 's,RygelServer[.]Plugin,RygelCore.Plugin,g',
                                           '-e', 's,RygelServer[.]MediaDevice,RygelCore.MediaDevice,g',
                                           '-e', 's|<package name="rygel-server-2.6"/>|<include 
name="RygelCore" version="2.6"/><package name="rygel-server-2.6"/>|',
-                        '@INPUT@'],
-              input: 'Rygel-2.6.gir',
+                        join_paths(meson.current_build_dir(), 'Rygel-2.6.gir')],
               output: 'RygelServer-2.6.gir',
               capture: true,
+              depends: server_lib,
               install: true,
               install_dir: join_paths(get_option('datadir'),'gir-1.0'))
 
+custom_target('RygelServer-2.6.typelib',
+               command: [g_ir_compiler,
+                        '--output', '@OUTPUT@',
+                        '--includedir', core_girdir,
+                        join_paths(meson.current_build_dir(), 'RygelServer-2.6.gir')],
+               output: 'RygelServer-2.6.typelib',
+               depends: server_gir,
+               install: true,
+               install_dir: typelib_dir)
+
 # need to add to get the current build dir as include dir
 rygel_server = declare_dependency(include_directories: include_directories('.'),
                                   dependencies : server_deps,


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