summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjs <bjs@pkgsrc.org>2008-05-06 06:20:25 +0000
committerbjs <bjs@pkgsrc.org>2008-05-06 06:20:25 +0000
commite22df43e8f65d5cdaa8138299e8ff8a6e6b552c3 (patch)
tree3f15654e8da5e1c567e0f81a8faf6435cc23833e
parentcc2c07ed2778dc92ecf45e9efb8bf98460b39cd5 (diff)
downloadpkgsrc-e22df43e8f65d5cdaa8138299e8ff8a6e6b552c3.tar.gz
Add support for the userland atomic ops of NetBSD-current.
As per the comment in xf86drm.h, this should be reflected here, as we now use atomic_cas_uint() in drm_atomic.h.
-rw-r--r--x11/libdrm/Makefile24
-rw-r--r--x11/libdrm/distinfo3
-rw-r--r--x11/libdrm/patches/patch-ac30
3 files changed, 54 insertions, 3 deletions
diff --git a/x11/libdrm/Makefile b/x11/libdrm/Makefile
index 56148adee28..1a692843918 100644
--- a/x11/libdrm/Makefile
+++ b/x11/libdrm/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2007/03/23 16:28:30 drochner Exp $
+# $NetBSD: Makefile,v 1.4 2008/05/06 06:20:25 bjs Exp $
#
DISTNAME= libdrm-2.3.0
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= x11 graphics
MASTER_SITES= http://dri.freedesktop.org/libdrm/
EXTRACT_SUFX= .tar.bz2
@@ -18,4 +18,24 @@ USE_LIBTOOL= yes
PKGCONFIG_OVERRIDE+= libdrm.pc.in
GNU_CONFIGURE= yes
+.include "../../mk/bsd.prefs.mk"
+
+ATOMIC_OPS_CHECK?= 0
+
+SUBST_CLASSES+= atomic
+SUBST_FILES.atomic= libdrm/xf86drm.h
+SUBST_MESSAGE.atomic= Configuring xf86drm.h's atomic operations.
+SUBST_STAGE.atomic= pre-configure
+SUBST_VARS.atomic= ATOMIC_OPS_CHECK
+
+.if ${OPSYS} == "NetBSD" && !target(netbsd-atomic-ops-check)
+netbsd-atomic-ops-check:
+ATOMIC_OPS_CHECK!=\
+ if ( ${NM} /usr/lib/libc.so | ${GREP} -q atomic_cas_uint ); then \
+ ${ECHO} "1"; \
+ else \
+ ${ECHO} "0"; \
+ fi
+.endif
+
.include "../../mk/bsd.pkg.mk"
diff --git a/x11/libdrm/distinfo b/x11/libdrm/distinfo
index 14915ac03c6..2dbc29fbf1e 100644
--- a/x11/libdrm/distinfo
+++ b/x11/libdrm/distinfo
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.3 2007/03/23 16:28:30 drochner Exp $
+$NetBSD: distinfo,v 1.4 2008/05/06 06:20:25 bjs Exp $
SHA1 (libdrm-2.3.0.tar.bz2) = af2e8d6e3ad6b906b4d6f1b2ada2d523188c28ea
RMD160 (libdrm-2.3.0.tar.bz2) = ca9f6cdde2fcee40e63a43e0395781000472a2c1
Size (libdrm-2.3.0.tar.bz2) = 267949 bytes
SHA1 (patch-aa) = cc63dd837d6c25925e3a4d70c1ebd4860da1edd8
SHA1 (patch-ab) = 46a47c10afd42d3138dfefc855511a9138564b83
+SHA1 (patch-ac) = 175e941bdb3689093a6c6ccf2a2591add742f94c
diff --git a/x11/libdrm/patches/patch-ac b/x11/libdrm/patches/patch-ac
new file mode 100644
index 00000000000..58b61d9d73b
--- /dev/null
+++ b/x11/libdrm/patches/patch-ac
@@ -0,0 +1,30 @@
+$NetBSD: patch-ac,v 1.1 2008/05/06 06:20:25 bjs Exp $
+
+--- libdrm/xf86drm.h.orig 2006-11-08 16:55:14.000000000 -0500
++++ libdrm/xf86drm.h
+@@ -37,7 +37,11 @@
+ #define _XF86DRM_H_
+
+ #include <stdarg.h>
++#if @ATOMIC_OPS_CHECK@ /* configured by pkgsrc */
++#include <sys/atomic.h>
++#else
+ #include <sys/types.h>
++#endif
+ #include <drm.h>
+
+ /* Defaults, if nothing set in xf86config */
+@@ -305,7 +309,12 @@ typedef struct _drmSetVersion {
+ #define DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */
+ #define DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */
+
+-#if defined(__GNUC__) && (__GNUC__ >= 2)
++#if @ATOMIC_OPS_CHECK@ /* configured by pkgsrc */
++
++#define DRM_CAS(lock, old, new, __ret) \
++ (__ret = atomic_cas_uint(&__drm_dummy_lock(lock), (old), (new)) != (old));
++
++#elif defined(__GNUC__) && (__GNUC__ >= 2)
+ # if defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)
+ /* Reflect changes here to drmP.h */
+ #define DRM_CAS(lock,old,new,__ret) \