Ticket #307: avahi.ae24f2fed0dfe02793b27bb210fa04ae7be40912.commit

File avahi.ae24f2fed0dfe02793b27bb210fa04ae7be40912.commit, 8.9 KB (added by Alan Knowles, 3 years ago)

Full working - clean - GObject support..

Line 
1commit ae24f2fed0dfe02793b27bb210fa04ae7be40912
2Author: Alan Knowles <alan@akkbhome.com>
3Date:   Sat Jun 26 21:29:00 2010 +0800
4
5    Gobject Introspection support
6
7diff --git a/Makefile.am b/Makefile.am
8index 168c556..d42e0c6 100644
9--- a/Makefile.am
10+++ b/Makefile.am
11@@ -49,7 +49,8 @@ EXTRA_DIST = \
12    avahi-compat-howl.pc.in \
13    avahi-ui.pc.in \
14    avahi-ui-gtk3.pc.in \
15-   doxygen_to_devhelp.xsl
16+   doxygen_to_devhelp.xsl \
17+        common/introspection.m4
18 
19 SUBDIRS = \
20    common \
21@@ -222,7 +223,8 @@ avahi.devhelp: doxygen-run
22 MOSTLYCLEANFILES = $(DX_CLEANFILES)
23 
24 DISTCHECK_CONFIGURE_FLAGS = \
25-   --disable-monodoc
26+   --disable-monodoc \
27+        --enable-introspection
28 
29 homepage:
30    $(MAKE) -C man
31diff --git a/avahi-gobject/AvahiCore-0.6.gir b/avahi-gobject/AvahiCore-0.6.gir
32new file mode 100644
33index 0000000..8b25fc1
34--- /dev/null
35+++ b/avahi-gobject/AvahiCore-0.6.gir
36@@ -0,0 +1,59 @@
37+<?xml version="1.0"?>
38+<repository version="1.0"
39+            xmlns="http://www.gtk.org/introspection/core/1.0"
40+            xmlns:c="http://www.gtk.org/introspection/c/1.0"
41+            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
42+  <namespace name="AvahiCore" version="0.6" shared-library="avahi-core">
43+    <alias name="IfIndex" target="int" c:type="AvahiIfIndex"/>
44+    <enumeration name="Protocol" c:type="AvahiProtocol">
45+      <member name="inet"
46+              value="0"
47+              c:identifier="AVAHI_PROTO_INET"/>
48+      <member name="inet6"
49+              value="1"
50+              c:identifier="AVAHI_PROTO_INET6"/>
51+      <member name="unspec"
52+              value="-1"
53+              c:identifier="AVAHI_PROTO_UNSPEC"/>
54+    </enumeration>
55+    <bitfield name="PublishFlags" c:type="AvahiPublishFlags">
56+      <member name="unique"
57+              value="1"
58+              c:identifier="AVAHI_PUBLISH_UNIQUE"/>
59+      <member name="no_probe"
60+              value="2"
61+              c:identifier="AVAHI_PUBLISH_NO_PROBE"/>
62+      <member name="no_announce"
63+              value="4"
64+              c:identifier="AVAHI_PUBLISH_NO_ANNOUNCE"/>
65+      <member name="allow_multiple"
66+              value="8"
67+              c:identifier="AVAHI_PUBLISH_ALLOW_MULTIPLE"/>
68+      <member name="no_reverse"
69+              value="16"
70+              c:identifier="AVAHI_PUBLISH_NO_reverse"/>
71+      <member name="no_cookie"
72+              value="32"
73+              c:identifier="AVAHI_PUBLISH_NO_cookie"/>
74+      <member name="update"
75+              value="64"
76+              c:identifier="AVAHI_PUBLISH_UPDATE"/>
77+      <member name="use_wide_area"
78+              value="128"
79+              c:identifier="AVAHI_PUBLISH_USE_WIDE_AREA"/>
80+      <member name="use_multicast"
81+              value="256"
82+              c:identifier="AVAHI_PUBLISH_USE_MULTICAST"/>
83+    </bitfield>
84+    <record name="StringList" c:type="AvahiStringList"/>
85+    <record name="Address" c:type="AvahiAddress"/>
86+    <record name="Client" c:type="AvahiClient"/>
87+    <function name="server_get_host_name" c:identifier="avahi_server_get_host_name">
88+      <return-value transfer-ownership="none">
89+        <type name="utf8" c:type="char8"/>
90+      </return-value>
91+      <parameters>
92+      </parameters>
93+    </function>
94+  </namespace>
95+</repository>
96diff --git a/avahi-gobject/Makefile.am b/avahi-gobject/Makefile.am
97index bfb3393..5a635be 100644
98--- a/avahi-gobject/Makefile.am
99+++ b/avahi-gobject/Makefile.am
100@@ -107,6 +107,36 @@ signals-marshal.c: signals-marshal.list
101    --vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
102    $< > $@
103 
104+
105+
106+
107+-include $(INTROSPECTION_MAKEFILE)
108+INTROSPECTION_GIRS =
109+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
110+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
111+
112+if HAVE_INTROSPECTION
113+introspection_sources = $(libavahi_gobject_la_SOURCES)
114+
115+Avahi-0.6.gir: $(lib_LTLIBRARIES)
116+Avahi_0_6_gir_INCLUDES = GObject-2.0 AvahiCore-0.6
117+Avahi_0_6_gir_CFLAGS = $(libavahi_gobject_la_CFLAGS)
118+Avahi_0_6_gir_LIBS = $(lib_LTLIBRARIES)
119+Avahi_0_6_gir_FILES = $(introspection_sources)
120+Avahi_0_6_gir_SCANNERFLAGS = --strip-prefix=Ga
121+INTROSPECTION_GIRS += Avahi-0.6.gir
122+INTROSPECTION_INSTALL_GIRS = AvahiCore-0.6.gir $(INTROSPECTION_GIRS)
123+
124+girdir = $(datadir)/gir-1.0
125+gir_DATA = $(INTROSPECTION_GIRS)
126+
127+typelibdir = $(libdir)/girepository-1.0
128+typelib_DATA = $(INTROSPECTION_INSTALL_GIRS:.gir=.typelib)
129+
130+CLEANFILES += $(gir_DATA) $(typelib_DATA) Avahi-0.6.typelib
131+endif
132+
133+
134 endif
135 endif
136 
137diff --git a/common/introspection.m4 b/common/introspection.m4
138new file mode 100644
139index 0000000..bfc52be
140--- /dev/null
141+++ b/common/introspection.m4
142@@ -0,0 +1,94 @@
143+dnl -*- mode: autoconf -*-
144+dnl Copyright 2009 Johan Dahlin
145+dnl
146+dnl This file is free software; the author(s) gives unlimited
147+dnl permission to copy and/or distribute it, with or without
148+dnl modifications, as long as this notice is preserved.
149+dnl
150+
151+# serial 1
152+
153+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
154+[
155+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
156+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
157+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
158+
159+    dnl enable/disable introspection
160+    m4_if([$2], [require],
161+    [dnl
162+        enable_introspection=yes
163+    ],[dnl
164+        AC_ARG_ENABLE(introspection,
165+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
166+                                 [Enable introspection for this build]),,
167+                                 [enable_introspection=auto])
168+    ])dnl
169+
170+    AC_MSG_CHECKING([for gobject-introspection])
171+
172+    dnl presence/version checking
173+    AS_CASE([$enable_introspection],
174+    [no], [dnl
175+        found_introspection="no (disabled, use --enable-introspection to enable)"
176+    ],dnl
177+    [yes],[dnl
178+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
179+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
180+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
181+                         found_introspection=yes,
182+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
183+    ],dnl
184+    [auto],[dnl
185+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
186+    ],dnl
187+    [dnl
188+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
189+    ])dnl
190+
191+    AC_MSG_RESULT([$found_introspection])
192+
193+    INTROSPECTION_SCANNER=
194+    INTROSPECTION_COMPILER=
195+    INTROSPECTION_GENERATE=
196+    INTROSPECTION_GIRDIR=
197+    INTROSPECTION_TYPELIBDIR=
198+    if test "x$found_introspection" = "xyes"; then
199+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
200+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
201+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
202+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
203+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
204+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
205+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
206+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
207+    fi
208+    AC_SUBST(INTROSPECTION_SCANNER)
209+    AC_SUBST(INTROSPECTION_COMPILER)
210+    AC_SUBST(INTROSPECTION_GENERATE)
211+    AC_SUBST(INTROSPECTION_GIRDIR)
212+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
213+    AC_SUBST(INTROSPECTION_CFLAGS)
214+    AC_SUBST(INTROSPECTION_LIBS)
215+    AC_SUBST(INTROSPECTION_MAKEFILE)
216+
217+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
218+])
219+
220+
221+dnl Usage:
222+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
223+
224+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
225+[
226+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
227+])
228+
229+dnl Usage:
230+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
231+
232+
233+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
234+[
235+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
236+])
237diff --git a/configure.ac b/configure.ac
238index d4f45ea..f56212f 100644
239--- a/configure.ac
240+++ b/configure.ac
241@@ -1067,6 +1067,12 @@ AC_ARG_ENABLE(compat-howl,
242 
243 AM_CONDITIONAL([ENABLE_COMPAT_HOWL], [test "x$ENABLE_COMPAT_HOWL" = "xyes"])
244 
245+#
246+# Introspection support.
247+#
248+AC_CONFIG_MACRO_DIR([common])
249+GOBJECT_INTROSPECTION_CHECK([0.6.7])
250+
251 
252 # ==========================================================================
253 AC_CONFIG_FILES([
254@@ -1127,6 +1133,7 @@ echo "
255     CFLAGS:                                    ${CFLAGS}
256     Enable GLIB:                               ${HAVE_GLIB}
257     Enable GLIB GObject:                       ${HAVE_GOBJECT}
258+    Enable GObject Introspection:              ${HAVE_INTROSPECTION}
259     Enable GTK 2.0:                            ${HAVE_GTK}
260     Enable GTK 3.0:                            ${HAVE_GTK3}
261     Enable D-Bus:                              ${HAVE_DBUS}