pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/x11/libdrm clean up atomic ops handling and use devel/...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/55e45c85efd0
branches:  trunk
changeset: 574544:55e45c85efd0
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Mon Apr 19 18:46:15 2010 +0000

description:
clean up atomic ops handling and use devel/libatomic_ops as a fallback.
Based on patch from Dennis den Brok.

diffstat:

 x11/libdrm/Makefile         |  18 +++++++-----------
 x11/libdrm/distinfo         |   3 ++-
 x11/libdrm/patches/patch-ad |  28 ++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 12 deletions(-)

diffs (83 lines):

diff -r 0dc136ca0978 -r 55e45c85efd0 x11/libdrm/Makefile
--- a/x11/libdrm/Makefile       Mon Apr 19 15:48:25 2010 +0000
+++ b/x11/libdrm/Makefile       Mon Apr 19 18:46:15 2010 +0000
@@ -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 @@
 
 .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 -r 0dc136ca0978 -r 55e45c85efd0 x11/libdrm/distinfo
--- a/x11/libdrm/distinfo       Mon Apr 19 15:48:25 2010 +0000
+++ b/x11/libdrm/distinfo       Mon Apr 19 18:46:15 2010 +0000
@@ -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 -r 0dc136ca0978 -r 55e45c85efd0 x11/libdrm/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/libdrm/patches/patch-ad       Mon Apr 19 18:46:15 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index