[gvfs] Revert "build: Remove gdbus codegen workaround"



commit 7a2ff5035bf6cce3c783224c9df800c4a59a1f8f
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Jan 7 17:44:09 2019 +0100

    Revert "build: Remove gdbus codegen workaround"
    
    This reverts commit 32bde011b2522d302d72506884866bd809ef5bda.

 codegen.py           | 28 ++++++++++++++++++++++++++++
 common/meson.build   | 16 ++++++++++------
 meson.build          |  6 ++++++
 metadata/meson.build | 16 ++++++++++------
 4 files changed, 54 insertions(+), 12 deletions(-)
---
diff --git a/codegen.py b/codegen.py
new file mode 100755
index 00000000..9bc379ce
--- /dev/null
+++ b/codegen.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+'''
+FIXME
+
+This script is used only to call gdbus-codegen and simulate the
+generation of the source code and header as different targets.
+
+Both are generated implicitly, so meson is not able to know how
+many files are generated, so it does generate only one opaque
+target that represents the two files.
+
+Please see:
+   https://bugzilla.gnome.org/show_bug.cgi?id=791015
+   https://github.com/mesonbuild/meson/pull/2930
+'''
+
+import subprocess
+import sys
+
+subprocess.call([
+  'gdbus-codegen',
+  '--interface-prefix=' + sys.argv[1],
+  '--generate-c-code=' + sys.argv[2],
+  '--c-namespace=' + sys.argv[3],
+  '--output-directory=' + sys.argv[4],
+  sys.argv[5]
+])
diff --git a/common/meson.build b/common/meson.build
index beef8c26..a718783f 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -14,12 +14,16 @@ sources = files(
   'gvfsutils.c',
 )
 
-dbus_sources = gnome.gdbus_codegen(
-  'gvfsdbus',
-  gvfs_namespace + '.xml',
-  interface_prefix: gvfs_namespace + '.',
-  namespace: 'GVfsDBus',
-  autocleanup: 'objects',
+# FIXME: Ugly workaround that simulates the generation of
+#        two different targets.
+namespace = 'GVfsDBus'
+name = namespace.to_lower()
+
+dbus_sources = custom_target(
+  name,
+  input: gvfs_namespace + '.xml',
+  output: [name + '.c', name + '.h'],
+  command: [codegen, gvfs_namespace + '.', name, namespace, meson.current_build_dir(), '@INPUT@', 
'@OUTPUT@'],
 )
 
 deps = [
diff --git a/meson.build b/meson.build
index 43e126c0..19e91c3a 100644
--- a/meson.build
+++ b/meson.build
@@ -453,6 +453,12 @@ endif
 enable_devel_utils = get_option('devel_utils')
 enable_installed_tests = get_option('installed_tests')
 
+# FIXME: Opaque target return from gdbus_codegen
+# Please see:
+#   https://bugzilla.gnome.org/show_bug.cgi?id=791015
+#   https://github.com/mesonbuild/meson/pull/2930
+codegen = find_program('codegen.py')
+
 gnome = import('gnome')
 i18n = import('i18n')
 pkg = import('pkgconfig')
diff --git a/metadata/meson.build b/metadata/meson.build
index e51f1564..bbfd09fd 100644
--- a/metadata/meson.build
+++ b/metadata/meson.build
@@ -29,12 +29,16 @@ metadata_service = configure_file(
   install_dir: dbus_session_bus_services_dir,
 )
 
-dbus_sources = gnome.gdbus_codegen(
-  'metadata-dbus',
-  'dbus-interface.xml',
-  interface_prefix: gvfs_namespace + '.',
-  namespace: 'GVfs',
-  autocleanup: 'objects',
+# FIXME: Ugly workaround that simulates the generation of
+#        two different targets.
+namespace = 'GVfs'
+name = 'metadata-dbus'
+
+dbus_sources = custom_target(
+  name,
+  input: 'dbus-interface.xml',
+  output: [name + '.c', name + '.h'],
+  command: [codegen, gvfs_namespace + '.', name, namespace, meson.current_build_dir(), '@INPUT@', 
'@OUTPUT@'],
 )
 
 sources = files(


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