[dia/dia-0-97] cairo: do not compile cairo plugin if '--without-cairo' is defined.



commit ad54cac7c3f62edc5a8f003aa7a48fd998cda39e
Author: Gokturk Yuksek <gokturk binghamton edu>
Date:   Fri May 9 15:30:08 2014 -0400

    cairo: do not compile cairo plugin if '--without-cairo' is defined.
    
    Passing '--without-cairo' option to the build system disables
    the inclusion of cairo header files but does not prevent the
    code from building. As a result the compilation fails with
    'implicit declaration of function' errors.
    
    To fix this, modify the Makefile.am so that it does not compile
    the plugin if '--without-cairo' is defined. Note that this
    option must be passed by the user explicitly as the build system
    will always detect libcairo on the system since GTK depends on it.
    
    See: https://bugzilla.gnome.org/show_bug.cgi?id=729668
    See: https://bugs.gentoo.org/show_bug.cgi?id=509636
    
    Signed-off-by: Gokturk Yuksek <gokturk binghamton edu>
    (cherry picked from commit ceb7265b65ed969698c358a850f8ff3ad42cc9d5)
    
    Conflicts:
        plug-ins/cairo/diacairo-renderer.c
        plug-ins/cairo/diacairo.c

 plug-ins/cairo/Makefile.am         |    5 +++-
 plug-ins/cairo/diacairo-renderer.c |   39 ++++++++-------------------
 plug-ins/cairo/diacairo.c          |   51 ++++++++++++++----------------------
 3 files changed, 36 insertions(+), 59 deletions(-)
---
diff --git a/plug-ins/cairo/Makefile.am b/plug-ins/cairo/Makefile.am
index c0c3ef7..d94afb6 100644
--- a/plug-ins/cairo/Makefile.am
+++ b/plug-ins/cairo/Makefile.am
@@ -1,4 +1,4 @@
-
+if WITH_CAIRO
 plugin_sources = \
        diacairo.c \
        diacairo.h \
@@ -6,6 +6,9 @@ plugin_sources = \
        diacairo-renderer.c \
        diacairo-print.c \
        diacairo-print.h 
+else
+plugin_sources = 
+endif
 
 pkglib_LTLIBRARIES = libcairo_filter.la
 
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index 5839deb..0b981ba 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -34,33 +34,18 @@
 #include <pango/pangocairo.h>
 #endif
 
-/*
- * To me the following looks rather suspicious. Why do we need to compile
- * the Cairo plug-in at all if we don't have Cairo? As a result we'll
- * show it in the menus/plugin details and the user expects something
- * although there isn't any functionality behind it. Urgh.
- *
- * With Gtk+-2.7.x cairo must be available so this becomes even more ugly
- * when the user has choosen to not build the diacairo plug-in. If noone
- * can come up with a convincing reason to do it this way I'll probably
- * go back to the dont-build-at-all approach when it breaks the next time.
- *                                                                    --hb 
- */
-#ifdef HAVE_CAIRO
-#  include <cairo.h>
-/* some backend headers, win32 missing in official Cairo */
-#  ifdef CAIRO_HAS_PNG_SURFACE_FEATURE
-#  include <cairo-png.h>
-#  endif
-#  ifdef  CAIRO_HAS_PS_SURFACE
-#  include <cairo-ps.h>
-#  endif
-#  ifdef  CAIRO_HAS_PDF_SURFACE
-#  include <cairo-pdf.h>
-#  endif
-#  ifdef CAIRO_HAS_SVG_SURFACE
-#  include <cairo-svg.h>
-#  endif
+#include <cairo.h>
+#ifdef CAIRO_HAS_PNG_SURFACE_FEATURE
+#include <cairo-png.h>
+#endif
+#ifdef  CAIRO_HAS_PS_SURFACE
+#include <cairo-ps.h>
+#endif
+#ifdef  CAIRO_HAS_PDF_SURFACE
+#include <cairo-pdf.h>
+#endif
+#ifdef CAIRO_HAS_SVG_SURFACE
+#include <cairo-svg.h>
 #endif
 
 #include "intl.h"
diff --git a/plug-ins/cairo/diacairo.c b/plug-ins/cairo/diacairo.c
index 2075a58..22d5295 100644
--- a/plug-ins/cairo/diacairo.c
+++ b/plug-ins/cairo/diacairo.c
@@ -30,38 +30,27 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-/*
- * To me the following looks rather suspicious. Why do we need to compile
- * the Cairo plug-in at all if we don't have Cairo? As a result we'll
- * show it in the menus/plugin details and the user expects something
- * although there isn't any functionality behind it. Urgh.
- *
- * With Gtk+-2.7.x cairo must be available so this becomes even more ugly
- * when the user has choosen to not build the diacairo plug-in. If noone
- * can come up with a convincing reason to do it this way I'll probably
- * go back to the dont-build-at-all approach when it breaks the next time.
- *                                                                    --hb 
- */
-#ifdef HAVE_CAIRO
-#  include <cairo.h>
+#include <cairo.h>
 /* some backend headers, win32 missing in official Cairo */
-#  ifdef CAIRO_HAS_PNG_SURFACE_FEATURE
-#  include <cairo-png.h>
-#  endif
-#  ifdef  CAIRO_HAS_PS_SURFACE
-#  include <cairo-ps.h>
-#  endif
-#  ifdef  CAIRO_HAS_PDF_SURFACE
-#  include <cairo-pdf.h>
-#  endif
-#  ifdef CAIRO_HAS_SVG_SURFACE
-#  include <cairo-svg.h>
-#  endif
-#  ifdef CAIRO_HAS_WIN32_SURFACE
-#  include <cairo-win32.h>
-   /* avoid namespace collisions */
-#  define Rectangle RectangleWin32
-#  endif
+#ifdef CAIRO_HAS_PNG_SURFACE_FEATURE
+#include <cairo-png.h>
+#endif
+#ifdef  CAIRO_HAS_PS_SURFACE
+#include <cairo-ps.h>
+#endif
+#ifdef  CAIRO_HAS_PDF_SURFACE
+#include <cairo-pdf.h>
+#endif
+#ifdef CAIRO_HAS_SVG_SURFACE
+#include <cairo-svg.h>
+#endif
+#ifdef CAIRO_HAS_WIN32_SURFACE
+#include <cairo-win32.h>
+/* avoid namespace collisions */
+#define Rectangle RectangleWin32
+#endif
+#ifdef CAIRO_HAS_SCRIPT_SURFACE
+#include <cairo-script.h>
 #endif
 
 #ifdef HAVE_PANGOCAIRO_H


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