diff options
author | tg <tg@FreeBSD.org> | 2000-04-20 09:24:28 +0000 |
---|---|---|
committer | tg <tg@FreeBSD.org> | 2000-04-20 09:24:28 +0000 |
commit | bb3d5d57f23c6c19a1d5658ccd56f5b05ec8c5b9 (patch) | |
tree | 588211e16c2d90f9c92683fa29f85b815f2fa021 /devel/sdl | |
parent | 2a2526a723e2ee86f99aa8715cb1ec9dda0a8fa9 (diff) | |
download | FreeBSD-ports-bb3d5d57f23c6c19a1d5658ccd56f5b05ec8c5b9.zip FreeBSD-ports-bb3d5d57f23c6c19a1d5658ccd56f5b05ec8c5b9.tar.gz |
Use our libc_r instead of linuxthreads.
Reviewed by: Maxim Sobolev <sobomax@altavista.net>
Diffstat (limited to 'devel/sdl')
-rw-r--r-- | devel/sdl/Makefile | 9 | ||||
-rw-r--r-- | devel/sdl/files/patch-ac | 4 | ||||
-rw-r--r-- | devel/sdl/files/patch-ae | 82 | ||||
-rw-r--r-- | devel/sdl/files/patch-af | 45 |
4 files changed, 132 insertions, 8 deletions
diff --git a/devel/sdl/Makefile b/devel/sdl/Makefile index 0c6772f..ca82f50 100644 --- a/devel/sdl/Makefile +++ b/devel/sdl/Makefile @@ -13,9 +13,7 @@ DISTNAME= SDL-${PORTVERSION} MAINTAINER= sobomax@altavista.net -#This port doesn't love FreeBSD pthread :( -LIB_DEPENDS= lthread.2:${PORTSDIR}/devel/linuxthreads \ - esd.2:${PORTSDIR}/audio/esound +LIB_DEPENDS= esd.2:${PORTSDIR}/audio/esound BUILD_DEPENDS= nasm:${PORTSDIR}/devel/nasm USE_GMAKE= yes @@ -25,12 +23,11 @@ GNU_CONFIGURE= yes CONFIGURE_ENV= NASM="${LOCALBASE}/bin/nasm" \ LOCALBASE="${LOCALBASE}" -CFLAGS+= -I${LOCALBASE}/include/pthread/linuxthreads \ - -D_THREAD_SAFE +CFLAGS+= -D_THREAD_SAFE post-install: @ ${MKDIR} ${PREFIX}/share/examples/SDL - @ ${INSTALL_DATA} ${WRKSRC}/test/* ${PREFIX}/share/examples/SDL + @ ${INSTALL_DATA} ${WRKSRC}/test/* ${PREFIX}/share/examples/SDL .if !defined(NOPORTDOCS) @ ${MKDIR} ${PREFIX}/share/doc/SDL .for file in BUGS COPYING CREDITS README WhatsNew docs.html diff --git a/devel/sdl/files/patch-ac b/devel/sdl/files/patch-ac index 83ce505..8585592 100644 --- a/devel/sdl/files/patch-ac +++ b/devel/sdl/files/patch-ac @@ -17,7 +17,7 @@ case "$target" in *-*-freebsd*) - pthread_lib="-lc_r" -+ pthread_lib="-L""$LOCALBASE""/lib -llthread -llgcc_r" ++ pthread_lib="-pthread" ;; *-*-openbsd*) pthread_lib="-lc_r" @@ -26,7 +26,7 @@ if test x$use_pthreads = xyes; then CFLAGS="$CFLAGS -D_REENTRANT -DSDL_USE_PTHREADS" - SDL_CFLAGS="$SDL_CFLAGS -D_REENTRANT" -+ SDL_CFLAGS="$SDL_CFLAGS -D_REENTRANT -D_THREAD_SAFE -I""$LOCALBASE""/include/pthread/linuxthreads" ++ SDL_CFLAGS="$SDL_CFLAGS -D_REENTRANT -D_THREAD_SAFE" SDL_LIBS="$SDL_LIBS $pthread_lib" fi fi diff --git a/devel/sdl/files/patch-ae b/devel/sdl/files/patch-ae new file mode 100644 index 0000000..e879ae7 --- /dev/null +++ b/devel/sdl/files/patch-ae @@ -0,0 +1,82 @@ +--- src/thread/SDL_thread.c.orig Fri Mar 3 01:24:35 2000 ++++ src/thread/SDL_thread.c Mon Apr 17 21:05:52 2000 +@@ -30,6 +30,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> ++#include <unistd.h> + + #include "SDL_error.h" + #include "SDL_mutex.h" +@@ -175,7 +176,7 @@ + int (*func)(void *); + void *data; + SDL_Thread *info; +- SDL_mutex *wait; ++ int wait; + } thread_args; + + void SDL_RunThread(void *data) +@@ -199,8 +200,8 @@ + userdata = args->data; + statusloc = &args->info->status; + + /* Wake up the parent thread */ +- SDL_mutexV(args->wait); ++ args->wait = 1; + + /* Run the function */ + *statusloc = userfunc(userdata); +@@ -213,16 +214,16 @@ + int ret; + + /* Allocate memory for the thread info structure */ +- thread = (SDL_Thread *)malloc(sizeof(*thread)); ++ thread = (SDL_Thread *)malloc(sizeof(thread)); + if ( thread == NULL ) { + SDL_OutOfMemory(); + return(NULL); + } +- memset(thread, 0, (sizeof *thread)); ++ memset(thread, 0, (sizeof thread)); + thread->status = -1; + + /* Set up the arguments for the thread */ +- args = (thread_args *)malloc(sizeof(*args)); ++ args = (thread_args *)malloc(sizeof(args)); + if ( args == NULL ) { + SDL_OutOfMemory(); + free(thread); +@@ -231,14 +232,7 @@ + args->func = fn; + args->data = data; + args->info = thread; +- args->wait = SDL_CreateMutex(); +- if ( args->wait == NULL ) { +- free(thread); +- free(args); +- SDL_OutOfMemory(); +- return(NULL); +- } +- SDL_mutexP(args->wait); /* We will block later */ ++ args->wait = 0; + + /* Add the thread to the list of available threads */ + SDL_AddThread(thread); +@@ -247,14 +241,14 @@ + ret = SDL_SYS_CreateThread(thread, args); + if ( ret >= 0 ) { + /* Wait for the thread function to use arguments */ +- SDL_mutexP(args->wait); ++ while (args->wait == 0) ++ usleep(20000); + } else { + /* Oops, failed. Gotta free everything */ + SDL_DelThread(thread); + free(thread); + thread = NULL; + } +- SDL_DestroyMutex(args->wait); + free(args); + + /* Everything is running now */ diff --git a/devel/sdl/files/patch-af b/devel/sdl/files/patch-af new file mode 100644 index 0000000..28c3cfe --- /dev/null +++ b/devel/sdl/files/patch-af @@ -0,0 +1,45 @@ +--- src/thread/linux/SDL_mutex.c.orig Tue Nov 23 20:01:41 1999 ++++ src/thread/linux/SDL_mutex.c Mon Apr 17 21:08:57 2000 +@@ -42,6 +42,7 @@ + + #ifdef SDL_USE_PTHREADS + ++#include <errno.h> + #include <stdlib.h> + #include <stdio.h> + #include <pthread.h> +@@ -60,14 +61,14 @@ + SDL_mutex *mutex; + + /* Allocate the structure */ +- mutex = (SDL_mutex *)malloc(sizeof(*mutex)); ++ mutex = (SDL_mutex *)malloc(sizeof(mutex)); + if ( mutex == NULL ) { + SDL_OutOfMemory(); + return(NULL); + } + + if ( pthread_mutex_init(&mutex->id, NULL) != 0 ) { +- SDL_SetError("Couldn't create mutex"); ++ SDL_SetError("Couldn't create mutex; reason: %d", errno); + free(mutex); + return(NULL); + } +@@ -82,7 +83,7 @@ + return(-1); + } + if ( pthread_mutex_lock(&mutex->id) != 0 ) { +- SDL_SetError("Couldn't lock mutex"); ++ SDL_SetError("Couldn't lock mutex; reason: %d", errno); + return(-1); + } + return(0); +@@ -96,7 +97,7 @@ + return(-1); + } + if ( pthread_mutex_unlock(&mutex->id) != 0 ) { +- SDL_SetError("Couldn't unlock mutex"); ++ SDL_SetError("Couldn't unlock mutex; reason: %d", errno); + return(-1); + } + return(0); |