pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/pthread-stublib Add a library to catch calls to ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/67ec4ffd46d6
branches:  trunk
changeset: 509995:67ec4ffd46d6
user:      drochner <drochner%pkgsrc.org@localhost>
date:      Tue Mar 21 19:23:08 2006 +0000

description:
Add a library to catch calls to pthread_mutex* and *specific* functions
where the base system doesn't provide stubs for non-threaded programs
(which is just NetBSD<=2 for now).
This is absolutely primitive and just sufficient to make MesaLib usable
with nonthreaded programs.

diffstat:

 devel/pthread-stublib/DESCR                 |   3 +
 devel/pthread-stublib/Makefile              |  19 ++++++++++
 devel/pthread-stublib/PLIST                 |   2 +
 devel/pthread-stublib/buildlink3.mk         |  28 +++++++++++++++
 devel/pthread-stublib/files/Makefile        |  13 +++++++
 devel/pthread-stublib/files/pthread-stubs.c |  53 +++++++++++++++++++++++++++++
 6 files changed, 118 insertions(+), 0 deletions(-)

diffs (142 lines):

diff -r 6f31f26c4c91 -r 67ec4ffd46d6 devel/pthread-stublib/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/pthread-stublib/DESCR       Tue Mar 21 19:23:08 2006 +0000
@@ -0,0 +1,3 @@
+Provide dummy implementations of pthread functions like mutex operations
+to enable libraries to be used in both thread-aware and non-threaded programs.
+This is for NetBSD<=2; newer operating systems don't need it.
diff -r 6f31f26c4c91 -r 67ec4ffd46d6 devel/pthread-stublib/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/pthread-stublib/Makefile    Tue Mar 21 19:23:08 2006 +0000
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile,v 1.1.1.1 2006/03/21 19:23:08 drochner Exp $
+
+DISTNAME=      pthread-stublib-1.0
+CATEGORIES=    devel
+DISTFILES=     # empty
+
+MAINTAINER=    drochner%NetBSD.org@localhost
+COMMENT=       Library providing noop-stubs for pthread functions
+
+WRKSRC=                ${WRKDIR}
+NO_CHECKSUM=   yes
+USE_LIBTOOL=   yes
+
+ONLY_FOR_PLATFORM= NetBSD-[12].*-*
+
+do-extract:
+       ${CP} ${FILESDIR}/pthread-stubs.c ${FILESDIR}/Makefile ${WRKSRC}
+
+.include "../../mk/bsd.pkg.mk"
diff -r 6f31f26c4c91 -r 67ec4ffd46d6 devel/pthread-stublib/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/pthread-stublib/PLIST       Tue Mar 21 19:23:08 2006 +0000
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2006/03/21 19:23:08 drochner Exp $
+lib/libpthstub.la
diff -r 6f31f26c4c91 -r 67ec4ffd46d6 devel/pthread-stublib/buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/pthread-stublib/buildlink3.mk       Tue Mar 21 19:23:08 2006 +0000
@@ -0,0 +1,28 @@
+# $NetBSD: buildlink3.mk,v 1.1.1.1 2006/03/21 19:23:08 drochner Exp $
+# XXX
+# XXX This file was created automatically using createbuildlink-3.10.
+# XXX After this file has been verified as correct, the comment lines
+# XXX beginning with "XXX" should be removed.  Please do not commit
+# XXX unverified buildlink3.mk files.
+# XXX
+# XXX Packages that only install static libraries or headers should
+# XXX include the following line:
+# XXX
+# XXX  BUILDLINK_DEPMETHOD.pthread-stublib?=   build
+
+BUILDLINK_DEPTH:=              ${BUILDLINK_DEPTH}+
+PTHREAD_STUBLIB_BUILDLINK3_MK:=        ${PTHREAD_STUBLIB_BUILDLINK3_MK}+
+
+.if !empty(BUILDLINK_DEPTH:M+)
+BUILDLINK_DEPENDS+=    pthread-stublib
+.endif
+
+BUILDLINK_PACKAGES:=   ${BUILDLINK_PACKAGES:Npthread-stublib}
+BUILDLINK_PACKAGES+=   pthread-stublib
+
+.if !empty(PTHREAD_STUBLIB_BUILDLINK3_MK:M+)
+BUILDLINK_DEPENDS.pthread-stublib+=    pthread-stublib>=1.0
+BUILDLINK_PKGSRCDIR.pthread-stublib?=  ../../devel/pthread-stublib
+.endif # PTHREAD_STUBLIB_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:=              ${BUILDLINK_DEPTH:S/+$//}
diff -r 6f31f26c4c91 -r 67ec4ffd46d6 devel/pthread-stublib/files/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/pthread-stublib/files/Makefile      Tue Mar 21 19:23:08 2006 +0000
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1.1.1 2006/03/21 19:23:08 drochner Exp $
+
+all: libpthstub.la
+
+libpthstub.la: pthread-stubs.lo
+       ${LIBTOOL} --mode=link ${CC} -o $@ $? -rpath ${PREFIX}/lib
+
+pthread-stubs.lo: pthread-stubs.c
+       ${LIBTOOL} --mode=compile ${CC} -c -o $@ $?
+
+install:
+       ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} libpthstub.la \
+               ${PREFIX}/lib
diff -r 6f31f26c4c91 -r 67ec4ffd46d6 devel/pthread-stublib/files/pthread-stubs.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/pthread-stublib/files/pthread-stubs.c       Tue Mar 21 19:23:08 2006 +0000
@@ -0,0 +1,53 @@
+/* $NetBSD: pthread-stubs.c,v 1.1.1.1 2006/03/21 19:23:08 drochner Exp $ */
+
+#include <sys/cdefs.h>
+
+int __pthstub_mutex_noop(void);
+
+__weak_alias(pthread_mutex_init,__pthstub_noop)
+__weak_alias(pthread_mutex_lock,__pthstub_noop)
+__weak_alias(pthread_mutex_trylock,__pthstub_noop)
+__weak_alias(pthread_mutex_unlock,__pthstub_noop)
+__weak_alias(pthread_mutex_destroy,__pthstub_noop)
+__weak_alias(pthread_key_create,__pthstub_noop)
+__weak_alias(pthread_self,__pthstub_noop)
+
+int
+__pthstub_noop()
+{
+
+       return (0);
+}
+
+__weak_alias(pthread_setspecific,__pthstub_setspecific)
+__weak_alias(pthread_getspecific,__pthstub_getspecific)
+static void *__pthstub_localdata;
+
+int
+__pthstub_setspecific(int k, void *v)
+{
+
+       __pthstub_localdata = v;
+       return (0);
+}
+
+void *
+__pthstub_getspecific()
+{
+
+       return (__pthstub_localdata);
+}
+
+__weak_alias(pthread_once,__pthstub_once)
+static int __once_done;
+
+int
+__pthstub_once(void *oc, void (*f)(void))
+{
+
+       if (!__once_done) {
+               (*f)();
+               __once_done = 1;
+       }
+       return (0);
+}



Home | Main Index | Thread Index | Old Index