diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | configure.ac | 39 | ||||
-rw-r--r-- | extensions/Makefile.am | 97 | ||||
-rw-r--r-- | extensions/all.xml | 2 | ||||
-rw-r--r-- | extensions/extensions-cli.c | 32 | ||||
-rw-r--r-- | extensions/extensions.c | 1 | ||||
-rw-r--r-- | extensions/extensions.h | 14 | ||||
-rw-r--r-- | extensions/misc.xml | 10 | ||||
-rw-r--r-- | extensions/tpl-extensions.pc.in | 11 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | telepathy-logger/Makefile.am | 2 | ||||
-rw-r--r-- | tools/Makefile.am | 1 | ||||
-rw-r--r-- | tools/glib-client-marshaller-gen.py | 59 |
13 files changed, 228 insertions, 43 deletions
@@ -62,6 +62,7 @@ Makefile.in /doc/reference/libtelepathy-logger/tmpl/ /doc/reference/libtelepathy-logger/xml/ +/extensions/tpl-extensions.pc /extensions/_gen/ /extensions/doc/ diff --git a/configure.ac b/configure.ac index ebb1e7d..1cd0514 100644 --- a/configure.ac +++ b/configure.ac @@ -148,16 +148,20 @@ AC_SUBST(ERROR_CFLAGS) # Pkg-Config dependency checks # ----------------------------------------------------------- -PKG_CHECK_MODULES(LIBTPL, -[ - gconf-2.0 - gio-2.0 - glib-2.0 >= $GLIB_REQUIRED - gobject-2.0 - libxml-2.0 - telepathy-glib >= $TELEPATHY_GLIB_REQUIRED - sqlite3 -]) +LIBTPL_MODULES=""" + gconf-2.0 + gio-2.0 + glib-2.0 >= $GLIB_REQUIRED + gobject-2.0 + libxml-2.0 + telepathy-glib >= $TELEPATHY_GLIB_REQUIRED + sqlite3 + """ + +LIBTPL_MODULES=`echo $LIBTPL_MODULES` + +AC_SUBST([LIBTPL_MODULES]) +PKG_CHECK_MODULES(LIBTPL, [$LIBTPL_MODULES]) PKG_CHECK_MODULES(TPL, [ @@ -170,6 +174,19 @@ PKG_CHECK_MODULES(TPL, ]) +# ----------------------------------------------------------- +# Enable public extensions library +# ----------------------------------------------------------- + +AC_ARG_ENABLE(public_extensions, + AC_HELP_STRING([--enable-public-extensions],[build a public wrapper for the Telepathy extensions library]), + enable_public_extensions=$enableval, enable_public_extensions=no ) + +if test x$enable_public_extensions = xyes; then + AC_DEFINE(ENABLE_PUBLIC_EXTENSIONS, [], [Enable Public Extensions]) +fi +AM_CONDITIONAL([ENABLE_PUBLIC_EXTENSIONS], [test "x$enable_public_extensions" = xyes]) + # ----------------------------------------------------------- # Enable Channel types @@ -222,6 +239,7 @@ AC_OUTPUT([ doc/reference/Makefile doc/reference/libtelepathy-logger/Makefile extensions/Makefile + extensions/tpl-extensions.pc src/Makefile telepathy-logger/Makefile telepathy-logger/telepathy-logger.pc @@ -243,6 +261,7 @@ Configure summary: Python Twisted tests........: ${TEST_PYTHON} Bugreporting URL............: ${PACKAGE_BUGREPORT} Enable Text Channel.........: ${enable_channeltext} + Public extensions library...: ${enable_public_extensions} " diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 1080110..d52c199 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -1,36 +1,78 @@ tools_dir = $(top_srcdir)/tools +pkgconfigdir = $(libdir)/pkgconfig + +pkgconfig_DATA = +if ENABLE_PUBLIC_EXTENSIONS +pkgconfig_DATA += tpl-extensions.pc +endif # ENABLE_PUBLIC_EXTENSIONS + +$(pkgconfig_DATA): $(top_srcdir)/config.status + EXTRA_DIST = \ all.xml \ + misc.xml \ Logger.xml \ + $(pkgconfig_DATA:.pc=.pc.in) \ $(NULL) -noinst_LTLIBRARIES = libtpl-extensions.la - -libtpl_extensions_la_SOURCES = \ - extensions.c \ - extensions.h +noinst_LTLIBRARIES = libtpl-extensions-convenience.la -nodist_libtpl_extensions_la_SOURCES = \ - _gen/signals-marshal.c \ - _gen/signals-marshal.h \ - _gen/signals-marshal.list \ +gen_headers = \ + _gen/cli-misc.h \ _gen/enums.h \ _gen/gtypes.h \ - _gen/gtypes-body.h \ _gen/interfaces.h \ + _gen/svc-misc.h \ + $(NULL) + +nodist_libtpl_extensions_convenience_la_SOURCES = \ + _gen/cli-misc-body.h \ + _gen/gtypes-body.h \ _gen/interfaces-body.h \ - _gen/cli.h \ - _gen/cli-body.h \ - _gen/svc.h \ - _gen/svc.c + _gen/register-dbus-glib-marshallers-body.h \ + _gen/signals-marshal.c \ + _gen/signals-marshal.h \ + _gen/signals-marshal.list \ + _gen/svc-misc.c \ + $(gen_headers) \ + $(NULL) + +extension_headers = \ + extensions.h \ + $(NULL) + +libtpl_extensions_convenience_la_SOURCES = \ + extensions.c \ + extensions-cli.c \ + $(extension_headers) \ + $(NULL) BUILT_SOURCES = \ _gen/all.xml \ - $(nodist_libtpl_extensions_la_SOURCES) + _gen/misc.xml \ + $(nodist_libtpl_extensions_convenience_la_SOURCES) \ + $(gen_headers) \ + $(NULL) + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(pkgconfig_DATA) \ + $(NULL) -CLEANFILES = $(BUILT_SOURCES) \ - _gen/ +if ENABLE_PUBLIC_EXTENSIONS +tplincludedir=$(includedir)/tpl-extensions +genincludedir=$(tplincludedir)/_gen + +tplinclude_HEADERS = $(extension_headers) +geninclude_HEADERS = $(gen_headers) + +# copy the core library and make it installable +lib_LTLIBRARIES = libtpl-extensions.la + +libtpl_extensions_la_SOURCES = +libtpl_extensions_la_LIBADD = libtpl-extensions-convenience.la +endif # ENABLE_PUBLIC_EXTENSIONS AM_CFLAGS = $(ERROR_CFLAGS) @LIBTPL_CFLAGS@ @HANDLE_LEAK_DEBUG_CFLAGS@ AM_LDFLAGS = @LIBTPL_LIBS@ @@ -49,24 +91,30 @@ doc/index.html: _gen/all.xml $(tools_dir)/specparser.py $(tools_dir)/doc-generat $(AM_V_GEN)$(PYTHON) $(tools_dir)/doc-generator.py all.xml doc/ \ telepathy-spec org.freedesktop.Telepathy -_gen/svc.c _gen/svc.h: _gen/all.xml $(tools_dir)/glib-ginterface-gen.py \ +_gen/misc.xml: misc.xml $(wildcard *.xml) + @$(mkdir_p) _gen + $(AM_V_GEN)$(XSLTPROC) $(XSLTPROCFLAGS) --xinclude $(tools_dir)/identity.xsl \ + $< > $@ + +_gen/svc-misc.c _gen/svc-misc.h: _gen/misc.xml $(tools_dir)/glib-ginterface-gen.py \ Makefile.am $(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-ginterface-gen.py \ - --filename=_gen/svc --signal-marshal-prefix=_tpl_ext \ + --filename=_gen/svc-misc --signal-marshal-prefix=_tpl_ext \ --include='<telepathy-glib/dbus.h>' \ --include='"_gen/signals-marshal.h"' \ --allow-unstable \ --not-implemented-func='tp_dbus_g_method_return_not_implemented' \ $< Tpl_Svc_ -_gen/cli-body.h _gen/cli.h: _gen/all.xml $(tools_dir)/glib-ginterface-gen.py \ +_gen/cli-misc-body.h _gen/cli-misc.h: _gen/misc.xml $(tools_dir)/glib-ginterface-gen.py \ Makefile.am $(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-client-gen.py \ + --group=misc \ --subclass=TpProxy \ --subclass-assert=TP_IS_PROXY \ --iface-quark-prefix=TPL_IFACE_QUARK \ - --tp-proxy-api=0.7.6 \ - $< Tpl_Cli _gen/cli + --tp-proxy-api=0.10.0 \ + $< Tpl_Cli _gen/cli-misc _gen/signals-marshal.list: _gen/all.xml \ $(tools_dir)/glib-signals-marshal-gen.py \ @@ -80,6 +128,11 @@ _gen/signals-marshal.c: _gen/signals-marshal.list Makefile.am $(AM_V_GEN){ echo '#include "_gen/signals-marshal.h"' && \ $(GLIB_GENMARSHAL) --body --prefix=_tpl_ext_marshal $< ; } > $@ +_gen/register-dbus-glib-marshallers-body.h: _gen/all.xml \ + $(tools_dir)/glib-client-marshaller-gen.py + $(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-client-marshaller-gen.py $< \ + _tpl_ext > $@ + _gen/enums.h: _gen/all.xml $(tools_dir)/c-constants-gen.py \ Makefile.am $(AM_V_GEN)$(PYTHON) $(tools_dir)/c-constants-gen.py Tpl $< > $@ diff --git a/extensions/all.xml b/extensions/all.xml index cff8af8..efe90b0 100644 --- a/extensions/all.xml +++ b/extensions/all.xml @@ -29,6 +29,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p> from="Telepathy specification"/> </tp:generic-types> -<xi:include href="Logger.xml"/> +<xi:include href="misc.xml"/> </tp:spec> diff --git a/extensions/extensions-cli.c b/extensions/extensions-cli.c new file mode 100644 index 0000000..6c8dc96 --- /dev/null +++ b/extensions/extensions-cli.c @@ -0,0 +1,32 @@ +#include "extensions.h" + +#include <telepathy-glib/connection.h> +#include <telepathy-glib/proxy-subclass.h> + +static void _tpl_ext_register_dbus_glib_marshallers (void); + +/* include auto-generated stubs for client-specific code */ +#include "_gen/signals-marshal.h" +#include "_gen/cli-misc-body.h" +#include "_gen/register-dbus-glib-marshallers-body.h" + +static gpointer +tpl_cli_once (gpointer data) +{ + _tpl_ext_register_dbus_glib_marshallers (); + + tp_proxy_init_known_interfaces (); + + tp_proxy_or_subclass_hook_on_interface_add (TP_TYPE_PROXY, + tpl_cli_misc_add_signals); + + return NULL; +} + +void +tpl_cli_init (void) +{ + static GOnce once = G_ONCE_INIT; + + g_once (&once, tpl_cli_once, NULL); +} diff --git a/extensions/extensions.c b/extensions/extensions.c index d18b085..a47e0e1 100644 --- a/extensions/extensions.c +++ b/extensions/extensions.c @@ -5,4 +5,3 @@ /* auto-generated stubs */ #include "_gen/gtypes-body.h" #include "_gen/interfaces-body.h" -#include "_gen/cli-body.h" diff --git a/extensions/extensions.h b/extensions/extensions.h index 65b4a2e..5c47b59 100644 --- a/extensions/extensions.h +++ b/extensions/extensions.h @@ -3,16 +3,18 @@ #include <telepathy-glib/proxy.h> -#include "extensions/_gen/enums.h" -#include "extensions/_gen/svc.h" -#include "extensions/_gen/cli.h" +#include "_gen/enums.h" +#include "_gen/cli-misc.h" +#include "_gen/svc-misc.h" G_BEGIN_DECLS -#include "extensions/_gen/gtypes.h" -#include "extensions/_gen/interfaces.h" +#include "_gen/gtypes.h" +#include "_gen/interfaces.h" G_END_DECLS -#endif /* _GABBLE_EXTENSIONS_H */ +void tpl_cli_init (void); + +#endif /* _TPL_EXTENSIONS_H */ diff --git a/extensions/misc.xml b/extensions/misc.xml new file mode 100644 index 0000000..3b3bc0e --- /dev/null +++ b/extensions/misc.xml @@ -0,0 +1,10 @@ +<tp:spec + xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" + xmlns:xi="http://www.w3.org/2001/XInclude"> + +<tp:title>Misc extensions for the logger (which will eventually be moved into their own interfaces)</tp:title> + +<xi:include href="Logger.xml" /> + +</tp:spec> + diff --git a/extensions/tpl-extensions.pc.in b/extensions/tpl-extensions.pc.in new file mode 100644 index 0000000..a24903c --- /dev/null +++ b/extensions/tpl-extensions.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: tpl-extensions +Description: Telepathy Logger GLib convenience library +Version: @VERSION@ +Libs: -L${libdir} -ltpl-extensions +Cflags: -I${includedir} +Requires: @LIBTPL_MODULES@ diff --git a/src/Makefile.am b/src/Makefile.am index 4e4c194..f51ee70 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,12 +20,10 @@ noinst_PROGRAMS = \ telepathy_logger_LDADD = \ $(top_builddir)/telepathy-logger/libtelepathy-logger.la \ - $(top_builddir)/extensions/libtpl-extensions.la \ $(LIBTPL_LIBS) test_api_LDADD = \ $(top_builddir)/telepathy-logger/libtelepathy-logger.la \ - $(top_builddir)/extensions/libtpl-extensions.la \ $(LIBTPL_LIBS) diff --git a/telepathy-logger/Makefile.am b/telepathy-logger/Makefile.am index 5ca0036..160dfb0 100644 --- a/telepathy-logger/Makefile.am +++ b/telepathy-logger/Makefile.am @@ -62,7 +62,7 @@ libtelepathy_logger_la_SOURCES = \ $(NULL) libtelepathy_logger_la_LIBADD = \ - $(top_builddir)/extensions/libtpl-extensions.la + $(top_builddir)/extensions/libtpl-extensions-convenience.la check_c_sources = \ $(libtelepathy_logger_la_SOURCES) \ diff --git a/tools/Makefile.am b/tools/Makefile.am index 64b2a47..14d4ab8 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -7,6 +7,7 @@ EXTRA_DIST = \ doc-generator.py \ doc-generator.xsl \ glib-client-gen.py \ + glib-client-marshaller-gen.py \ glib-ginterface-gen.py \ glib-gtypes-generator.py \ glib-interfaces-gen.py \ diff --git a/tools/glib-client-marshaller-gen.py b/tools/glib-client-marshaller-gen.py new file mode 100644 index 0000000..5444725 --- /dev/null +++ b/tools/glib-client-marshaller-gen.py @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import sys +import xml.dom.minidom +from string import ascii_letters, digits + + +from libglibcodegen import signal_to_marshal_name + + +NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" + +class Generator(object): + + def __init__(self, dom, prefix): + self.dom = dom + self.marshallers = {} + self.prefix = prefix + + def do_signal(self, signal): + marshaller = signal_to_marshal_name(signal, self.prefix) + + assert '__' in marshaller + rhs = marshaller.split('__', 1)[1].split('_') + + self.marshallers[marshaller] = rhs + + def __call__(self): + signals = self.dom.getElementsByTagName('signal') + + for signal in signals: + self.do_signal(signal) + + print 'void' + print '%s_register_dbus_glib_marshallers (void)' % self.prefix + print '{' + + all = self.marshallers.keys() + all.sort() + for marshaller in all: + rhs = self.marshallers[marshaller] + + print ' dbus_g_object_register_marshaller (%s,' % marshaller + print ' G_TYPE_NONE, /* return */' + for type in rhs: + print ' G_TYPE_%s,' % type.replace('VOID', 'NONE') + print ' G_TYPE_INVALID);' + + print '}' + + +def types_to_gtypes(types): + return [type_to_gtype(t)[1] for t in types] + +if __name__ == '__main__': + argv = sys.argv[1:] + dom = xml.dom.minidom.parse(argv[0]) + + Generator(dom, argv[1])() |