[gupnp-dlna/wip/meson: 5/8] build: Add introspection




commit f7abe5c0038b0e056b6fe5c34437ca6ac977d13a
Author: Jens Georg <mail jensge org>
Date:   Thu Oct 31 16:42:12 2019 +0100

    build: Add introspection

 libgupnp-dlna/meson.build                          | 87 ++++++++++++++--------
 .../metadata-backends/gstreamer/meson.build        | 35 ++++++---
 .../metadata/gupnp-dlna-metadata-extractor.c       |  2 +-
 meson.build                                        |  1 +
 meson_options.txt                                  |  1 +
 5 files changed, 87 insertions(+), 39 deletions(-)
---
diff --git a/libgupnp-dlna/meson.build b/libgupnp-dlna/meson.build
index 6dc2028..6b89e46 100644
--- a/libgupnp-dlna/meson.build
+++ b/libgupnp-dlna/meson.build
@@ -1,10 +1,12 @@
 headers_subdir = 'gupnp-dlna-2.0/libgupnp-dlna'
 
+loader_sources = files(
+    'gupnp-dlna-profile-loader.c'
+)
+
 libloader = static_library(
     'loader',
-    files(
-        'gupnp-dlna-profile-loader.c'
-    ),
+    loader_sources,
     c_args : [
         '-DG_LOG_DOMAIN="gupnp-dlna-loader"',
         '-DDATA_DIR="@0@"'.format(shareddir)
@@ -13,12 +15,14 @@ libloader = static_library(
     include_directories: include_directories('..')
 )
 
+guesser_sources = files(
+    'gupnp-dlna-profile-guesser.c',
+    'gupnp-dlna-profile-guesser-impl.c'
+)
+
 libguesser = static_library(
     'guesser',
-    files(
-        'gupnp-dlna-profile-guesser.c',
-        'gupnp-dlna-profile-guesser-impl.c'
-    ),
+    guesser_sources,
     dependencies : [glib, gio],
     c_args : [
         '-DG_LOG_DOMAIN="gupnp-dlna-guesser"',
@@ -30,12 +34,14 @@ libguesser = static_library(
     )
 )
 
+metadata_sources = files(
+    'gupnp-dlna-metadata-backend.c',
+    'metadata/gupnp-dlna-metadata-extractor.c'
+)
+
 libmetadata = static_library(
     'metadata',
-    files(
-        'gupnp-dlna-metadata-backend.c',
-        'metadata/gupnp-dlna-metadata-extractor.c'
-    ),
+    metadata_sources,
     dependencies : [glib, gio],
     c_args : [
         '-DG_LOG_DOMAIN="gupnp-dlna-metadata"',
@@ -61,35 +67,40 @@ headers = files(
     'gupnp-dlna-values.h',
     'gupnp-dlna.h'
 )
+
 install_headers(
     headers,
     subdir: headers_subdir
 )
 
+metadata_headers = files('metadata/gupnp-dlna-metadata-extractor.h')
+
 install_headers(
-    'metadata/gupnp-dlna-metadata-extractor.h',
+    metadata_headers,
     subdir: join_paths(headers_subdir, 'metadata')
 )
 
+sources = files(
+    'gupnp-dlna-audio-information.c',
+    'gupnp-dlna-container-information.c',
+    'gupnp-dlna-image-information.c',
+    'gupnp-dlna-information.c',
+    'gupnp-dlna-video-information.c',
+    'gupnp-dlna-field-value.c',
+    'gupnp-dlna-profile.c',
+    'gupnp-dlna-restriction.c',
+    'gupnp-dlna-value-list.c',
+    'gupnp-dlna-g-values.c',
+    'gupnp-dlna-utils.c',
+    'gupnp-dlna-value-type.c',
+    'gupnp-dlna-info-value.c',
+    'gupnp-dlna-value.c',
+    'gupnp-dlna-info-set.c'
+)
+
 libgupnp_dlna = library(
     'gupnp-dlna-2.0',
-    files(
-        'gupnp-dlna-audio-information.c',
-        'gupnp-dlna-container-information.c',
-        'gupnp-dlna-image-information.c',
-        'gupnp-dlna-information.c',
-        'gupnp-dlna-video-information.c',
-        'gupnp-dlna-field-value.c',
-        'gupnp-dlna-profile.c',
-        'gupnp-dlna-restriction.c',
-        'gupnp-dlna-value-list.c',
-        'gupnp-dlna-g-values.c',
-        'gupnp-dlna-utils.c',
-        'gupnp-dlna-value-type.c',
-        'gupnp-dlna-info-value.c',
-        'gupnp-dlna-value.c',
-        'gupnp-dlna-info-set.c'
-    ),
+    sources,
     version: library_version,
     link_whole: [
         libloader,
@@ -125,4 +136,22 @@ pkg.generate(
     variables: 'plugindir=@0@'.format(metadata_backend_dir)
 )
 
+if get_option('introspection')
+    gupnp_dlna_gir = gnome.generate_gir(
+        libgupnp_dlna,
+        sources : headers +
+            metadata_headers +
+            sources +
+            guesser_sources +
+            metadata_sources +
+            loader_sources,
+        namespace : 'GUPnPDLNA',
+        nsversion : '2.0',
+        symbol_prefix : 'gupnp_dlna',
+        identifier_prefix : 'GUPnPDLNA',
+        install: true,
+        includes : ['GObject-2.0']
+    )
+endif
+
 subdir('metadata-backends')
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/meson.build 
b/libgupnp-dlna/metadata-backends/gstreamer/meson.build
index 9dfd17c..006f60b 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/meson.build
+++ b/libgupnp-dlna/metadata-backends/gstreamer/meson.build
@@ -2,17 +2,19 @@ dlna_gst_headers = files('gupnp-dlna-gst-utils.h')
 
 install_headers(dlna_gst_headers, subdir : headers_subdir)
 
+dlna_gst_sources = files(
+    'gupnp-dlna-gst-audio-information.c',
+    'gupnp-dlna-gst-container-information.c',
+    'gupnp-dlna-gst-image-information.c',
+    'gupnp-dlna-gst-information.c',
+    'gupnp-dlna-gst-info-utils.c',
+    'gupnp-dlna-gst-utils.c',
+    'gupnp-dlna-gst-video-information.c'
+)
+
 libgupnp_dlna_gst = library(
     'gupnp-dlna-gst-2.0',
-    files(
-        'gupnp-dlna-gst-audio-information.c',
-        'gupnp-dlna-gst-container-information.c',
-        'gupnp-dlna-gst-image-information.c',
-        'gupnp-dlna-gst-information.c',
-        'gupnp-dlna-gst-info-utils.c',
-        'gupnp-dlna-gst-utils.c',
-        'gupnp-dlna-gst-video-information.c'
-    ),
+    dlna_gst_sources,
     version: library_version,
     dependencies : [
         glib,
@@ -55,3 +57,18 @@ pkg.generate(
     libraries: gupnp_dlna,
     requires: gstreamer_pbu
 )
+
+if get_option('introspection')
+    gupnp_dlna_gst_gir = gnome.generate_gir(
+        libgupnp_dlna_gst,
+        dependencies: gupnp_dlna_gir,
+        sources : dlna_gst_headers +
+            dlna_gst_sources,
+        namespace : 'GUPnPDLNAGst',
+        nsversion : '2.0',
+        symbol_prefix : 'gupnp_dlna_gst',
+        identifier_prefix : 'GUPnPDLNAGst',
+        install: true,
+        includes : ['GObject-2.0', 'GUPnPDLNA-2.0', 'Gst-1.0', 'GstPbutils-1.0']
+    )
+endif
diff --git a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c 
b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
index 2ddc6df..766a739 100644
--- a/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
+++ b/libgupnp-dlna/metadata/gupnp-dlna-metadata-extractor.c
@@ -160,7 +160,7 @@ gupnp_dlna_metadata_extractor_extract_async
  *
  * Discovers synchronously metadata of given @uri.
  *
- * Returns: A #GUPnPDLNAInformation object if discovery succeeded,
+ * Returns: (transfer full) : A #GUPnPDLNAInformation object if discovery succeeded,
  * otherwise %NULL.
  */
 GUPnPDLNAInformation *
diff --git a/meson.build b/meson.build
index 63f45bb..10b305d 100644
--- a/meson.build
+++ b/meson.build
@@ -5,6 +5,7 @@ project(
 )
 
 pkg = import('pkgconfig')
+gnome = import('gnome')
 
 shareddir = join_paths(get_option('prefix'), get_option('datadir'), 'gupnp-dlna-2.0')
 metadata_backend_dir = join_paths(get_option('prefix'), get_option('libdir'), 'gupnp-dlna')
diff --git a/meson_options.txt b/meson_options.txt
index 419ab9f..60361a6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1 +1,2 @@
 option('gstreamer_backend', type : 'feature', value: 'enabled')
+option('introspection', type: 'boolean', value: 'true')


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