[gnome-online-accounts/wip/jfelder/add-goabackend-introspection] build: Add introspection support for goabackend



commit 820f621f5d76f3cf522f6ed48aa573215df0890a
Author: Jean Felder <jfelder src gnome org>
Date:   Sat Sep 14 16:46:48 2019 +0200

    build: Add introspection support for goabackend
    
    The autotools part is based on a patch by Andrea Azzarone.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792865

 src/goa/meson.build                    |  6 +++-
 src/goabackend/GoaBackend-1.0.metadata |  0
 src/goabackend/Makefile.am             | 62 ++++++++++++++++++++++++++++++++++
 src/goabackend/meson.build             | 25 ++++++++++++++
 4 files changed, 92 insertions(+), 1 deletion(-)
---
diff --git a/src/goa/meson.build b/src/goa/meson.build
index 1d86b7b0..26f168e2 100644
--- a/src/goa/meson.build
+++ b/src/goa/meson.build
@@ -131,8 +131,12 @@ if enable_introspection
     install: true
   )
 
+  libgoa_gir_dep = declare_dependency(
+    sources: libgoa_gir
+  )
+
   if enable_vapi
-    gnome.generate_vapi(
+    libgoa_vapi = gnome.generate_vapi(
       goa_api_name,
       sources: libgoa_gir[0],
       packages: 'gio-2.0',
diff --git a/src/goabackend/GoaBackend-1.0.metadata b/src/goabackend/GoaBackend-1.0.metadata
new file mode 100644
index 00000000..e69de29b
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index 83852378..570624b1 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -1,7 +1,10 @@
+-include $(INTROSPECTION_MAKEFILE)
 
 NULL =
 CLEANFILES =
 EXTRA_DIST =
+INTROSPECTION_GIRS =
+INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/src/goa
 
 AM_CPPFLAGS =                                                  \
        -I$(top_builddir)/src -I$(top_srcdir)/src               \
@@ -216,6 +219,65 @@ pkgconfig_DATA = goa-backend-1.0.pc
 
 # ----------------------------------------------------------------------------------------------------
 
+if HAVE_INTROSPECTION
+introspection_sources =                                        \
+       $(libgoa_backend_1_0_la_HEADERS)                        \
+       goabackendenumtypes.c                                   \
+       goaprovider.c                                           \
+       $(NULL)
+
+GoaBackend-1.0.gir: libgoa-backend-1.0.la
+GoaBackend_1_0_gir_INCLUDES = Gio-2.0 Gtk-3.0
+GoaBackend_1_0_gir_EXPORT_PACKAGES = goa-backend-1.0
+GoaBackend_1_0_gir_LIBS = goa-backend-1.0
+GoaBackend_1_0_gir_FILES = $(introspection_sources)
+GoaBackend_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(libgoa_backend_1_0_la_CFLAGS)
+GoaBackend_1_0_gir_SCANNERFLAGS =                                      \
+       $(WARN_SCANNERFLAGS)                                            \
+       --c-include='goabackend/goabackend.h'                           \
+       --identifier-prefix=Goa                                 \
+       --include-uninstalled=$(top_builddir)/src/goa/Goa-1.0.gir       \
+       $(NULL)
+INTROSPECTION_GIRS += GoaBackend-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = GoaBackend-1.0.gir
+
+typelibsdir = $(libdir)/girepository-1.0
+typelibs_DATA = GoaBackend-1.0.typelib
+
+CLEANFILES += $(gir_DATA) $(typelibs_DATA)
+
+if ENABLE_VAPIGEN
+-include $(VAPIGEN_MAKEFILE)
+
+goabackend-1.0.vapi: GoaBackend-1.0.gir GoaBackend-1.0.metadata goabackend-1.0.deps
+
+VAPIGEN_VAPIS = goabackend-1.0.vapi
+
+goabackend_1_0_vapi_DEPS = gio-2.0 gtk+-3.0
+goabackend_1_0_vapi_GIRDIRS = $(top_builddir)/src/goa
+goabackend_1_0_vapi_METADATADIRS = $(srcdir)
+goabackend_1_0_vapi_FILES = GoaBackend-1.0.gir
+
+goabackend-1.0.deps:
+       $(AM_V_GEN) for pkg in $(goabackend_1_0_vapi_DEPS); do \
+               echo $$pkg >> $@; \
+       done
+
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps)
+
+CLEANFILES += $(vapi_DATA)
+
+EXTRA_DIST += GoaBackend-1.0.metadata
+
+endif # ENABLE_VAPIGEN
+
+endif # HAVE_INTROSPECTION
+
+# ----------------------------------------------------------------------------------------------------
+
 CLEANFILES += \
        $(BUILT_SOURCES) \
        $(enum_built_sources) \
diff --git a/src/goabackend/meson.build b/src/goabackend/meson.build
index 3d9dee8b..2a4eaee3 100644
--- a/src/goabackend/meson.build
+++ b/src/goabackend/meson.build
@@ -147,6 +147,31 @@ pkg.generate(
   variables: 'exec_prefix=${prefix}'
 )
 
+if enable_introspection
+  libgoa_backend_gir = gnome.generate_gir(
+    libgoa_backend,
+    sources: enum_sources + files('goaprovider.c') + headers,
+    dependencies: [libgoa_dep, libgoa_gir_dep],
+    includes: ['Gio-2.0', 'Gtk-3.0', libgoa_gir[0]],
+    nsversion: goa_api_version,
+    namespace: 'GoaBackend',
+    identifier_prefix: goa_ns,
+    export_packages: goa_backend_api_name,
+    extra_args: ['-DGOA_BACKEND_COMPILATION', '-DGOA_API_IS_SUBJECT_TO_CHANGE'],
+    header: join_paths('goabackend', 'goabackend.h'),
+    install: true
+  )
+
+  if enable_vapi
+    gnome.generate_vapi(
+      goa_backend_api_name,
+      sources: libgoa_backend_gir[0],
+      packages: ['gio-2.0', 'gtk+-3.0', libgoa_vapi],
+      install: true
+    )
+  endif
+endif
+
 libgoawebextension_sources = files(
   'goawebextension.c',
   'goawebextensionmain.c'


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