diff options
author | tnn <tnn@pkgsrc.org> | 2010-04-19 18:46:15 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2010-04-19 18:46:15 +0000 |
commit | f5cab1ae295190e55510c43b6538da04c99c14f9 (patch) | |
tree | 765bb556b8c1cfcfd98e4299935724e980335513 /x11/libdrm | |
parent | 6f905731c689044e73d45c3af8b6ef7ebc69e15e (diff) | |
download | pkgsrc-f5cab1ae295190e55510c43b6538da04c99c14f9.tar.gz |
clean up atomic ops handling and use devel/libatomic_ops as a fallback.
Based on patch from Dennis den Brok.
Diffstat (limited to 'x11/libdrm')
-rw-r--r-- | x11/libdrm/Makefile | 18 | ||||
-rw-r--r-- | x11/libdrm/distinfo | 3 | ||||
-rw-r--r-- | x11/libdrm/patches/patch-ad | 28 |
3 files changed, 37 insertions, 12 deletions
diff --git a/x11/libdrm/Makefile b/x11/libdrm/Makefile index c151583c25e..4304d666a62 100644 --- a/x11/libdrm/Makefile +++ b/x11/libdrm/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2010/04/16 13:43:36 tnn Exp $ +# $NetBSD: Makefile,v 1.12 2010/04/19 18:46:15 tnn Exp $ # DISTNAME= libdrm-2.4.20 @@ -20,22 +20,18 @@ GNU_CONFIGURE= yes .include "../../mk/bsd.prefs.mk" -ATOMIC_OPS_CHECK?= 0 - SUBST_CLASSES+= atomic SUBST_FILES.atomic= 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 +.if ${OPSYS} == "NetBSD" && exists(/usr/include/sys/atomic.h) +ATOMIC_OPS_CHECK= 1 +.else +ATOMIC_OPS_CHECK= 0 +.include "../../devel/libatomic_ops/buildlink3.mk" +CONFIGURE_ENV+= drm_cv_atomic_primitives=libatomic-ops .endif CONFIGURE_ARGS+= PTHREADSTUBS_CFLAGS=-I${PREFIX}/include \ diff --git a/x11/libdrm/distinfo b/x11/libdrm/distinfo index a55d9c85e24..81670a3be84 100644 --- a/x11/libdrm/distinfo +++ b/x11/libdrm/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.12 2010/04/16 13:43:36 tnn Exp $ +$NetBSD: distinfo,v 1.13 2010/04/19 18:46:15 tnn Exp $ SHA1 (libdrm-2.4.20.tar.bz2) = f1448ac0f1c7a5f74a86d2fb50941fc12dc932db RMD160 (libdrm-2.4.20.tar.bz2) = 5581c45abfb9cb2bd0b95d4754d7812bb8323e3a Size (libdrm-2.4.20.tar.bz2) = 400812 bytes SHA1 (patch-ab) = 66dadd3244bfa9c69be0982fd2108deb94483de2 SHA1 (patch-ac) = 61635a93d4b83783023114cd96993dc1075cbe1b +SHA1 (patch-ad) = ea3ef8de8db782ddab23f182f1e6bd9d8f612a78 diff --git a/x11/libdrm/patches/patch-ad b/x11/libdrm/patches/patch-ad new file mode 100644 index 00000000000..8691bb26969 --- /dev/null +++ b/x11/libdrm/patches/patch-ad @@ -0,0 +1,28 @@ +$NetBSD: patch-ad,v 1.1 2010/04/19 18:46:15 tnn Exp $ + +--- xf86atomic.h.orig 2010-03-22 20:39:27.000000000 +0000 ++++ xf86atomic.h +@@ -92,6 +92,23 @@ typedef struct { uint_t atomic; } atomic + + #endif + ++#if defined(__NetBSD__) && !defined(HAS_ATOMIC_OPS) /* NetBSD */ ++ ++#include <sys/atomic.h> ++#define HAS_ATOMIC_OPS 1 ++ ++typedef struct { int atomic; } atomic_t; ++ ++# define atomic_read(x) (int) ((x)->atomic) ++# define atomic_set(x, val) ((x)->atomic = (val)) ++# define atomic_inc(x) (atomic_inc_uint (&(x)->atomic)) ++# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 1) ++# define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v))) ++# define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v))) ++# define atomic_cmpxchg(x, oldv, newv) atomic_cas_uint (&(x)->atomic, oldv, newv) ++ ++#endif ++ + #if ! HAS_ATOMIC_OPS + #error libdrm requires atomic operations, please define them for your CPU/compiler. + #endif |