[evince] Modernize introspection generation



commit be9af3e189201e55a786d2f5c7c728b841c492ef
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Jun 24 16:52:49 2012 +0200

    Modernize introspection generation
    
    Use the m4 macro and makefile snippet provided in gobject-introspection
    directly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678971

 Makefile.am             |    3 +-
 configure.ac            |   34 +++----------------------
 libdocument/Makefile.am |   55 +++++++++++++++-------------------------
 libview/Makefile.am     |   63 ++++++++++++++++++----------------------------
 4 files changed, 52 insertions(+), 103 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index cb6f3bb..4217901 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -94,7 +94,8 @@ DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-gtk-doc \
 	--disable-nautilus \
 	--disable-tests \
-	--disable-silent-rules
+	--disable-silent-rules \
+	--enable-introspection
 
 # Ignore scrollkeeper issues for now.  @#*$& scrollkeeper
 distuninstallcheck_listfiles = find . -type f -print | grep -v scrollkeeper | grep -v /share/gnome/help/ | grep -v \.omf
diff --git a/configure.ac b/configure.ac
index 1c37a33..71d5eda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -446,38 +446,12 @@ AC_SUBST(PREVIEWER_LIBS)
 # GIR
 # ***
 
-AC_MSG_CHECKING([whether GObject introspection is requested])
-AC_ARG_ENABLE([introspection],
-        AS_HELP_STRING([--enable-introspection],
-		       [Enable GObject introspection]),
-       	[enable_introspection=$enableval],
-	[enable_introspection=no])
-AC_MSG_RESULT([$enable_introspection])
-
-G_IR_SCANNER=
-G_IR_COMPILER=
-G_IR_GENERATE=
-GIRDIR=
-GIRTYPELIBDIR=
-
-if test "$enable_introspection" = "yes"; then
-  GOBJECT_INTROSPECTION_REQUIRED=0.6
-  PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],[gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED])
-
-  G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)"
-  G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)"
-  G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)"
-  GIRDIR="$($PKG_CONFIG --variable=girdir gobject-introspection-1.0)"
-  GIRTYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
-fi
-
-AC_SUBST([G_IR_SCANNER])
-AC_SUBST([G_IR_COMPILER])
-AC_SUBST([G_IR_GENERATE])
-AC_SUBST([GIRDIR])
-AC_SUBST([GIRTYPELIBDIR])
-
-AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"])
+# No automagic please!
+if test -z "$enable_introspection"; then
+  enable_introspection=no
+fi
+
+GOBJECT_INTROSPECTION_CHECK([1.0])
 
 dnl ================== portability checks ===========================================
 
diff --git a/libdocument/Makefile.am b/libdocument/Makefile.am
index 0a6000e..957d504 100644
--- a/libdocument/Makefile.am
+++ b/libdocument/Makefile.am
@@ -151,46 +151,33 @@ EXTRA_DIST = \
 
 # GObject Introspection
 
-if ENABLE_INTROSPECTION
-
-EvinceDocument-$(EV_API_VERSION).gir: libevdocument3.la Makefile $(INST_H_SRC_FILES) $(INST_H_BUILT_FILES) $(filter %.c,$(libevdocument3_la_SOURCES)) $(filter %.c,$(nodist_libevdocument3_la_SOURCES))
-	$(AM_V_GEN) PKG_CONFIG_PATH=$(top_builddir):$$PKG_CONFIG_PATH \
-	$(G_IR_SCANNER) -v --namespace EvinceDocument \
-	--strip-prefix=Ev \
-	--nsversion=$(EV_API_VERSION) \
-	--include=GLib-2.0 \
-	--include=Gio-2.0 \
-	--include=Gdk-3.0 \
-	--include=GdkPixbuf-2.0 \
-	--include=Gtk-3.0 \
-	--library=evdocument3 \
-	--libtool="$(LIBTOOL)" \
-	--output $@ \
-	--pkg evince-document-$(EV_API_VERSION) \
-	-I$(top_srcdir) \
-	-I$(top_builddir) \
-	-I$(srcdir) \
-	-I$(builddir) \
-	-DEVINCE_COMPILATION \
-	$(filter %.h,$^) \
-	$(filter %.c,$^)
-
-girdir = $(GIRDIR)
+if HAVE_INTROSPECTION
+
+include $(INTROSPECTION_MAKEFILE)
+EvinceDocument-$(EV_API_VERSION).gir: libevdocument3.la
+EvinceDocument_ EV_API_VERSION_U@_gir_FILES = $(INST_H_SRC_FILES) $(INST_H_BUILT_FILES) $(filter %.c,$(libevdocument3_la_SOURCES))
+EvinceDocument_ EV_API_VERSION_U@_gir_LIBS = libevdocument3.la
+EvinceDocument_ EV_API_VERSION_U@_gir_SCANNERFLAGS = \
+	--identifier-prefix=Ev	\
+	--symbol-prefix=ev
+EvinceDocument_ EV_API_VERSION_U@_gir_INCLUDES = GLib-2.0 Gio-2.0 Gdk-3.0 GdkPixbuf-2.0 Gtk-3.0
+EvinceDocument_ EV_API_VERSION_U@_gir_CFLAGS = \
+	-DEVINCE_COMPILATION	\
+	-I$(top_srcdir)		\
+	-I$(top_builddir)	\
+	-I$(srcdir)		\
+	-I$(builddir)
+EvinceDocument_ EV_API_VERSION_U@_gir_EXPORT_PACKAGES = evince-document-$(EV_API_VERSION)
+INTROSPECTION_GIRS = EvinceDocument-$(EV_API_VERSION).gir
+
+girdir = $(datadir)/gir-1.0
 gir_DATA = EvinceDocument-$(EV_API_VERSION).gir
 
-typelibsdir = $(GIRTYPELIBDIR)
+typelibsdir = $(libdir)/girepository-1.0
 typelibs_DATA = EvinceDocument-$(EV_API_VERSION).typelib
 
-EXTRA_DIST += $(gir_DATA)
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
 
-%.typelib: %.gir
-	$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) \
-	--includedir=$(srcdir) \
-	--includedir=. \
-	$(G_IR_COMPILER_OPTS) \
-	$< -o $@
-
 endif # ENABLE_INTROSPECTION
 
 -include $(top_srcdir)/git.mk
diff --git a/libview/Makefile.am b/libview/Makefile.am
index 65b9f84..7392658 100644
--- a/libview/Makefile.am
+++ b/libview/Makefile.am
@@ -121,50 +121,37 @@ EXTRA_DIST = \
 
 # GObject Introspection
 
-if ENABLE_INTROSPECTION
-
-EvinceView-$(EV_API_VERSION).gir: libevview3.la Makefile $(INST_H_SRC_FILES) $(INST_H_BUILT_FILES) $(filter %.c,$(libevview3_la_SOURCES)) $(filter %.c,$(nodist_libevview3_la_SOURCES))
-	$(AM_V_GEN) PKG_CONFIG_PATH=$(top_builddir):$$PKG_CONFIG_PATH \
-	$(G_IR_SCANNER) -v --namespace EvinceView \
-	--add-include-path=$(top_builddir)/libdocument \
-	--strip-prefix=Ev \
-	--nsversion=$(EV_API_VERSION) \
-	--include=GLib-2.0 \
-	--include=GObject-2.0 \
-	--include=Gio-2.0 \
-	--include=Gdk-3.0 \
-	--include=GdkPixbuf-2.0 \
-	--include=Gtk-3.0 \
-	--include=EvinceDocument-$(EV_API_VERSION) \
-	--library=$(top_builddir)/libdocument/libevdocument3.la \
-	--library=evview3 \
-	--libtool="$(LIBTOOL)" \
-	--output $@ \
-	--pkg evince-document-$(EV_API_VERSION) \
-	--pkg evince-view-$(EV_API_VERSION) \
-	-L$(top_builddir)/libdocument/ \
-	-I$(top_srcdir) \
-	-I$(top_builddir) \
-	-DEVINCE_COMPILATION \
-	$(filter %.h,$^) \
-	$(filter %.c,$^)
-
-girdir = $(GIRDIR)
+if HAVE_INTROSPECTION
+
+include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/libdocument
+
+EvinceView-$(EV_API_VERSION).gir: libevview3.la
+EvinceView_ EV_API_VERSION_U@_gir_FILES = \
+	$(INST_H_SRC_FILES)	\
+	$(INST_H_BUILT_FILES)	\
+	 $(filter %.c,$(libevview3_la_SOURCES))
+EvinceView_ EV_API_VERSION_U@_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0 Gdk-3.0 GdkPixbuf-2.0 Gtk-3.0 EvinceDocument-$(EV_API_VERSION)
+EvinceView_ EV_API_VERSION_U@_gir_LIBS = libevview3.la
+EvinceView_ EV_API_VERSION_U@_gir_CFLAGS = \
+	-I$(top_srcdir)		\
+	 -I$(top_builddir)	\
+	 -DEVINCE_COMPILATION
+EvinceView_ EV_API_VERSION_U@_gir_EXPORT_PACKAGES = evince-view-$(EV_API_VERSION)
+EvinceView_ EV_API_VERSION_U@_gir_SCANNERFLAGS = \
+	--add-include-path=$(top_builddir)/libdocument	\
+	--identifier-prefix=Ev				\
+	--symbol-prefix=ev
+INTROSPECTION_GIRS = EvinceView-$(EV_API_VERSION).gir
+
+girdir = $(datadir)/gir-1.0
 gir_DATA = EvinceView-$(EV_API_VERSION).gir
 
-typelibsdir = $(GIRTYPELIBDIR)
+typelibsdir = $(libdir)/girepository-1.0
 typelibs_DATA = EvinceView-$(EV_API_VERSION).typelib
 
-EXTRA_DIST += $(gir_DATA)
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
 
-%.typelib: %.gir
-	$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) \
-	--includedir=$(srcdir) \
-	--includedir=$(top_builddir)/libdocument \
-	$(G_IR_COMPILER_OPTS) \
-	$< -o $@
-
 endif # ENABLE_INTROSPECTION
 
 -include $(top_srcdir)/git.mk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]