From: Andrea Zagli <azagli@libero.it>
Date: Sat, 10 Jun 2017 13:21:53 +0000 (+0200)
Subject: Enabled gir.
X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fdevelop;p=reptool%2Flibreptool

Enabled gir.
---

diff --git a/.gitignore b/.gitignore
index 9427155..5196c17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,4 +64,6 @@ Rules-quot
 compile
 gtk-doc.m4
 src/lexycal.yy.[ch]
-src/rptmarshal.[ch]
\ No newline at end of file
+src/rptmarshal.[ch]
+*.gir
+*.typelib
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
index 626cc07..945da81 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
 
 SUBDIRS = src tests docs data
 
diff --git a/configure.ac b/configure.ac
index ac3ad9c..00401d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,8 @@ AC_PROG_LEX
 AC_PROG_LIBTOOL
 GTK_DOC_CHECK
 
+GOBJECT_INTROSPECTION_CHECK([1.30.0])
+
 dnl ******************************
 dnl glib-genmarshal
 dnl ******************************
diff --git a/src/Makefile.am b/src/Makefile.am
index 9bcec28..a71b2f9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,8 +36,7 @@ libreptool_la_SOURCES = \
                         rptprint.c \
                         rptcommon.c
 
-libreptool_include_HEADERS = \
-                  libreptool.h \
+gir_include = \
                   rptmarshal.h \
                   rptobject.h \
                   rptobjecttext.h \
@@ -49,6 +48,10 @@ libreptool_include_HEADERS = \
                   rptprint.h \
                   rptcommon.h
 
+libreptool_include_HEADERS = \
+                  libreptool.h \
+                  $(gir_include)
+
 noinst_HEADERS = \
                  parser.tab.h \
                  lexycal.yy.h \
@@ -64,3 +67,29 @@ libreptool_includedir = $(includedir)/libreptool
 clean-local:
 	-rm -f $(srcdir)/lexycal.yy.*
 	-rm -f $(srcdir)/parser.tab.*
+
+CLEANFILES =
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --accept-unprefixed
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+introspection_sources = $(libreptool_la_SOURCES)
+
+Rpt-1.0.gir: libreptool.la
+Rpt_1_0_gir_INCLUDES = Gtk-3.0 Gda-5.0 libxml2-2.0
+Rpt_1_0_gir_CFLAGS = $(AM_CPPFLAGS)
+Rpt_1_0_gir_LIBS = libreptool.la
+Rpt_1_0_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += Rpt-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif