]> git.meshlink.io Git - catta/commitdiff
gobject: implement gobject introspection
authorAlan Knowles <alan@akkbhome.com>
Sun, 27 Jun 2010 00:55:13 +0000 (02:55 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 27 Jun 2010 01:00:59 +0000 (03:00 +0200)
Makefile.am
avahi-gobject/.gitignore
avahi-gobject/AvahiCore-0.6.gir [new file with mode: 0644]
avahi-gobject/Makefile.am
common/.gitignore
common/introspection.m4 [new file with mode: 0644]
configure.ac

index 982a83dd93015126e54d523307ed81f0ca9a43b4..a800687b1eb4d12f883e756f5a033c3743112287 100644 (file)
@@ -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:
index 1466c783bea218eb6a3e574f45cb9e075d7ae50a..402b45c2041bf8ca31ccded4402e9df411c894d6 100644 (file)
@@ -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 (file)
index 0000000..8b25fc1
--- /dev/null
@@ -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>
index bfb339356a0bb0edbf6cc5c5ab76c56621189cc4..02f2b9483b4bbed6a5fa68bf844b50130d888999 100644 (file)
@@ -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
 
index de8ddd7bbe42d403b2b7606b5ac63110790ed480..1012b7fb6b27f2718ae174f8d5dbf48fbe895be7 100644 (file)
@@ -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 (file)
index 0000000..bfc52be
--- /dev/null
@@ -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])
+])
index 42d7d229e47e4a63dc13acaa6cc1072d85ce6439..1be1f60ad09b5547c6dfdfd141d10c7dec1f8acd 100644 (file)
@@ -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])
 
@@ -468,6 +469,11 @@ if test "x$HAVE_GOBJECT" = "xyes" ; then
 fi
 AM_CONDITIONAL(HAVE_GOBJECT, test "x$HAVE_GOBJECT" = "xyes")
 
+#
+# Introspection support.
+#
+GOBJECT_INTROSPECTION_CHECK([0.6.7])
+
 #
 # Check for Qt 3
 #
@@ -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}