pkg://Mesa-3.4.2-10.src.rpm:3170378/Mesa-3.4-nopthread.patch
info downloads
--- Mesa-3.4/bin/mklib.linux.jj Wed Feb 16 02:09:06 2000
+++ Mesa-3.4/bin/mklib.linux Tue Feb 6 20:16:08 2001
@@ -56,7 +56,7 @@ DIRNAME=`dirname $LIBRARY`
# When making shared libraries, also link with any libraries we're
# depenedant on.
if [ $LIBRARY = "libGL.so" ] ; then
- EXTRA_LIBS=${GL_LIB_DEPS}
+ EXTRA_LIBS=`echo ${GL_LIB_DEPS} | sed 's/-lpthread//'`
elif [ $LIBRARY = "libGLU.so" ] ; then
EXTRA_LIBS=${GLU_LIB_DEPS}
elif [ $LIBRARY = "libglut.so" ] ; then
--- Mesa-3.4/src/Makefile.am.jj Tue Feb 6 19:51:10 2001
+++ Mesa-3.4/src/Makefile.am Tue Feb 6 20:18:17 2001
@@ -232,7 +232,7 @@ SUBDIRS = $(SUB_X86) $(SUB_FX) $(SUB_GGI
libGL_la_LIBADD = $(DRV_X86) $(DRV_FX) $(DRV_FX_X86) $(DRV_GGI) $(DRV_OSMESA) \
- $(DRV_SVGA) $(DRV_X11) $(THREAD_LIBS)
+ $(DRV_SVGA) $(DRV_X11)
strip:
-if strip -V 2>&1 | grep "GNU" > /dev/null; then \
--- Mesa-3.4/src/glthread.h.jj Fri Feb 11 22:38:33 2000
+++ Mesa-3.4/src/glthread.h Tue Feb 6 20:18:48 2001
@@ -85,8 +85,19 @@
#if defined(PTHREADS)
#include <pthread.h> /* POSIX threads headers */
+#define glthread_weak_extern(symbol) asm (".weak " #symbol)
+
+glthread_weak_extern(pthread_mutex_init);
+glthread_weak_extern(pthread_mutex_lock);
+glthread_weak_extern(pthread_mutex_unlock);
+glthread_weak_extern(pthread_self);
+glthread_weak_extern(pthread_key_create);
+glthread_weak_extern(pthread_getspecific);
+glthread_weak_extern(pthread_setspecific);
+
typedef struct {
pthread_key_t key;
+ void *ptr;
int initMagic;
} _glthread_TSD;
@@ -98,13 +109,13 @@ typedef pthread_mutex_t _glthread_Mutex;
static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER
#define _glthread_INIT_MUTEX(name) \
- pthread_mutex_init(&(name), NULL)
+ do { if (pthread_mutex_init) pthread_mutex_init(&(name), NULL); } while (0)
#define _glthread_LOCK_MUTEX(name) \
- (void) pthread_mutex_lock(&(name))
+ do { if (pthread_mutex_lock) pthread_mutex_lock(&(name)); } while (0)
#define _glthread_UNLOCK_MUTEX(name) \
- (void) pthread_mutex_unlock(&(name))
+ do { if (pthread_mutex_unlock) pthread_mutex_unlock(&(name)); } while (0)
#endif /* PTHREADS */
--- Mesa-3.4/src/glthread.c.jj Fri Feb 11 22:38:33 2000
+++ Mesa-3.4/src/glthread.c Tue Feb 6 20:18:48 2001
@@ -75,17 +75,21 @@
unsigned long
_glthread_GetID(void)
{
- return (unsigned long) pthread_self();
+ if (pthread_self)
+ return (unsigned long) pthread_self();
+ return 0;
}
void
_glthread_InitTSD(_glthread_TSD *tsd)
{
- if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
+ if (pthread_key_create
+ && pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
perror(INIT_TSD_ERROR);
exit(-1);
}
+ tsd->ptr = NULL;
tsd->initMagic = INIT_MAGIC;
}
@@ -96,7 +100,9 @@ _glthread_GetTSD(_glthread_TSD *tsd)
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
- return pthread_getspecific(tsd->key);
+ if (pthread_getspecific)
+ return pthread_getspecific(tsd->key);
+ return tsd->ptr;
}
@@ -105,6 +111,10 @@ _glthread_SetTSD(_glthread_TSD *tsd, voi
{
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
+ }
+ if (!pthread_setspecific) {
+ tsd->ptr = ptr;
+ return;
}
if (pthread_setspecific(tsd->key, ptr) != 0) {
perror(SET_TSD_ERROR);
--- Mesa-3.4/src/DRI/glxclient.h.jj Tue Feb 6 20:37:04 2001
+++ Mesa-3.4/src/DRI/glxclient.h Tue Feb 6 21:38:40 2001
@@ -48,6 +48,38 @@
#include <X11/Xthreads.h>
#endif
+#define glxclient_weak_extern(symbol) asm (".weak " #symbol)
+
+glxclient_weak_extern(pthread_mutex_init);
+glxclient_weak_extern(pthread_mutex_lock);
+glxclient_weak_extern(pthread_mutex_unlock);
+/* glxclient_weak_extern(pthread_self); */
+glxclient_weak_extern(pthread_key_create);
+/* glxclient_weak_extern(pthread_key_delete); */
+glxclient_weak_extern(pthread_getspecific);
+glxclient_weak_extern(pthread_setspecific);
+
+#undef xmutex_init
+#undef xmutex_lock
+#undef xmutex_unlock
+#undef xthread_key_create
+#undef xthread_key_delete
+#undef xthread_get_specific
+#undef xthread_set_specific
+#undef xthread_key_t
+typedef struct {
+ pthread_key_t key;
+ void *ptr;
+} xxthread_key_t;
+#define xthread_key_t xxthread_key_t
+#define xmutex_init(m) do { if (pthread_mutex_init) pthread_mutex_init((m), NULL); } while (0)
+#define xmutex_lock(m) do { if (pthread_mutex_lock) pthread_mutex_lock (m); } while (0)
+#define xmutex_unlock(m) do { if (pthread_mutex_unlock) pthread_mutex_unlock (m); } while (0)
+#define xthread_key_create(kp,d) do { (kp)->ptr = NULL; if (pthread_key_create) pthread_key_create (&(kp)->key,(d)); } while (0)
+#define xthread_key_delete(k) do { if (pthread_key_delete) pthread_key_delete ((k).key); } while (0)
+#define xthread_get_specific(k,vp) do { if (pthread_getspecific) *(vp) = pthread_getspecific ((k).key); else *(vp) = (k).ptr; } while (0)
+#define xthread_set_specific(k,v) do { if (pthread_setspecific) pthread_setspecific ((k).key, (v)); else (k).ptr = (v); } while (0)
+
#define GLXContext __GLXcontext *
--- Mesa-3.4/src/DRI/Makefile.am.jj Tue Feb 6 20:37:04 2001
+++ Mesa-3.4/src/DRI/Makefile.am Tue Feb 6 21:44:07 2001
@@ -43,4 +43,4 @@ libMesaDRI_la_SOURCES = \
xf86dristr.h \
xfont.c
-libMesaDRI_la_LIBADD = $(X_LIBS) $(X_PRE_LIBS) $(X_LIBADD) -lpthread -ldl
+libMesaDRI_la_LIBADD = $(X_LIBS) $(X_PRE_LIBS) $(X_LIBADD) -ldl