summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Knowles <alan@akkbhome.com>2010-06-27 02:55:13 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-27 03:00:59 +0200
commit4ded79d54dd514c7f7d711e38ec4277f4427c78e (patch)
tree6c495ab96535f2907f031500520798fd667346cf
parented11c6a4d4da379ff9ebccb7a0340e64232efabb (diff)
gobject: implement gobject introspection
-rw-r--r--Makefile.am4
-rw-r--r--avahi-gobject/.gitignore2
-rw-r--r--avahi-gobject/AvahiCore-0.6.gir59
-rw-r--r--avahi-gobject/Makefile.am30
-rw-r--r--common/.gitignore1
-rw-r--r--common/introspection.m494
-rw-r--r--configure.ac7
7 files changed, 195 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 982a83d..a800687 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,7 +49,8 @@ EXTRA_DIST = \
avahi-compat-howl.pc.in \
avahi-ui.pc.in \
avahi-ui-gtk3.pc.in \
- doxygen_to_devhelp.xsl
+ doxygen_to_devhelp.xsl \
+ common/introspection.m4
SUBDIRS = \
common \
@@ -223,6 +224,7 @@ MOSTLYCLEANFILES = $(DX_CLEANFILES)
DISTCHECK_CONFIGURE_FLAGS = \
--disable-monodoc \
+ --enable-introspection \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
homepage:
diff --git a/avahi-gobject/.gitignore b/avahi-gobject/.gitignore
index 1466c78..402b45c 100644
--- a/avahi-gobject/.gitignore
+++ b/avahi-gobject/.gitignore
@@ -1,3 +1,5 @@
+*.typelib
+Avahi-0.6.gir
ga-*-enumtypes.c
ga-*-enumtypes.h
*.o
diff --git a/avahi-gobject/AvahiCore-0.6.gir b/avahi-gobject/AvahiCore-0.6.gir
new file mode 100644
index 0000000..8b25fc1
--- /dev/null
+++ b/avahi-gobject/AvahiCore-0.6.gir
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<repository version="1.0"
+ xmlns="http://www.gtk.org/introspection/core/1.0"
+ xmlns:c="http://www.gtk.org/introspection/c/1.0"
+ xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+ <namespace name="AvahiCore" version="0.6" shared-library="avahi-core">
+ <alias name="IfIndex" target="int" c:type="AvahiIfIndex"/>
+ <enumeration name="Protocol" c:type="AvahiProtocol">
+ <member name="inet"
+ value="0"
+ c:identifier="AVAHI_PROTO_INET"/>
+ <member name="inet6"
+ value="1"
+ c:identifier="AVAHI_PROTO_INET6"/>
+ <member name="unspec"
+ value="-1"
+ c:identifier="AVAHI_PROTO_UNSPEC"/>
+ </enumeration>
+ <bitfield name="PublishFlags" c:type="AvahiPublishFlags">
+ <member name="unique"
+ value="1"
+ c:identifier="AVAHI_PUBLISH_UNIQUE"/>
+ <member name="no_probe"
+ value="2"
+ c:identifier="AVAHI_PUBLISH_NO_PROBE"/>
+ <member name="no_announce"
+ value="4"
+ c:identifier="AVAHI_PUBLISH_NO_ANNOUNCE"/>
+ <member name="allow_multiple"
+ value="8"
+ c:identifier="AVAHI_PUBLISH_ALLOW_MULTIPLE"/>
+ <member name="no_reverse"
+ value="16"
+ c:identifier="AVAHI_PUBLISH_NO_reverse"/>
+ <member name="no_cookie"
+ value="32"
+ c:identifier="AVAHI_PUBLISH_NO_cookie"/>
+ <member name="update"
+ value="64"
+ c:identifier="AVAHI_PUBLISH_UPDATE"/>
+ <member name="use_wide_area"
+ value="128"
+ c:identifier="AVAHI_PUBLISH_USE_WIDE_AREA"/>
+ <member name="use_multicast"
+ value="256"
+ c:identifier="AVAHI_PUBLISH_USE_MULTICAST"/>
+ </bitfield>
+ <record name="StringList" c:type="AvahiStringList"/>
+ <record name="Address" c:type="AvahiAddress"/>
+ <record name="Client" c:type="AvahiClient"/>
+ <function name="server_get_host_name" c:identifier="avahi_server_get_host_name">
+ <return-value transfer-ownership="none">
+ <type name="utf8" c:type="char8"/>
+ </return-value>
+ <parameters>
+ </parameters>
+ </function>
+ </namespace>
+</repository>
diff --git a/avahi-gobject/Makefile.am b/avahi-gobject/Makefile.am
index bfb3393..02f2b94 100644
--- a/avahi-gobject/Makefile.am
+++ b/avahi-gobject/Makefile.am
@@ -20,6 +20,9 @@ AM_CFLAGS=-I$(top_srcdir)
# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
+EXTRA_DIST = \
+ AvahiCore-0.6.gir
+
if HAVE_GOBJECT
if HAVE_DBUS
@@ -88,7 +91,6 @@ signals-marshal.h: signals-marshal.list
signals-marshal.c: signals-marshal.list
$(AM_V_GEN)(echo "#include \"signals-marshal.h\"" ; glib-genmarshal --body --prefix=_ga_signals_marshal $< ) > $@
-
# rules for making the glib enum objects
%-enumtypes.h: %.h Makefile.in
$(AM_V_GEN)glib-mkenums \
@@ -107,6 +109,32 @@ signals-marshal.c: signals-marshal.list
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
$< > $@
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+introspection_sources = $(libavahi_gobject_la_SOURCES)
+
+Avahi-0.6.gir: $(lib_LTLIBRARIES)
+Avahi_0_6_gir_INCLUDES = GObject-2.0 AvahiCore-0.6
+Avahi_0_6_gir_CFLAGS = $(libavahi_gobject_la_CFLAGS)
+Avahi_0_6_gir_LIBS = $(lib_LTLIBRARIES)
+Avahi_0_6_gir_FILES = $(addprefix $(srcdir)/, $(CORE_SOURCES)) $(BUILT_SOURCES)
+Avahi_0_6_gir_SCANNERFLAGS = --strip-prefix=Ga
+INTROSPECTION_GIRS += Avahi-0.6.gir
+INTROSPECTION_INSTALL_GIRS = AvahiCore-0.6.gir $(INTROSPECTION_GIRS)
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_INSTALL_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_INSTALL_GIRS:.gir=.typelib)
+
+CLEANFILES += $(INTROSPECTION_GIRS) $(typelib_DATA)
+endif
+
endif
endif
diff --git a/common/.gitignore b/common/.gitignore
index de8ddd7..1012b7f 100644
--- a/common/.gitignore
+++ b/common/.gitignore
@@ -1,3 +1,4 @@
+intltool.m4
ChangeLog
gettext.m4
iconv.m4
diff --git a/common/introspection.m4 b/common/introspection.m4
new file mode 100644
index 0000000..bfc52be
--- /dev/null
+++ b/common/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])
+])
diff --git a/configure.ac b/configure.ac
index 42d7d22..1be1f60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,6 +21,7 @@
AC_PREREQ(2.63)
AC_INIT([avahi],[0.6.25],[avahi (at) lists (dot) freedesktop (dot) org])
AC_CONFIG_SRCDIR([avahi-core/server.c])
+AC_CONFIG_MACRO_DIR([common])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
@@ -469,6 +470,11 @@ fi
AM_CONDITIONAL(HAVE_GOBJECT, test "x$HAVE_GOBJECT" = "xyes")
#
+# Introspection support.
+#
+GOBJECT_INTROSPECTION_CHECK([0.6.7])
+
+#
# Check for Qt 3
#
AC_ARG_ENABLE(qt3,
@@ -1136,6 +1142,7 @@ echo "
CFLAGS: ${CFLAGS}
Enable GLIB: ${HAVE_GLIB}
Enable GLIB GObject: ${HAVE_GOBJECT}
+ Enable GObject Introspection: ${found_introspection}
Enable GTK 2.0: ${HAVE_GTK}
Enable GTK 3.0: ${HAVE_GTK3}
Enable D-Bus: ${HAVE_DBUS}