From 733dbac3f86b8c7393c9e8a127f4cc09e905785d Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 10 Apr 2013 17:32:26 +0100 Subject: 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] --- .gitignore | 2 ++ Makefile.am | 40 +++++++++++++++++++++++++++++++++++++-- configure.ac | 2 ++ test/smoke-tests/introspection.js | 4 ++++ test/smoke-tests/introspection.py | 4 ++++ 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 test/smoke-tests/introspection.js create mode 100644 test/smoke-tests/introspection.py 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) -- cgit v1.2.3