cairo: fix recipe...

This commit is contained in:
Adrien Destugues
2014-10-06 18:08:43 +02:00
parent b4ae54358d
commit 8f97c2f274
4 changed files with 25 additions and 497 deletions

View File

@@ -53,6 +53,7 @@ REQUIRES="
# required by fontconfig
lib:libbz2$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libgcc_s$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
@@ -79,6 +80,7 @@ BUILD_PREREQUIRES="
BUILD()
{
autoreconf -fi
export CFLAGS=-D__BSD_VISIBLE
runConfigure ./configure
make $jobArgs
}

View File

@@ -1,4 +1,4 @@
From 9a75978898bef649948b723701332b975b52a202 Mon Sep 17 00:00:00 2001
From c61f7f73be49c3b04386a297a80db217a974f474 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 3 Oct 2014 18:33:08 +0000
Subject: Haiku patch
@@ -23,3 +23,25 @@ index fd54ad1..5146be6 100644
--
1.8.3.4
From 65d7e5c89870562d59cb0317eaf20743fa745a18 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Mon, 6 Oct 2014 18:07:36 +0200
Subject: Add missing include fenv.h.
diff --git a/test/cairo-test.c b/test/cairo-test.c
index a3a587a..e5b2945 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -40,6 +40,7 @@
#include <unistd.h>
#endif
#include <errno.h>
+#include <fenv.h>
#include <string.h>
#if HAVE_FCFINI
#include <fontconfig/fontconfig.h>
--
1.8.3.4

View File

@@ -1,196 +0,0 @@
diff --git a/configure.in b/configure.in
index c7e457f..3af7f67 100644
--- a/configure.in
+++ b/configure.in
@@ -445,7 +445,7 @@ dnl ===========================================================================
CAIRO_BACKEND_ENABLE(beos, BeOS/Zeta, beos, BEOS_SURFACE, no, [
case "$host" in
- *-*-beos)
+ *-*-beos|*-*-haiku*)
dnl Add libbe and libzeta if available
AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
diff --git a/src/Makefile.am b/src/Makefile.am
index 200867a..9890b36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -242,7 +242,7 @@ if CAIRO_HAS_BEOS_SURFACE
cairo_headers += $(beos_headers)
# automake is stupid enough to always use c++ linker if we enable the
# following line, even if beos surface is not enabled. Disable it for now.
-#cairo_sources += $(beos_sources)
+cairo_sources += $(beos_sources)
backend_pkgconfigs += cairo-beos.pc
endif
diff --git a/src/cairo-beos-surface.cpp b/src/cairo-beos-surface.cpp
index 69dfd83..44ba8dd 100644
--- a/src/cairo-beos-surface.cpp
+++ b/src/cairo-beos-surface.cpp
@@ -36,7 +36,9 @@
// This is a C++ file in order to use the C++ BeOS API
+extern "C" {
#include "cairoint.h"
+}
#include "cairo-beos.h"
@@ -102,17 +104,17 @@ _cairo_beos_surface_create_internal (BView* view,
bool owns_bitmap_view = false);
static BRect
-_cairo_rect_to_brect (const cairo_rectangle_int16_t* rect)
+_cairo_rect_to_brect (const cairo_rectangle_int_t* rect)
{
// A BRect is one pixel wider than you'd think
return BRect(rect->x, rect->y, rect->x + rect->width - 1,
rect->y + rect->height - 1);
}
-static cairo_rectangle_int16_t
+static cairo_rectangle_int_t
_brect_to_cairo_rect (const BRect& rect)
{
- cairo_rectangle_int16_t retval;
+ cairo_rectangle_int_t retval;
retval.x = int(rect.left + 0.5);
retval.y = int(rect.top + 0.5);
retval.width = rect.IntegerWidth() + 1;
@@ -551,9 +553,9 @@ _cairo_beos_surface_release_source_image (void *abstract_surfac
static cairo_status_t
_cairo_beos_surface_acquire_dest_image (void *abstract_surface,
- cairo_rectangle_int16_t *interest_rect,
+ cairo_rectangle_int_t *interest_rect,
cairo_image_surface_t **image_out,
- cairo_rectangle_int16_t *image_rect,
+ cairo_rectangle_int_t *image_rect,
void **image_extra)
{
cairo_beos_surface_t *surface = reinterpret_cast<cairo_beos_surface_t*>(
@@ -616,9 +618,9 @@ _cairo_beos_surface_acquire_dest_image (void *abstract_surface,
static void
_cairo_beos_surface_release_dest_image (void *abstract_surface,
- cairo_rectangle_int16_t *intersect_rect,
+ cairo_rectangle_int_t *intersect_rect,
cairo_image_surface_t *image,
- cairo_rectangle_int16_t *image_rect,
+ cairo_rectangle_int_t *image_rect,
void *image_extra)
{
fprintf(stderr, "Fallback drawing\n");
@@ -769,7 +771,7 @@ _cairo_beos_surface_composite (cairo_operator_t op,
static void
_cairo_beos_surface_fill_rectangle (cairo_beos_surface_t *surface,
- cairo_rectangle_int16_t *rect)
+ cairo_rectangle_int_t *rect)
{
BRect brect(_cairo_rect_to_brect(rect));
surface->view->FillRect(brect);
@@ -779,7 +781,7 @@ static cairo_int_status_t
_cairo_beos_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t op,
const cairo_color_t *color,
- cairo_rectangle_int16_t *rects,
+ cairo_rectangle_int_t *rects,
int num_rects)
{
fprintf(stderr, "Drawing %i rectangles\n", num_rects);
@@ -835,9 +837,10 @@ _cairo_beos_surface_fill_rectangles (void *abstract_surface,
static cairo_int_status_t
_cairo_beos_surface_set_clip_region (void *abstract_surface,
- pixman_region16_t *region)
+ cairo_region_t *reg)
{
fprintf(stderr, "Setting clip region\n");
+ pixman_region16_t* region = reinterpret_cast<pixman_region16_t*>(reg);
cairo_beos_surface_t *surface = reinterpret_cast<cairo_beos_surface_t*>(
abstract_surface);
AutoLockView locker(surface->view);
@@ -850,8 +853,8 @@ _cairo_beos_surface_set_clip_region (void *abstract_surface,
return CAIRO_INT_STATUS_SUCCESS;
}
- int count = pixman_region_num_rects(region);
- pixman_box16_t* rects = pixman_region_rects(region);
+ int count;
+ pixman_box16_t* rects = pixman_region_rectangles(region, &count);
BRegion bregion;
for (int i = 0; i < count; ++i) {
// Have to substract one, because for pixman, the second coordinate
@@ -864,7 +867,7 @@ _cairo_beos_surface_set_clip_region (void *abstract_surface,
static cairo_int_status_t
_cairo_beos_surface_get_extents (void *abstract_surface,
- cairo_rectangle_int16_t *rectangle)
+ cairo_rectangle_int_t *rectangle)
{
cairo_beos_surface_t *surface = reinterpret_cast<cairo_beos_surface_t*>(
abstract_surface);
@@ -914,6 +917,45 @@ static const struct _cairo_surface_backend cairo_beos_surface_backend = {
NULL /* show_glyphs */
};
+#define DEFINE_NIL_SURFACE(status, name) \
+const cairo_surface_t name = { \
+ &cairo_image_surface_backend, /* backend */ \
+ CAIRO_SURFACE_TYPE_IMAGE, \
+ CAIRO_CONTENT_COLOR, \
+ CAIRO_REFERENCE_COUNT_INVALID, /* ref_count */ \
+ status, /* status */ \
+ FALSE, /* finished */ \
+ { 0, /* size */ \
+ 0, /* num_elements */ \
+ 0, /* element_size */ \
+ NULL, /* elements */ \
+ }, /* user_data */ \
+ { 1.0, 0.0, \
+ 0.0, 1.0, \
+ 0.0, 0.0 \
+ }, /* device_transform */ \
+ { 1.0, 0.0, \
+ 0.0, 1.0, \
+ 0.0, 0.0 \
+ }, /* device_transform_inverse */ \
+ 0.0, /* x_resolution */ \
+ 0.0, /* y_resolution */ \
+ 0.0, /* x_fallback_resolution */ \
+ 0.0, /* y_fallback_resolution */ \
+ NULL, /* clip */ \
+ 0, /* next_clip_serial */ \
+ 0, /* current_clip_serial */ \
+ FALSE, /* is_snapshot */ \
+ FALSE, /* has_font_options */ \
+ { CAIRO_ANTIALIAS_DEFAULT, \
+ CAIRO_SUBPIXEL_ORDER_DEFAULT, \
+ CAIRO_HINT_STYLE_DEFAULT, \
+ CAIRO_HINT_METRICS_DEFAULT \
+ } /* font_options */ \
+}
+
+static DEFINE_NIL_SURFACE(CAIRO_STATUS_NO_MEMORY, _cairo_surface_nil);
+
static cairo_surface_t *
_cairo_beos_surface_create_internal (BView* view,
BBitmap* bmp,
diff --git a/test/Makefile.am b/test/Makefile.am
index ec98a49..225b6d2 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -826,8 +826,10 @@ $(top_builddir)/test/pdiff/libpdiff.la:
cd $(top_builddir)/test/pdiff && $(MAKE) $(AM_MAKEFLAGS) libpdiff.la
if HAVE_PTHREAD
+if !CAIRO_HAS_BEOS_SURFACE
LDADD += -lpthread
endif
+endif
check_PROGRAMS += imagediff png-flatten

View File

@@ -1,300 +0,0 @@
diff --git a/boilerplate/Makefile.sources b/boilerplate/Makefile.sources
index 1b82bbd..7131793 100644
--- a/boilerplate/Makefile.sources
+++ b/boilerplate/Makefile.sources
@@ -19,7 +19,7 @@ cairo_boilerplate_sources = \
# automake is stupid enough to always use c++ linker if we enable the
# following lines, even if beos surface is not enabled. Disable it for now.
cairo_boilerplate_beos_private = cairo-boilerplate-beos-private.h
-#libcairoboilerplate_la_SOURCES += cairo-boilerplate-beos.cpp
+cairo_boilerplate_beos_sources = cairo-boilerplate-beos.cpp
cairo_boilerplate_directfb_private = cairo-boilerplate-directfb-private.h
cairo_boilerplate_directfb_sources = cairo-boilerplate-directfb.c
diff --git a/boilerplate/cairo-boilerplate-beos.cpp b/boilerplate/cairo-boilerplate-beos.cpp
index 497d927..303c8ea 100644
--- a/boilerplate/cairo-boilerplate-beos.cpp
+++ b/boilerplate/cairo-boilerplate-beos.cpp
@@ -153,8 +153,11 @@ AppRunner::~AppRunner()
if (be_app) {
if (be_app->Lock())
be_app->Quit();
+// XXX for some reason the follow lines cause boilerplate to crash on exit, commenting it out at least allows it to die without crashing
+#if 0
delete be_app;
be_app = NULL;
+#endif
}
}
@@ -171,11 +174,14 @@ struct beos_boilerplate_closure
// Test a real window
cairo_surface_t *
_cairo_boilerplate_beos_create_surface (const char *name,
- cairo_content_t content,
- int width,
- int height,
- cairo_boilerplate_mode_t mode,
- void **closure)
+ cairo_content_t content,
+ int width,
+ int height,
+ int max_width,
+ int max_height,
+ cairo_boilerplate_mode_t mode,
+ int id,
+ void **closure)
{
float right = width ? width - 1 : 0;
float bottom = height ? height - 1 : 0;
@@ -206,11 +212,14 @@ _cairo_boilerplate_beos_cleanup (void* closure)
// Test a bitmap
cairo_surface_t *
_cairo_boilerplate_beos_create_surface_for_bitmap (const char *name,
- cairo_content_t content,
- int width,
- int height,
- cairo_boilerplate_mode_t mode,
- void **closure)
+ cairo_content_t content,
+ int width,
+ int height,
+ int max_width,
+ int max_height,
+ cairo_boilerplate_mode_t mode,
+ int id,
+ void **closure)
{
BRect rect(0.0, 0.0, width - 1, height - 1);
color_space beosformat = (content == CAIRO_CONTENT_COLOR_ALPHA) ? B_RGBA32
diff --git a/configure.ac b/configure.ac
index 48b61b2..f16e252 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,7 +144,7 @@ CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [
dnl ===========================================================================
-CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [
+CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta/Haiku, no, [
case "$host" in
*-*-beos)
beos_LIBS=""
@@ -152,6 +152,11 @@ CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [
AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
;;
+ *-*-haiku)
+ beos_LIBS=""
+ AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
+ AC_CHECK_LIB(network,main,beos_LIBS="$beos_LIBS -lnetwork")
+ ;;
*)
use_beos="no (requires a BeOS platform)"
;;
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 7305995..694a552 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -242,7 +242,7 @@ cairo_os2_sources = cairo-os2-surface.c
# automake is stupid enough to always use c++ linker if we enable the
# following lines, even if beos surface is not enabled. Disable it for now.
cairo_beos_headers = cairo-beos.h
-#cairo_beos_sources = cairo-beos-surface.cpp
+cairo_beos_sources = cairo-beos-surface.cpp
cairo_glitz_headers = cairo-glitz.h
cairo_glitz_private = cairo-glitz-private.h
diff --git a/src/cairo-beos-surface.cpp b/src/cairo-beos-surface.cpp
index e527272..fca15aa 100644
--- a/src/cairo-beos-surface.cpp
+++ b/src/cairo-beos-surface.cpp
@@ -36,7 +36,9 @@
// This is a C++ file in order to use the C++ BeOS API
+extern "C" {
#include "cairoint.h"
+}
#include "cairo-beos.h"
@@ -102,17 +104,17 @@ _cairo_beos_surface_create_internal (BView* view,
bool owns_bitmap_view = false);
static BRect
-_cairo_rect_to_brect (const cairo_rectangle_int16_t* rect)
+_cairo_rect_to_brect (const cairo_rectangle_int_t* rect)
{
// A BRect is one pixel wider than you'd think
return BRect(rect->x, rect->y, rect->x + rect->width - 1,
rect->y + rect->height - 1);
}
-static cairo_rectangle_int16_t
+static cairo_rectangle_int_t
_brect_to_cairo_rect (const BRect& rect)
{
- cairo_rectangle_int16_t retval;
+ cairo_rectangle_int_t retval;
retval.x = int(rect.left + 0.5);
retval.y = int(rect.top + 0.5);
retval.width = rect.IntegerWidth() + 1;
@@ -551,9 +553,9 @@ _cairo_beos_surface_release_source_image (void *abstract_surfac
static cairo_status_t
_cairo_beos_surface_acquire_dest_image (void *abstract_surface,
- cairo_rectangle_int16_t *interest_rect,
+ cairo_rectangle_int_t *interest_rect,
cairo_image_surface_t **image_out,
- cairo_rectangle_int16_t *image_rect,
+ cairo_rectangle_int_t *image_rect,
void **image_extra)
{
cairo_beos_surface_t *surface = reinterpret_cast<cairo_beos_surface_t*>(
@@ -616,9 +618,9 @@ _cairo_beos_surface_acquire_dest_image (void *abstract_surface,
static void
_cairo_beos_surface_release_dest_image (void *abstract_surface,
- cairo_rectangle_int16_t *intersect_rect,
+ cairo_rectangle_int_t *intersect_rect,
cairo_image_surface_t *image,
- cairo_rectangle_int16_t *image_rect,
+ cairo_rectangle_int_t *image_rect,
void *image_extra)
{
fprintf(stderr, "Fallback drawing\n");
@@ -646,8 +648,8 @@ _cairo_beos_surface_release_dest_image (void *abstract_surface,
static cairo_int_status_t
_cairo_beos_surface_composite (cairo_operator_t op,
- cairo_pattern_t *src,
- cairo_pattern_t *mask,
+ const cairo_pattern_t *src,
+ const cairo_pattern_t *mask,
void *dst,
int src_x,
int src_y,
@@ -690,7 +692,7 @@ _cairo_beos_surface_composite (cairo_operator_t op,
src_y + ity + height - 1);
BRect dstRect(dst_x, dst_y, dst_x + width - 1, dst_y + height - 1);
- cairo_surface_t* src_surface = reinterpret_cast<cairo_surface_pattern_t*>(src)->
+ cairo_surface_t* src_surface = reinterpret_cast<const cairo_surface_pattern_t*>(src)->
surface;
// Get a bitmap
@@ -769,7 +771,7 @@ _cairo_beos_surface_composite (cairo_operator_t op,
static void
_cairo_beos_surface_fill_rectangle (cairo_beos_surface_t *surface,
- cairo_rectangle_int16_t *rect)
+ cairo_rectangle_int_t *rect)
{
BRect brect(_cairo_rect_to_brect(rect));
surface->view->FillRect(brect);
@@ -779,7 +781,7 @@ static cairo_int_status_t
_cairo_beos_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t op,
const cairo_color_t *color,
- cairo_rectangle_int16_t *rects,
+ cairo_rectangle_int_t *rects,
int num_rects)
{
fprintf(stderr, "Drawing %i rectangles\n", num_rects);
@@ -835,7 +837,7 @@ _cairo_beos_surface_fill_rectangles (void *abstract_surface,
static cairo_int_status_t
_cairo_beos_surface_set_clip_region (void *abstract_surface,
- pixman_region16_t *region)
+ cairo_region_t *region)
{
fprintf(stderr, "Setting clip region\n");
cairo_beos_surface_t *surface = reinterpret_cast<cairo_beos_surface_t*>(
@@ -850,8 +852,8 @@ _cairo_beos_surface_set_clip_region (void *abstract_surface,
return CAIRO_INT_STATUS_SUCCESS;
}
- int count = pixman_region_num_rects(region);
- pixman_box16_t* rects = pixman_region_rects(region);
+ int count = pixman_region32_n_rects(&region->rgn);
+ pixman_box32_t* rects = pixman_region32_rectangles(&region->rgn, &count);
BRegion bregion;
for (int i = 0; i < count; ++i) {
// Have to substract one, because for pixman, the second coordinate
@@ -864,7 +866,7 @@ _cairo_beos_surface_set_clip_region (void *abstract_surface,
static cairo_int_status_t
_cairo_beos_surface_get_extents (void *abstract_surface,
- cairo_rectangle_int16_t *rectangle)
+ cairo_rectangle_int_t *rectangle)
{
cairo_beos_surface_t *surface = reinterpret_cast<cairo_beos_surface_t*>(
abstract_surface);
@@ -913,7 +915,15 @@ static const struct _cairo_surface_backend cairo_beos_surface_backend = {
NULL, /* mask */
NULL, /* stroke */
NULL, /* fill */
- NULL /* show_glyphs */
+ NULL, /* show_glyphs */
+ NULL, /* snapshot */
+ NULL, /* is_similar */
+ NULL, /* reset */
+ NULL, /* fill_stroke */
+ NULL, /* create_solid_pattern_surface */
+ NULL, /* can_repaint_solid_pattern_surface */
+ NULL, /* has_show_text_glyphs */
+ NULL /* show_text_glyphs */
};
static cairo_surface_t *
@@ -925,8 +935,7 @@ _cairo_beos_surface_create_internal (BView* view,
cairo_beos_surface_t *surface = static_cast<cairo_beos_surface_t*>(
malloc(sizeof(cairo_beos_surface_t)));
if (surface == NULL) {
- _cairo_error (CAIRO_STATUS_NO_MEMORY);
- return const_cast<cairo_surface_t*>(&_cairo_surface_nil);
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}
cairo_content_t content = CAIRO_CONTENT_COLOR;
diff --git a/src/cairo.c b/src/cairo.c
index ddc8d4a..5f86820 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -83,7 +83,10 @@ cairo_status_t
_cairo_error (cairo_status_t status)
{
CAIRO_ENSURE_UNIQUE;
+// XXX if we remove the assert for now, it allows Cairo on Haiku to run tests
+#if 0
assert (_cairo_status_is_error (status));
+#endif
return status;
}
diff --git a/test/Makefile.am b/test/Makefile.am
index 2a1d93b..8f705ca 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -88,8 +88,10 @@ cairo_test_suite_DEPENDENCIES += \
any2ppm
endif
if HAVE_PTHREAD
+if !CAIRO_HAS_BEOS_SURFACE
cairo_test_suite_LDADD += -lpthread
endif
+endif
BUILT_SOURCES += cairo-test-constructors.c
noinst_SCRIPTS = make-cairo-test-constructors.pl
diff --git a/test/make-cairo-test-constructors.pl b/test/make-cairo-test-constructors.pl
index 5e77175..bcd12b0 100755
--- a/test/make-cairo-test-constructors.pl
+++ b/test/make-cairo-test-constructors.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/boot/common/bin/perl -w
while (<>) {
next unless /CAIRO_TEST \((.*),/; # XXX Parse multi-line macro