[libpeas] Autotools should use system introspection macros



commit 987bef48037f7875d5f1e4c8280fd54c2fbed588
Author: Å?ukasz JernaÅ? <deejay1 srem org>
Date:   Fri Apr 23 09:13:23 2010 +0200

    Autotools should use system introspection macros
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=616277

 Makefile.am           |    2 +-
 configure.ac          |   60 +-----------------------------------------------
 libpeas/Makefile.am   |   37 +++++++++++++++--------------
 libpeasui/Makefile.am |   50 ++++++++++++++++++----------------------
 4 files changed, 44 insertions(+), 105 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b36bfb0..9e19f08 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 ACLOCAL_AMFLAGS = -I m4
-DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-introspection
 
 SUBDIRS = libpeas libpeasui loaders data peas-demo po docs
diff --git a/configure.ac b/configure.ac
index 33bb698..a4dc89a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)
+AC_PREREQ(2.62)
 
 m4_define(peas_major_version,  2)
 m4_define(peas_minor_version, 29)
@@ -108,63 +108,7 @@ dnl ================================================================
 dnl GObject Introspection
 dnl ================================================================
 
-GOBJECT_INTROSPECTION_REQUIRED=0.6.5
-
-AC_ARG_ENABLE(introspection,
-	      AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], [Enable GObject introspection]),
-	      [enable_introspection=$enableval],
-	      [enable_introspection=auto])
-
-AC_ARG_WITH(girdir,
-	    AS_HELP_STRING([--with-girdir=DIR],[Installation path for .gir files @<:@auto@:>@]),
-            [ac_with_girdir=$withval],
-            [ac_with_girdir=""])
-
-AC_ARG_WITH(typelibdir,
-            AS_HELP_STRING([--with-typelibdir=DIR],[Installation path for .typelib files @<:@auto@:>@]),
-            [ac_with_typelibdir=$withval],
-            [ac_with_typelibdir=""])
-
-AC_MSG_CHECKING([for GObject introspection availabilty.])
-
-if test "x$enable_introspection" = "xno"; then
-	found_introspection="no (disabled, use --enable-introspection to enable)"
-elif test "x$enable_introspection" = "xyes"; then
-	PKG_CHECK_EXISTS([gobject-introspection-1.0],,
-			 AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
-	PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED],
-			 [found_introspection=yes],
-			 AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build libpeas]))
-else
-	PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED],
-			 [found_introspection=yes],
-			 [found_introspection=no])
-fi
-
-AC_MSG_RESULT([$found_introspection])
-
-if test "x$found_introspection" = "xyes"; then
-	G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-	AC_SUBST(G_IR_SCANNER)
-	G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-	AC_SUBST(G_IR_COMPILER)
-	G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
-	AC_SUBST(G_IR_GENERATE)
-
-	test "${ac_with_girdir}" = "" && ac_with_girdir=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
-	girdir=$ac_with_girdir
-	AC_MSG_NOTICE([installing .gir files in $girdir])
-	AC_SUBST(girdir)
-
-	test "${ac_with_typelibdir}" = "" && ac_with_typelibdir="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
-	typelibdir=$ac_with_typelibdir
-	AC_MSG_NOTICE([installing .typelib files in $typelibdir])
-	AC_SUBST(typelibdir)
-
-	AC_DEFINE(ENABLE_INTROSPECTION,1,[Define to compile with GObject Introspection support])
-fi
-
-AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "x$found_introspection" = "xyes"])
+GOBJECT_INTROSPECTION_CHECK([0.6.7])
 
 dnl ================================================================
 dnl Seed Javascript Engine
diff --git a/libpeas/Makefile.am b/libpeas/Makefile.am
index 199651f..ad90536 100644
--- a/libpeas/Makefile.am
+++ b/libpeas/Makefile.am
@@ -1,3 +1,8 @@
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
 lib_LTLIBRARIES = libpeas-2.0.la
 
 INCLUDES =								\
@@ -45,28 +50,24 @@ libpeas_2_0_la_SOURCES = 	\
 headerdir = $(prefix)/include/libpeas-2.0/libpeas
 header_DATA = $(INST_H_FILES)
 
-if ENABLE_INTROSPECTION
-gir_DATA = Peas-2.0.gir
-typelib_DATA = Peas-2.0.typelib
+if HAVE_INTROSPECTION
+  introspection_sources = $(libpeas_2_0_la_SOURCES)
+
+  Peas-2.0.gir: libpeas-2.0.la
+  Peas_2_0_gir_INCLUDES = GObject-2.0 Gtk-2.0
+  Peas_2_0_gir_CFLAGS = $(PEAS_CFLAGS)
+  Peas_2_0_gir_LIBS = libpeas-2.0.la
+  Peas_2_0_gir_FILES = $(addprefix $(srcdir)/,$(introspection_sources))
+  INTROSPECTION_GIRS += Peas-2.0.gir
 
-Peas-2.0.gir: $(G_IR_SCANNER) libpeas-2.0.la Makefile
-	$(AM_V_GEN) $(G_IR_SCANNER)			\
-		--namespace=Peas				\
-		--nsversion=2.0				\
-		--library=peas-2.0			\
-		--include=GObject-2.0			\
-		--include=Gtk-2.0			\
-		--libtool="$(LIBTOOL)"			\
-		$(PEAS_CFLAGS)				\
-		$(addprefix $(srcdir)/,$(INST_H_FILES)) \
-		$(addprefix $(srcdir)/,$(C_FILES)) 	\
-		-o $@
+  girdir = $(datadir)/gir-1.0
+  dist_gir_DATA = $(INTROSPECTION_GIRS)
 
-Peas-2.0.typelib: $(gir_DATA) $(G_IR_COMPILER)
-	$(AM_V_GEN) $(G_IR_COMPILER) $<	-o $@ --shared-library=libpeas-2.0
+  typelibdir = $(libdir)/girepository-1.0
+  typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 CLEANFILES = \
-	$(gir_DATA)		\
+	$(dist_gir_DATA)		\
 	$(typelib_DATA)
 
 endif
diff --git a/libpeasui/Makefile.am b/libpeasui/Makefile.am
index 405d08c..a6503f9 100644
--- a/libpeasui/Makefile.am
+++ b/libpeasui/Makefile.am
@@ -1,3 +1,9 @@
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/libpeas
+
+
 lib_LTLIBRARIES = libpeasui-2.0.la
 
 INCLUDES = \
@@ -31,33 +37,21 @@ libpeasui_2_0_la_SOURCES = \
 headerdir = $(prefix)/include/libpeas-2.0/libpeasui
 header_DATA = $(INST_H_FILES)
 
-if ENABLE_INTROSPECTION
-gir_DATA = PeasUI-2.0.gir
-typelib_DATA = PeasUI-2.0.typelib
-
-PeasUI-2.0.gir: $(G_IR_SCANNER) libpeasui-2.0.la Makefile
-	$(AM_V_GEN) $(G_IR_SCANNER)			\
-		--namespace=PeasUI			\
-		--nsversion=2.0				\
-		-I$(top_srcdir)				\
-		--add-include-path=$(top_builddir)/libpeas \
-		--include=GObject-2.0			\
-		--include=Gtk-2.0			\
-		--include=Peas-2.0			\
-		--libtool="$(LIBTOOL)"			\
-		--library=peasui-2.0			\
-		--library=$(top_builddir)/libpeas/libpeas-2.0.la	\
-		$(PEAS_CFLAGS)				\
-		$(PEASUI_CFLAGS)			\
-		$(addprefix $(srcdir)/,$(INST_H_FILES)) \
-		$(addprefix $(srcdir)/,$(C_FILES)) 	\
-		-o $@
-
-PeasUI-2.0.typelib: $(gir_DATA) $(G_IR_COMPILER)
-	$(AM_V_GEN) $(G_IR_COMPILER) --includedir=$(top_builddir)/libpeas $<	-o $@ --shared-library=libpeasui-2.0
-
-CLEANFILES = \
-	$(gir_DATA)		\
-	$(typelib_DATA)
+if HAVE_INTROSPECTION
+  introspection_sources = $(libpeasui_2_0_la_SOURCES)
+
+  PeasuUI-2.0.gir: libpeasui-2.0.la
+  PeasUI_2_0_gir_INCLUDES = GObject-2.0 Gtk-2.0 Peas-2.0
+  PeasUI_2_0_gir_CFLAGS = $(PEAS_CFLAGS) $(PEASUI_CFLAGS)
+  PeasUI_2_0_gir_LIBS = libpeasui-2.0.la
+  PeasUI_2_0_gir_FILES = $(addprefix $(srcdir)/,$(introspection_sources))
+  INTROSPECTION_GIRS += PeasUI-2.0.gir
+
+  girdir = $(datadir)/gir-1.0 ../libpeas
+  dist_gir_DATA = $(INTROSPECTION_GIRS)
+
+  typelibdir = $(libdir)/girepository-1.0
+  typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
+  CLEANFILES = $(dist_gir_DATA) $(typelib_DATA)
 endif



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