summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-07-20 23:17:07 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-07-24 10:57:26 +0100
commite577096dff714266101ba86ac275864b854096a4 (patch)
treef7fbae2b30693c70f1d8b21f5d47707987d16032 /boilerplate
parent0466053099b7f27065267d49c84e9e24bff6c7a1 (diff)
[boilerplate] Fix compilation against old revisions (as old as 1.9.2!)
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/Makefile.am7
-rw-r--r--boilerplate/cairo-boilerplate-pdf.c4
-rw-r--r--boilerplate/cairo-boilerplate-ps.c4
-rw-r--r--boilerplate/cairo-boilerplate-svg.c4
-rw-r--r--boilerplate/cairo-boilerplate-test-surfaces.c31
-rw-r--r--boilerplate/cairo-boilerplate.c10
6 files changed, 44 insertions, 16 deletions
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 3d8339fb0..c8b5d41b6 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -48,8 +48,13 @@ endif
libcairoboilerplate_la_LIBADD += $(CAIROBOILERPLATE_LIBS)
+# we need to workaround the introduction of CC_FOR_BUILD with older builds
make-cairo-boilerplate-constructors$(EXEEXT): make-cairo-boilerplate-constructors.c
- $(CC_FOR_BUILD) $^ -o $@
+ if test -n "$(CC_FOR_BUILD)"; then \
+ $(CC_FOR_BUILD) $^ -o $@; \
+ else \
+ $(CC) $^ -o $@; \
+ fi
cairo-boilerplate-constructors.c: Makefile $(enabled_cairo_boilerplate_sources) make-cairo-boilerplate-constructors$(EXEEXT)
echo '(cd $(srcdir) && $(top_builddir)/boilerplate/make-cairo-boilerplate-constructors$(EXEEXT) $(enabled_cairo_boilerplate_sources)) > $@'
diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c
index e941d46ff..838038af8 100644
--- a/boilerplate/cairo-boilerplate-pdf.c
+++ b/boilerplate/cairo-boilerplate-pdf.c
@@ -30,6 +30,10 @@
#include <cairo-pdf-surface-private.h>
#include <cairo-paginated-surface-private.h>
+#if ! CAIRO_HAS_META_SURFACE
+#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META
+#endif
+
static const cairo_user_data_key_t pdf_closure_key;
typedef struct _pdf_target_closure
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index 40148ddeb..8619e47f8 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -31,6 +31,10 @@
#include <cairo-ps-surface-private.h>
#include <cairo-paginated-surface-private.h>
+#if ! CAIRO_HAS_META_SURFACE
+#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META
+#endif
+
static const cairo_user_data_key_t ps_closure_key;
typedef struct _ps_target_closure {
diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c
index 45e085ce9..56296f46f 100644
--- a/boilerplate/cairo-boilerplate-svg.c
+++ b/boilerplate/cairo-boilerplate-svg.c
@@ -35,6 +35,10 @@
#include <signal.h>
#endif
+#if ! CAIRO_HAS_META_SURFACE
+#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META
+#endif
+
static const cairo_user_data_key_t svg_closure_key;
typedef struct _svg_target_closure {
diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c
index 501866bad..3e7490ec5 100644
--- a/boilerplate/cairo-boilerplate-test-surfaces.c
+++ b/boilerplate/cairo-boilerplate-test-surfaces.c
@@ -28,16 +28,20 @@
#include "cairo-boilerplate-private.h"
+#include <cairo-types-private.h>
+
#include <test-fallback-surface.h>
#include <test-fallback16-surface.h>
+#if CAIRO_HAS_TEST_PAGINATED_SURFACE
#include <test-paginated-surface.h>
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,3)
+#endif
+#if CAIRO_HAS_TEST_NULL_SURFACE
#include <test-null-surface.h>
+#endif
+#if CAIRO_HAS_TEST_WRAPPING_SURFACE
#include <test-wrapping-surface.h>
#endif
-#include <cairo-types-private.h>
-
static cairo_surface_t *
_cairo_boilerplate_test_fallback_create_surface (const char *name,
cairo_content_t content,
@@ -70,6 +74,7 @@ _cairo_boilerplate_test_fallback16_create_surface (const char *name,
ceil (width), ceil (height));
}
+#if CAIRO_HAS_TEST_NULL_SURFACE
static cairo_surface_t *
_cairo_boilerplate_test_null_create_surface (const char *name,
cairo_content_t content,
@@ -82,13 +87,11 @@ _cairo_boilerplate_test_null_create_surface (const char *name,
void **closure)
{
*closure = NULL;
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,3)
return _cairo_test_null_surface_create (content);
-#else
- return NULL;
-#endif
}
+#endif
+#if CAIRO_HAS_TEST_PAGINATED_SURFACE
static const cairo_user_data_key_t test_paginated_closure_key;
typedef struct {
@@ -196,7 +199,9 @@ _cairo_boilerplate_test_paginated_cleanup (void *closure)
cairo_surface_destroy (tpc->target);
free (tpc);
}
+#endif
+#if CAIRO_HAS_TEST_WRAPPING_SURFACE
static cairo_surface_t *
_cairo_boilerplate_test_wrapping_create_surface (const char *name,
cairo_content_t content,
@@ -208,7 +213,6 @@ _cairo_boilerplate_test_wrapping_create_surface (const char *name,
int id,
void **closure)
{
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,3)
cairo_surface_t *target;
cairo_surface_t *surface;
cairo_format_t format;
@@ -221,11 +225,8 @@ _cairo_boilerplate_test_wrapping_create_surface (const char *name,
cairo_surface_destroy (target);
return surface;
-#else
- *closure = NULL;
- return NULL;
-#endif
}
+#endif
static const cairo_boilerplate_target_t targets[] = {
{
@@ -264,6 +265,7 @@ static const cairo_boilerplate_target_t targets[] = {
NULL, /* _cairo_boilerplate_get_image_surface, */
cairo_surface_write_to_png
},
+#if CAIRO_HAS_TEST_PAGINATED_SURFACE
{
"test-paginated", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED,
@@ -288,6 +290,8 @@ static const cairo_boilerplate_target_t targets[] = {
NULL,
FALSE, TRUE
},
+#endif
+#if CAIRO_HAS_TEST_WRAPPING_SURFACE
{
"test-wrapping", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_WRAPPING,
@@ -297,6 +301,8 @@ static const cairo_boilerplate_target_t targets[] = {
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png,
},
+#endif
+#if CAIRO_HAS_TEST_NULL_SURFACE
{
"null", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_NULL,
@@ -307,5 +313,6 @@ static const cairo_boilerplate_target_t targets[] = {
NULL,
TRUE, FALSE
},
+#endif
};
CAIRO_BOILERPLATE (test, targets)
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index a0810457a..f15f7393f 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -129,6 +129,7 @@ _cairo_boilerplate_image_create_surface (const char *name,
return cairo_image_surface_create (format, ceil (width), ceil (height));
}
+#if CAIRO_HAS_META_SURFACE
static cairo_surface_t *
_cairo_boilerplate_meta_create_surface (const char *name,
cairo_content_t content,
@@ -151,8 +152,6 @@ _cairo_boilerplate_meta_create_surface (const char *name,
return cairo_meta_surface_create (content, &extents);
}
-const cairo_user_data_key_t cairo_boilerplate_output_basename_key;
-
#if CAIRO_HAS_SCRIPT_SURFACE
static cairo_status_t
stdio_write (void *closure, const unsigned char *data, unsigned int len)
@@ -163,6 +162,9 @@ stdio_write (void *closure, const unsigned char *data, unsigned int len)
return CAIRO_STATUS_SUCCESS;
}
#endif
+#endif
+
+const cairo_user_data_key_t cairo_boilerplate_output_basename_key;
cairo_surface_t *
_cairo_boilerplate_get_image_surface (cairo_surface_t *src,
@@ -186,7 +188,7 @@ _cairo_boilerplate_get_image_surface (cairo_surface_t *src,
image = cairo_surface_reference (surface);
/* open a logging channel (only interesting for meta surfaces) */
-#if CAIRO_HAS_SCRIPT_SURFACE
+#if CAIRO_HAS_SCRIPT_SURFACE && CAIRO_HAS_META_SURFACE
if (cairo_surface_get_type (src) == CAIRO_SURFACE_TYPE_META) {
const char *test_name;
@@ -307,6 +309,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png
},
+#if CAIRO_HAS_META_SURFACE
{
"meta", "image", NULL, NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR_ALPHA, 0,
@@ -327,6 +330,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
NULL, NULL,
FALSE, TRUE
},
+#endif
};
CAIRO_BOILERPLATE (builtin, builtin_targets)