[goffice] Enhance Introspection build support.



commit d586b8a706442921516217dc905d301cdfadeed0
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat May 19 13:43:54 2012 +0200

    Enhance Introspection build support.

 ChangeLog           |    6 ++++++
 Makefile.am         |    5 ++++-
 configure.in        |   43 ++++++++++++++++++++++++++++---------------
 goffice/Makefile.am |   14 +++++++-------
 4 files changed, 45 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ecb508d..af29fd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-19  Jean Brefort  <jean brefort normalesup org>
+
+	* Makefile.am: enhance Introspection build support.
+	* configure.in: ditto.
+	* goffice/Makefile.am: ditto.
+
 2012-05-18  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/canvas/goc-canvas.c (goc_canvas_init): enable scroll events.
diff --git a/Makefile.am b/Makefile.am
index 20a40d7..f1c8c16 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,10 @@ EXTRA_DIST = README NEWS BUGS MAINTAINERS AUTHORS \
 
 DISTCLEANFILES = intltool-extract intltool-merge intltool-update
 
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc \
+	--enable-introspection=auto \
+	--with-gir-dir=\$${datadir}/gir-1.0 \
+	--with-typelib-dir=\$${libdir}/girepository-1.0
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgoffice- GOFFICE_API_VER@.pc
diff --git a/configure.in b/configure.in
index 03f8bae..87a591f 100644
--- a/configure.in
+++ b/configure.in
@@ -39,6 +39,7 @@ AC_SUBST([VERSION_IFACE], [version_iface])
 dnl Almost like epoch.major but development versions look forward to the next
 dnl stable release.
 AC_SUBST([GOFFICE_API_VER], [0.10])
+AC_SUBST([GOFFICE_API_VER_], [0_10])
 
 dnl This one is created by autoheader, ...
 AC_CONFIG_HEADERS(goffice/goffice-config.h)
@@ -651,21 +652,33 @@ AC_SUBST(EXTRA_INCLUDES)
 AC_SUBST(EXTRA_DEPS)
 
 # GObject Introspection
-have_introspection=false
-PKG_CHECK_MODULES(INTROSPECTION, gobject-introspection-1.0 >= 1.31.10, have_introspection=true, have_introspection=false)
-AM_CONDITIONAL(HAVE_INTROSPECTION, $have_introspection)
-
-G_IR_SCANNER=
-G_IR_COMPILER=
-G_IR_GENERATE=
-if $have_introspection; then
-   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`
-fi
-AC_SUBST(G_IR_SCANNER)
-AC_SUBST(G_IR_COMPILER)
-AC_SUBST(G_IR_GENERATE)
+
+GOBJECT_INTROSPECTION_CHECK(1.0)
+dnl we need to change the install directories for distcheck
+AC_ARG_WITH([gir-dir],
+	AS_HELP_STRING(
+		[--with-gir-dir],
+		[
+		 path to gir repository
+		 (automatically detected via pkg-config)
+		]
+	),
+	[GIRDIR=$withval],
+	[GIRDIR=$INTROSPECTION_GIRDIR]
+)
+AC_SUBST(GIRDIR)
+AC_ARG_WITH([typelib-dir],
+	AS_HELP_STRING(
+		[--with-typelib-dir],
+		[
+		 path to typelibs repository
+		 (automatically detected via pkg-config)
+		]
+	),
+	[TYPELIBDIR=$withval],
+	[TYPELIBDIR=$INTROSPECTION_TYPELIBDIR]
+)
+AC_SUBST(TYPELIBDIR)
 
 dnl ******************
 dnl * Config defaults
diff --git a/goffice/Makefile.am b/goffice/Makefile.am
index f1ce62d..7f59682 100644
--- a/goffice/Makefile.am
+++ b/goffice/Makefile.am
@@ -136,8 +136,8 @@ BUILT_GIRSOURCES = \
 
 GOffice- GOFFICE_API_VER@.gir: list_of_sources
 GOffice- GOFFICE_API_VER@.gir: libgoffice- GOFFICE_API_VER@.la
-GOffice- GOFFICE_API_VER@.gir: $(G_IR_SCANNER)
-	$(AM_V_GEN) $(G_IR_SCANNER) -v --namespace GOffice \
+GOffice- GOFFICE_API_VER@.gir: $(INTROSPECTION_SCANNER)
+	$(AM_V_GEN) $(INTROSPECTION_SCANNER) -v --namespace GOffice \
 	    --nsversion="@GOFFICE_API_VER@" \
 	    --add-include-path=$(srcdir) --add-include-path=. \
 	    --include=GObject-2.0 \
@@ -158,19 +158,19 @@ GOffice- GOFFICE_API_VER@.gir: $(G_IR_SCANNER)
 	    --output $@ \
 	    --pkg libgsf-1 \
 	    -I$(top_srcdir) \
-	    `cat $(srcdir)/list_of_sources`
+	    `perl -pe "s{^}{$(srcdir)/}" $(builddir)/list_of_sources`
 
 if HAVE_INTROSPECTION
 
-girdir = $(datadir)/gir-1.0
+girdir = $(GIRDIR)
 gir_DATA = $(BUILT_GIRSOURCES)
 
-typelibsdir = $(libdir)/girepository-1.0
+typelibsdir = $(TYPELIBDIR)
 typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
 
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
 
-%.typelib: %.gir $(G_IR_COMPILER)
-	$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) --includedir=$(srcdir) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $(builddir)/$(@F)
+%.typelib: %.gir $(INTROSPECTION_COMPILER)
+	$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $(builddir)/$(@F)
 
 endif # HAVE_INTROSPECTION



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