[gimp] pygimp: require Pycairo in configure, link gimpui against pycairo



commit f29877dcc4282a3790df4ff388c8aacb0a345faf
Author: Kristian Rietveld <kris loopnest org>
Date:   Sun May 1 13:50:09 2016 +0200

    pygimp: require Pycairo in configure, link gimpui against pycairo

 configure.ac                   |    4 ++++
 plug-ins/pygimp/Makefile.am    |    1 +
 plug-ins/pygimp/gimpuimodule.c |   15 +++++++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3545ef2..890282e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ m4_define([alsa_required_version], [1.0.0])
 m4_define([rsvg_required_version], [2.36.0])
 m4_define([wmf_required_version], [0.2.8])
 m4_define([pygtk_required_version], [2.10.4])
+m4_define([pycairo_required_version], [1.0.2])
 m4_define([poppler_required_version], [0.12.4])
 m4_define([poppler_data_required_version], [0.4.7])
 m4_define([libgudev_required_version], [167])
@@ -1906,6 +1907,9 @@ if test "x$enable_python" != xno; then
   AC_SUBST(PYGTK_DEFSDIR)
   AC_MSG_RESULT($PYGTK_DEFSDIR)
 
+  PKG_CHECK_MODULES(PYCAIRO, pycairo >= pycairo_required_version,,
+                    [pycheck_error([PyCairo pycairo_required_version or newer], [it])])
+
   GIMP_DETECT_CFLAGS(PYGIMP_EXTRA_CFLAGS, '-fno-strict-aliasing')
   AC_SUBST(PYGIMP_EXTRA_CFLAGS)
 fi
diff --git a/plug-ins/pygimp/Makefile.am b/plug-ins/pygimp/Makefile.am
index b7092fa..6ac8f1c 100644
--- a/plug-ins/pygimp/Makefile.am
+++ b/plug-ins/pygimp/Makefile.am
@@ -25,6 +25,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)         \
        $(PYTHON_INCLUDES)      \
        $(PYGTK_CFLAGS)         \
+       $(PYCAIRO_CFLAGS)       \
        $(GTK_CFLAGS)           \
        $(GEGL_CFLAGS)
 
diff --git a/plug-ins/pygimp/gimpuimodule.c b/plug-ins/pygimp/gimpuimodule.c
index 20e9fab..a7b6385 100644
--- a/plug-ins/pygimp/gimpuimodule.c
+++ b/plug-ins/pygimp/gimpuimodule.c
@@ -25,6 +25,9 @@
 #include <pygobject.h>
 #include <pygtk/pygtk.h>
 
+#include <pycairo.h>
+Pycairo_CAPI_t *Pycairo_CAPI;
+
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
 
@@ -44,6 +47,16 @@ static char gimpui_doc[] =
 
 void init_gimpui(void);
 
+static gboolean
+init_pycairo(void)
+{
+  Pycairo_IMPORT;
+  if (Pycairo_CAPI == NULL)
+    return FALSE;
+
+  return TRUE;
+}
+
 PyMODINIT_FUNC
 init_gimpui(void)
 {
@@ -66,6 +79,8 @@ init_gimpui(void)
     pygimp_init_pygobject();
 
     init_pygtk();
+    if (!init_pycairo())
+      return;
     init_pygimpcolor();
     init_pygimp();
 


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