[gupnp-dlna] Add GObject introspection



commit ed0dca37952c41c5294ad9c992c50e1a040a0215
Author: Jens Georg <mail jensge org>
Date:   Wed Jun 22 18:45:13 2011 +0200

    Add GObject introspection

 configure.ac                          |    3 +
 libgupnp-dlna/Makefile.am             |   41 ++++++++++++--
 libgupnp-dlna/gupnp-dlna-discoverer.c |    9 ++--
 libgupnp-dlna/gupnp-dlna-profile.c    |    6 +-
 m4/introspection.m4                   |   94 +++++++++++++++++++++++++++++++++
 5 files changed, 140 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3ef0a66..d812845 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@ AC_INIT(gupnp-dlna, 0.6.1, http://www.gupnp.org/)
 AM_INIT_AUTOMAKE()
 AC_CONFIG_SRCDIR(libgupnp-dlna/gupnp-dlna-profile.h)
 AM_CONFIG_HEADER(config.h)
+AC_CONFIG_MACRO_DIR([m4])
 
 dnl library versioning
 dnl Increase when changing the API
@@ -52,6 +53,8 @@ if test "x$enable_debug" = "xyes"; then
         CFLAGS="$CFLAGS -g -Wall"
 fi
 
+GOBJECT_INTROSPECTION_CHECK([0.6.4])
+
 GTK_DOC_CHECK([1.0])
 
 AC_OUTPUT([
diff --git a/libgupnp-dlna/Makefile.am b/libgupnp-dlna/Makefile.am
index 1480f61..fe197cf 100644
--- a/libgupnp-dlna/Makefile.am
+++ b/libgupnp-dlna/Makefile.am
@@ -41,16 +41,45 @@ libgupnp_dlna_inc_HEADERS = gupnp-dlna-profile.h \
 noinst_HEADERS = profile-loading.h \
                  gupnp-dlna-profile-private.h
 
-libgupnp_dlna_1_0_la_SOURCES = gupnp-dlna-information.c \
-			       gupnp-dlna-discoverer.c \
-			       gupnp-dlna-profile.c \
-			       gupnp-dlna-profiles.c \
-			       profile-loading.c \
+introspection_sources = $(libgupnp_dlna_inc_HEADERS) \
+			gupnp-dlna-information.c \
+			gupnp-dlna-discoverer.c \
+			gupnp-dlna-profile.c \
+			gupnp-dlna-profiles.c \
+			profile-loading.c
+
+libgupnp_dlna_1_0_la_SOURCES = $(introspection_sources) \
 			       $(BUILT_SOURCES)
 
 libgupnp_dlna_1_0_la_LIBADD = $(LIBXML_LIBS) \
 			      $(GST_PBU_LIBS)
 
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --warn-all				\
+			     --symbol-prefix=gupnp		\
+			     --identifier-prefix=GUPnP	\
+			     --add-include-path=$(top_srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(top_srcdir)
+
+if HAVE_INTROSPECTION
+GUPnP-DLNA-1.0.gir: libgupnp-dlna-1.0.la
+GUPnP_DLNA_1_0_gir_INCLUDES = libxml2-2.0 GObject-2.0 GstPbutils-0.10
+GUPnP_DLNA_1_0_gir_CFLAGS =  $(INCLUDES) $(AM_CFLAGS)
+GUPnP_DLNA_1_0_gir_LIBS = libgupnp-dlna-1.0.la
+GUPnP_DLNA_1_0_gir_FILES = $(introspection_sources)
+GUPnP_DLNA_1_0_gir_NAMESPACE = GUPnP
+GUPnP_DLNA_1_0_gir_VERSION = 1.0
+
+INTROSPECTION_GIRS += GUPnP-DLNA-1.0.gir
+
+girdir = $(datatdir)/gir-1.0
+gir_DATA = GUPnP-DLNA-1.0.gir
+
+typelibdir = $(libdir)/girepository-1.0/
+typelib_DATA = $(gir_DATA:.gir=.typelib)
+endif
+
 EXTRA_DIST = gupnp-dlna-marshal.list
 
-CLEANFILES = $(BUILT_SOURCES)
+CLEANFILES = $(BUILT_SOURCES) $(gir_DATA) $(typelib_DATA)
diff --git a/libgupnp-dlna/gupnp-dlna-discoverer.c b/libgupnp-dlna/gupnp-dlna-discoverer.c
index a6283eb..faf21ff 100644
--- a/libgupnp-dlna/gupnp-dlna-discoverer.c
+++ b/libgupnp-dlna/gupnp-dlna-discoverer.c
@@ -327,8 +327,8 @@ gupnp_dlna_discoverer_discover_uri (GUPnPDLNADiscoverer *discoverer,
  *
  * Synchronously gathers metadata for @uri.
  *
- * Returns: a #GUPnPDLNAInformation with the metadata for @uri on success, NULL
- *          otherwise
+ * Returns: (transfer full): a #GUPnPDLNAInformation with the metadata for @uri
+ *          on success, NULL otherwise
  */
 GUPnPDLNAInformation *
 gupnp_dlna_discoverer_discover_uri_sync (GUPnPDLNADiscoverer *discoverer,
@@ -361,7 +361,7 @@ gupnp_dlna_discoverer_discover_uri_sync (GUPnPDLNADiscoverer *discoverer,
  * Given @name, this finds the corresponding DLNA profile information (stored
  * as a #GUPnPDLNAProfile).
  *
- * Returns: a #GUPnPDLNAProfile on success, NULL otherwise.
+ * Returns: (transfer full): a #GUPnPDLNAProfile on success, NULL otherwise.
  **/
 GUPnPDLNAProfile *
 gupnp_dlna_discoverer_get_profile (GUPnPDLNADiscoverer *self,
@@ -396,7 +396,8 @@ gupnp_dlna_discoverer_get_profile (GUPnPDLNADiscoverer *self,
  *
  * Retuns a list of the all the DLNA profiles supported by @self.
  *
- * Returns: a #GList of #GUPnPDLNAProfile on success, NULL otherwise.
+ * Returns: (transfer none) (element-type GUPnPDLNAProfile*): a #GList of
+ *          #GUPnPDLNAProfile on success, NULL otherwise.
  **/
 const GList *
 gupnp_dlna_discoverer_list_profiles (GUPnPDLNADiscoverer *self)
diff --git a/libgupnp-dlna/gupnp-dlna-profile.c b/libgupnp-dlna/gupnp-dlna-profile.c
index b7dbc55..b88fed6 100644
--- a/libgupnp-dlna/gupnp-dlna-profile.c
+++ b/libgupnp-dlna/gupnp-dlna-profile.c
@@ -309,9 +309,9 @@ gupnp_dlna_profile_get_mime (GUPnPDLNAProfile *self)
  * gupnp_dlna_profile_get_encoding_profile:
  * @self: The #GUPnPDLNAProfile object
  *
- * Returns: a #GstEncodingProfile object that, in a future version, can be used
- *          to transcode a given stream to match the DLNA profile represented
- *          by @self.
+ * Returns: (transfer full): a #GstEncodingProfile object that, in a future
+ *          version, can be used to transcode a given stream to match the DLNA
+ *          profile represented by @self.
  *          The receiver must unref the returned #GstEncodingProfile when done
  *          using it.
  */
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..bfc52be
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,94 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+    dnl enable/disable introspection
+    m4_if([$2], [require],
+    [dnl
+        enable_introspection=yes
+    ],[dnl
+        AC_ARG_ENABLE(introspection,
+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+                                 [Enable introspection for this build]),,
+                                 [enable_introspection=auto])
+    ])dnl
+
+    AC_MSG_CHECKING([for gobject-introspection])
+
+    dnl presence/version checking
+    AS_CASE([$enable_introspection],
+    [no], [dnl
+        found_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+                         found_introspection=yes,
+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+    ],dnl
+    [auto],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+    ],dnl
+    [dnl
+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+    ])dnl
+
+    AC_MSG_RESULT([$found_introspection])
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+    AC_SUBST(INTROSPECTION_CFLAGS)
+    AC_SUBST(INTROSPECTION_LIBS)
+    AC_SUBST(INTROSPECTION_MAKEFILE)
+
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])



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