[Libosinfo] [libosinfo 1/2] Switch to using Makefile.introspection

Christophe Fergeau cfergeau at redhat.com
Wed Dec 18 15:18:44 UTC 2013


From: Ryan Lortie <desrt at desrt.ca>

Switch to using the upstream m4 macros for GObject-introspection
integration.

https://fedorahosted.org/libosinfo/ticket/11
---
 configure.ac       | 25 +------------------------
 osinfo/Makefile.am | 52 +++++++++++++++++++---------------------------------
 2 files changed, 20 insertions(+), 57 deletions(-)

diff --git a/configure.ac b/configure.ac
index aed1029..821be83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,30 +99,7 @@ esac
 AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
 
 
-AC_ARG_ENABLE([introspection],
-        AS_HELP_STRING([--enable-introspection], [enable GObject introspection]),
-        [], [enable_introspection=check])
-
-if test "x$enable_introspection" != "xno" ; then
-        PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
-                          [gobject-introspection-1.0 >= 0.9.0],
-                          [enable_introspection=yes],
-                          [
-                             if test "x$enable_introspection" = "xcheck"; then
-                               enable_introspection=no
-                             else
-                               AC_MSG_ERROR([gobject-introspection is not available])
-                             fi
-                          ])
-        if test "x$enable_introspection" = "xyes" ; then
-          AC_DEFINE([WITH_GOBJECT_INTROSPECTION], [1], [enable GObject introspection support])
-          AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
-          AC_SUBST(GOBJECT_INTROSPECTION_LIBS)
-          AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
-          AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
-        fi
-fi
-AM_CONDITIONAL([WITH_GOBJECT_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
+GOBJECT_INTROSPECTION_CHECK([0.9.7])
 
 AC_ARG_ENABLE([vala],
               AS_HELP_STRING([--enable-vala], [enable Vala binding generation]),
diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index 80fa1e2..20b6a02 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -167,42 +167,28 @@ EXTRA_DIST += check-symfile.pl check-symsorting.pl
 
 check-local: check-symfile check-symsorting
 
-if WITH_GOBJECT_INTROSPECTION
-
-Libosinfo-1.0.gir: libosinfo-1.0.la $(G_IR_SCANNER) Makefile.am
-	$(AM_V_GEN)$(G_IR_SCANNER) --quiet \
-		--namespace Libosinfo \
-		--nsversion 1.0 \
-		--include GObject-2.0 \
-		--include Gio-2.0 \
-		--include libxml2-2.0 \
-		--c-include="osinfo/osinfo.h" \
-		--pkg-export=libosinfo-1.0 \
-		--identifier-prefix=Osinfo \
-		--symbol-prefix=osinfo \
-		--library=$(builddir)/libosinfo-1.0.la \
-		--output $@ \
-		-I$(top_srcdir) \
-		-I$(srcdir) \
-		--verbose \
-		--pkg=gobject-2.0 \
-		--pkg=gio-2.0 \
-		--pkg=libxml-2.0 \
-		--pkg=libxslt \
-		$(libosinfo_1_0_include_HEADERS:%=$(srcdir)/%) \
-		$(libosinfo_1_0_la_SOURCES:%=$(srcdir)/%)
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+CLEANFILES =
+
+if HAVE_INTROSPECTION
+Libosinfo-1.0.gir: libosinfo-1.0.la
+Libosinfo_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0
+Libosinfo_1_0_gir_PACKAGES = gobject-2.0 gio-2.0 libxml-2.0 libxslt
+Libosinfo_1_0_gir_EXPORT_PACKAGES = libosinfo-1.0
+Libosinfo_1_0_gir_LIBS = libosinfo-1.0.la
+Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES)
+Libosinfo_1_0_gir_CFLAGS = $(libosinfo_1_0_la_CFLAGS)
+Libosinfo_1_0_gir_SCANNERFLAGS = --identifier-prefix=Osinfo --symbol-prefix=osinfo --c-include="osinfo/osinfo.h"
+INTROSPECTION_GIRS += Libosinfo-1.0.gir
 
 girdir = $(datadir)/gir-1.0
 gir_DATA = Libosinfo-1.0.gir
 
-typelibsdir = $(libdir)/girepository-1.0
-typelibs_DATA = Libosinfo-1.0.typelib
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = Libosinfo-1.0.typelib
 
-%.typelib: %.gir
-	$(AM_V_GEN)$(G_IR_COMPILER) \
-		--includedir=$(builddir) \
-		--includedir=$(girdir) \
-		-o $@ $<
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
 
 if WITH_VALA
 vapidir = $(datadir)/vala/vapi
@@ -218,6 +204,6 @@ libosinfo-1.0.vapi: Libosinfo-1.0.gir Libosinfo-1.0.typelib
 
 endif # WITH_VALA
 
-CLEANFILES = $(gir_DATA) $(typelibs_DATA) $(vapi_DATA) $(wildcard *.gcno)
+CLEANFILES += $(gir_DATA) $(typelibs_DATA) $(vapi_DATA) $(wildcard *.gcno)
 
-endif # WITH_GOBJECT_INTROSPECTION
+endif # HAVE_INTROSPECTION
-- 
1.8.4.2




More information about the Libosinfo mailing list