[gegl-gtk] Add GObject Introspection support to build
- From: Jon Nordby <jonnor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl-gtk] Add GObject Introspection support to build
- Date: Thu, 23 Jun 2011 20:21:39 +0000 (UTC)
commit 80ca71f544da1fe6f93bb02a3695b0665522723e
Author: Jon Nordby <jononor gmail com>
Date: Thu Jun 23 21:46:56 2011 +0200
Add GObject Introspection support to build
gegl-gtk/.gitignore | 2 +
gegl-gtk/Makefile.am | 40 ++++++++++++++++++++-
m4/introspection.m4 | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 134 insertions(+), 2 deletions(-)
---
diff --git a/gegl-gtk/.gitignore b/gegl-gtk/.gitignore
new file mode 100644
index 0000000..5947602
--- /dev/null
+++ b/gegl-gtk/.gitignore
@@ -0,0 +1,2 @@
+*.gir
+*.typelib
diff --git a/gegl-gtk/Makefile.am b/gegl-gtk/Makefile.am
index a61311e..71236e0 100644
--- a/gegl-gtk/Makefile.am
+++ b/gegl-gtk/Makefile.am
@@ -1,12 +1,15 @@
+CLEANFILES =
headers = gegl-gtk.h gegl-gtk-view.h
+sources = gegl-gtk-view.c
+INCLUDES = $(GTK_CFLAGS) $(GEGL_CFLAGS)
gegl_gtk_includedir=$(includedir)/gegl-gtk$(GEGL_GTK_GTK_VERSION)-$(GEGL_GTK_API_VERSION)
gegl_gtk_include_HEADERS = $(headers)
-gegl_gtk_SOURCES = $(headers) gegl-gtk-view.c
+gegl_gtk_SOURCES = $(headers) $(sources)
gegl_gtk_LIBADD = $(GTK_LIBS) $(GEGL_LIBS)
-gegl_gtk_CFLAGS = $(GTK_CFLAGS) $(GEGL_CFLAGS)
+gegl_gtk_CFLAGS = $(INCLUDES)
if HAVE_GTK2
lib_LTLIBRARIES = libgegl-gtk2-0.1.la
@@ -21,3 +24,36 @@ libgegl_gtk3_0_1_la_CFLAGS = $(gegl_gtk_CFLAGS)
libgegl_gtk3_0_1_la_LDFLAGS = $(gegl_gtk_LDFLAGS) -version-info $(GEGL_GTK_LIBRARY_VERSION)
libgegl_gtk3_0_1_la_SOURCES = $(gegl_gtk_SOURCES)
endif
+
+### GObject introspection
+-include $(INTROSPECTION_MAKEFILE)
+
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path="$(srcdir)" --add-include-path="$(shell $(PKG_CONFIG) --define-variable=datadir="$(datadir)" --variable=girdir gobject-introspection-1.0)" --identifier-prefix=GeglGtk --symbol-prefix=gegl_gtk
+INTROSPECTION_COMPILER_ARGS = --includedir="$(srcdir)" --includedir="$(shell $(PKG_CONFIG) --define-variable=datadir="$(datadir)" --variable=girdir gobject-introspection-1.0)"
+
+if HAVE_INTROSPECTION
+
+GeglGtk GEGL_GTK_GTK_VERSION@- GEGL_GTK_API_VERSION@.gir: libgegl-gtk GEGL_GTK_GTK_VERSION@- GEGL_GTK_API_VERSION@.la Makefile
+
+GeglGtk GEGL_GTK_GTK_VERSION@_0_1_gir_CFLAGS = $(INCLUDES)
+GeglGtk GEGL_GTK_GTK_VERSION@_0_1_gir_FILES = $(sources) $(headers)
+GeglGtk GEGL_GTK_GTK_VERSION@_0_1_gir_LIBS = libgegl-gtk GEGL_GTK_GTK_VERSION@- GEGL_GTK_API_VERSION@.la
+
+if HAVE_GTK2
+GeglGtk GEGL_GTK_GTK_VERSION@_0_1_gir_INCLUDES = Gtk-2.0 Gegl-0.1 Babl-0.1
+else
+GeglGtk GEGL_GTK_GTK_VERSION@_0_1_gir_INCLUDES = Gtk-3.0 Gegl-0.1 Babl-0.1
+endif
+
+INTROSPECTION_GIRS += GeglGtk GEGL_GTK_GTK_VERSION@- GEGL_GTK_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
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..589721c
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,94 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+ dnl enable/disable introspection
+ m4_if([$2], [require],
+ [dnl
+ enable_introspection=yes
+ ],[dnl
+ AC_ARG_ENABLE(introspection,
+ AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+ [Enable introspection for this build]),,
+ [enable_introspection=auto])
+ ])dnl
+
+ AC_MSG_CHECKING([for gobject-introspection])
+
+ dnl presence/version checking
+ AS_CASE([$enable_introspection],
+ [no], [dnl
+ found_introspection="no (disabled, use --enable-introspection to enable)"
+ ],dnl
+ [yes],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+ AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+ found_introspection=yes,
+ AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+ ],dnl
+ [auto],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+ ],dnl
+ [dnl
+ AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+ ])dnl
+
+ AC_MSG_RESULT([$found_introspection])
+
+ INTROSPECTION_SCANNER=
+ INTROSPECTION_COMPILER=
+ INTROSPECTION_GENERATE=
+ INTROSPECTION_GIRDIR=
+ INTROSPECTION_TYPELIBDIR=
+ if test "x$found_introspection" = "xyes"; then
+ INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+ INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+ INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+ INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+ INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+ INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+ INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+ fi
+ AC_SUBST(INTROSPECTION_SCANNER)
+ AC_SUBST(INTROSPECTION_COMPILER)
+ AC_SUBST(INTROSPECTION_GENERATE)
+ AC_SUBST(INTROSPECTION_GIRDIR)
+ AC_SUBST(INTROSPECTION_TYPELIBDIR)
+ AC_SUBST(INTROSPECTION_CFLAGS)
+ AC_SUBST(INTROSPECTION_LIBS)
+ AC_SUBST(INTROSPECTION_MAKEFILE)
+
+ AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]