Second try at updating to 1.12.4 with an additional patch from

Chris Wilson (upstream).

Fixes problems on NetBSD and OS X.

Bump PKGREVISION compared to last 1.12.4 version.
This commit is contained in:
wiz 2012-10-20 00:55:05 +00:00
parent dd70c7b639
commit f825477768
6 changed files with 209 additions and 14 deletions

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.112 2012/10/15 17:33:33 asau Exp $
# $NetBSD: Makefile,v 1.113 2012/10/20 00:55:05 wiz Exp $
DISTNAME= cairo-1.12.2
DISTNAME= cairo-1.12.4
PKGREVISION= 2
CATEGORIES= graphics
MASTER_SITES= http://cairographics.org/releases/
@ -38,11 +38,6 @@ CPPFLAGS.SunOS+= -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
TEST_TARGET= check
# Workaround for FreeBSD (noticed on 9.0):
.if ${OPSYS} == "FreeBSD"
BUILDLINK_TRANSFORM+= rm:-ldl
.endif
# PR#43928
.include "../../mk/compiler.mk"
.if ${MACHINE_PLATFORM:MDragonFly-*-x86_64} && ${CC_VERSION:Mgcc-4.1.*}

View file

@ -1,9 +1,12 @@
$NetBSD: distinfo,v 1.64 2012/10/08 21:54:05 wiz Exp $
$NetBSD: distinfo,v 1.65 2012/10/20 00:55:06 wiz Exp $
SHA1 (cairo-1.12.2.tar.xz) = bc2ee50690575f16dab33af42a2e6cdc6451e3f9
RMD160 (cairo-1.12.2.tar.xz) = 0174a5110f5f4c9ff15da984e0602dfd04643a63
Size (cairo-1.12.2.tar.xz) = 42051584 bytes
SHA1 (cairo-1.12.4.tar.xz) = f4158981ed01e73c94fb8072074b17feee61a68b
RMD160 (cairo-1.12.4.tar.xz) = 0e2ab9442f47228b7df2354caf157f2a4eeafb31
Size (cairo-1.12.4.tar.xz) = 42099760 bytes
SHA1 (patch-aa) = 474f44c1c8d4017137fe59b160afca8f16ad7287
SHA1 (patch-ab) = 62ff361d52742bba0f49c6a32149269b958fa24a
SHA1 (patch-ac) = 151c682245004902cf42ba141e3743592691dfb9
SHA1 (patch-ad) = a1068a37113b162ccfe14d7f1bd0baa9df7e5530
SHA1 (patch-configure) = abd507d7707f6e5bd000471dedaa4e615bb117ad
SHA1 (patch-configure.ac) = c6df883204c5074d52443626f434cd6077a8d834
SHA1 (patch-src_cairo-xlib-surface-shm.c) = 86be07c7c759fca8d1cbd19c0ac8e7287d42c3c6

View file

@ -1,4 +1,4 @@
# $NetBSD: options.mk,v 1.10 2012/10/10 13:29:25 drochner Exp $
# $NetBSD: options.mk,v 1.11 2012/10/20 00:55:06 wiz Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.cairo
PKG_SUPPORTED_OPTIONS= x11 xcb
@ -28,8 +28,6 @@ BUILDLINK_DEPMETHOD.libXt?= build # only for configure
CONFIGURE_ARGS+= --enable-xcb
PLIST.xcb= yes
. include "../../x11/libxcb/buildlink3.mk"
. else
CONFIGURE_ARGS+= --disable-xcb
. endif
.else

View file

@ -0,0 +1,80 @@
$NetBSD: patch-configure,v 1.1 2012/10/20 00:55:06 wiz Exp $
Whilst reading through other users of XShm, it became apparent that
IPC_RMID behaves differently across the platforms. Linux allows
processes to attach to an existing ShmSegment id after a IPC_RMID, but
for others the IPC_RMID takes immediate effect. On those platforms
without a "deferred" IPC_RMID, we then need to perform the XShmAttach
synchronously before perfomring the IPC_RMID.
Reported-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
--- configure.orig 2012-10-05 15:45:31.000000000 +0000
+++ configure
@@ -21646,6 +21646,65 @@ $as_echo "yes" >&6; }
:
fi
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/ipc.h" "ac_cv_header_sys_ipc_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_ipc_h" = xyes; then :
+
+fi
+
+
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/shm.h" "ac_cv_header_sys_shm_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_shm_h" = xyes; then :
+
+fi
+
+
+
+ if test "$ac_cv_header_sys_ipc_h" = "yes" -a "$ac_cv_header_sys_shm_h" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether shmctl IPC_RMID allowes subsequent attaches" >&5
+$as_echo_n "checking whether shmctl IPC_RMID allowes subsequent attaches... " >&6; }
+ if test "$cross_compiling" = yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming no" >&5
+$as_echo "assuming no" >&6; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <sys/types.h>
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
+ int main()
+ {
+ char *shmaddr;
+ int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
+ if (id == -1) return 2;
+ shmaddr = shmat (id, 0, 0);
+ shmctl (id, IPC_RMID, 0);
+ if ((char*) shmat (id, 0, 0) == (char*) -1) {
+ shmdt (shmaddr);
+ return 1;
+ }
+ shmdt (shmaddr);
+ shmdt (shmaddr);
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+$as_echo "#define IPC_RMID_DEFERRED_RELEASE 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's Xlib surface backend feature could be enabled" >&5
$as_echo_n "checking whether cairo's Xlib surface backend feature could be enabled... " >&6; }

View file

@ -0,0 +1,53 @@
$NetBSD: patch-configure.ac,v 1.1 2012/10/20 00:55:07 wiz Exp $
Whilst reading through other users of XShm, it became apparent that
IPC_RMID behaves differently across the platforms. Linux allows
processes to attach to an existing ShmSegment id after a IPC_RMID, but
for others the IPC_RMID takes immediate effect. On those platforms
without a "deferred" IPC_RMID, we then need to perform the XShmAttach
synchronously before perfomring the IPC_RMID.
Reported-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
--- configure.ac.orig 2012-09-13 11:38:21.000000000 +0000
+++ configure.ac
@@ -74,6 +74,38 @@ CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib,
xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
fi])
+
+ AC_CHECK_HEADER(sys/ipc.h)
+ AC_CHECK_HEADER(sys/shm.h)
+
+ if test "$ac_cv_header_sys_ipc_h" = "yes" -a "$ac_cv_header_sys_shm_h" = "yes"; then
+ AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
+ int main()
+ {
+ char *shmaddr;
+ int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
+ if (id == -1) return 2;
+ shmaddr = shmat (id, 0, 0);
+ shmctl (id, IPC_RMID, 0);
+ if ((char*) shmat (id, 0, 0) == (char*) -1) {
+ shmdt (shmaddr);
+ return 1;
+ }
+ shmdt (shmaddr);
+ shmdt (shmaddr);
+ return 0;
+ }
+ ],
+ AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
+ [Define to 1 if shared memory segments are released deferred.])
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no),
+ AC_MSG_RESULT(assuming no))
+ fi
])
CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [

View file

@ -0,0 +1,66 @@
$NetBSD: patch-src_cairo-xlib-surface-shm.c,v 1.3 2012/10/20 00:55:07 wiz Exp $
First chunk:
Whilst reading through other users of XShm, it became apparent that
IPC_RMID behaves differently across the platforms. Linux allows
processes to attach to an existing ShmSegment id after a IPC_RMID, but
for others the IPC_RMID takes immediate effect. On those platforms
without a "deferred" IPC_RMID, we then need to perform the XShmAttach
synchronously before perfomring the IPC_RMID.
Reported-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Rest:
Prevent application crashes under old version of X.org e.g. under
Mac OS X Lion. Patch taken from here:
http://cgit.freedesktop.org/cairo/commit/?id=b1532f465e05d566f6d160c5ca916a5a12614067
--- src/cairo-xlib-surface-shm.c.orig 2012-10-05 13:06:00.000000000 +0000
+++ src/cairo-xlib-surface-shm.c
@@ -449,6 +449,9 @@ _cairo_xlib_shm_pool_create(cairo_xlib_d
pool->attached = NextRequest (dpy);
success = XShmAttach (dpy, &pool->shm);
+#if !IPC_RMID_DEFERRED_RELEASE
+ XSync (dpy, FALSE);
+#endif
shmctl (pool->shm.shmid, IPC_RMID, NULL);
if (! success)
@@ -1121,6 +1124,24 @@ _cairo_xlib_shm_surface_is_idle (cairo_s
return shm->idle > 0;
}
+#define XORG_VERSION_ENCODE(major,minor,patch,snap) \
+ (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
+
+static cairo_bool_t
+xorg_has_buggy_send_event(Display *dpy)
+{
+ /* Avoid incurring the wrath fixed by:
+ *
+ * commit 2d2dce558d24eeea0eb011ec9ebaa6c5c2273c39
+ * Author: Sam Spilsbury <sam.spilsbury@canonical.com>
+ * Date: Wed Sep 14 09:58:34 2011 +0800
+ *
+ * Remove the SendEvent bit (0x80) before doing range checks on event type.
+ */
+ return (strstr (ServerVendor (dpy), "X.Org") != NULL &&
+ VendorRelease (dpy) < XORG_VERSION_ENCODE(1,11,0,1));
+}
+
void
_cairo_xlib_display_init_shm (cairo_xlib_display_t *display)
{
@@ -1153,6 +1174,9 @@ _cairo_xlib_display_init_shm (cairo_xlib
DefaultVisual (display->display, scr),
CWOverrideRedirect, &attr);
+ if (xorg_has_buggy_send_event(display->display))
+ has_pixmap = 0;
+
shm->has_pixmaps = has_pixmap ? MIN_PIXMAP_SIZE : 0;
cairo_list_init (&shm->pool);