summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2013-04-10 17:32:26 +0100
committerP. F. Chimento <philip.chimento@gmail.com>2013-04-17 17:15:52 +0200
commit733dbac3f86b8c7393c9e8a127f4cc09e905785d (patch)
treeef1f1986638f4cd838f1a3f7f4914709c2f33ec0
parent6347c78610a7197e1d0cedd1a4a2136a595b5a67 (diff)
Enable GObject introspection
After running 'make install', run test/smoke-tests/introspection.js (and its Python counterpart) to test whether the GIR has been installed correctly. [#1]
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am40
-rw-r--r--configure.ac2
-rw-r--r--test/smoke-tests/introspection.js4
-rw-r--r--test/smoke-tests/introspection.py4
5 files changed, 50 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 49111f0..a6a5e33 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,8 @@
endless-0.pc
test/run-tests
test/smoke-tests/hello
+Endless-0.gir
+Endless-0.typelib
*.py[cod]
diff --git a/Makefile.am b/Makefile.am
index 8471840..e483381 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,8 +20,9 @@ EXTRA_DIST = @EOS_SDK_API_NAME@.pc.in
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
AM_CFLAGS = @STRICT_CFLAGS@
-# Make sure to run Gtk-doc tests when doing 'make distcheck'
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+# Make sure to run Gtk-doc tests and build the introspection files when doing
+# 'make distcheck'
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
# Generated files that 'make clean' should erase
CLEANFILES =
@@ -43,6 +44,41 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = @EOS_SDK_API_NAME@.pc
DISTCLEANFILES += @EOS_SDK_API_NAME@.pc
+# # # INTROSPECTION FILES # # #
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+introspection_sources = \
+ $(filter-out %-private.h, $(endless_library_sources)) \
+ $(endless_public_installed_headers) \
+ $(endless_private_installed_headers)
+
+Endless-@EOS_SDK_API_VERSION@.gir: libendless-@EOS_SDK_API_VERSION@.la
+Endless_@EOS_SDK_API_VERSION@_gir_INCLUDES = \
+ GObject-2.0 GLib-2.0 Gio-2.0 Gtk-3.0
+Endless_@EOS_SDK_API_VERSION@_gir_SCANNERFLAGS = \
+ --identifier-prefix=Eos \
+ --symbol-prefix=eos \
+ -DCOMPILING_EOS_SDK
+# Endless_@EOS_SDK_API_VERSION@_gir_CFLAGS = $(INCLUDES)
+Endless_@EOS_SDK_API_VERSION@_gir_LIBS = libendless-@EOS_SDK_API_VERSION@.la
+Endless_@EOS_SDK_API_VERSION@_gir_FILES = $(introspection_sources)
+Endless_@EOS_SDK_API_VERSION@_gir_EXPORT_PACKAGES = @EOS_SDK_API_NAME@
+INTROSPECTION_GIRS += Endless-@EOS_SDK_API_VERSION@.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
+
# # # TESTS # # #
include $(top_srcdir)/test/Makefile.am
diff --git a/configure.ac b/configure.ac
index b527bc8..08f32f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,6 +138,8 @@ AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.18.1])
# Gtk-doc; 0.18 required for Markdown parsing
GTK_DOC_CHECK([1.18], [--flavour no-tmpl])
+# GObject Introspection
+GOBJECT_INTROSPECTION_REQUIRE([1.30])
# Required libraries
# ------------------
diff --git a/test/smoke-tests/introspection.js b/test/smoke-tests/introspection.js
new file mode 100644
index 0000000..8197fe7
--- /dev/null
+++ b/test/smoke-tests/introspection.js
@@ -0,0 +1,4 @@
+// Copyright 2013 Endless Mobile, Inc.
+
+const Endless = imports.gi.Endless;
+Endless.hello_sample_function(null);
diff --git a/test/smoke-tests/introspection.py b/test/smoke-tests/introspection.py
new file mode 100644
index 0000000..7870bc1
--- /dev/null
+++ b/test/smoke-tests/introspection.py
@@ -0,0 +1,4 @@
+# Copyright 2013 Endless Mobile, Inc.
+
+from gi.repository import Endless
+Endless.hello_sample_function(None)