From 38c30f64736bdef12d115be25dd55b876fcd835f Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 9 Mar 2005 19:28:10 +0000 Subject: Fix the thread stacksize for 64-bit platforms, but only adjust the stacksize on FreeBSD versions that need it. git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@3905 df743ca5-7f9a-e211-a948-0013205c9059 --- devel/glib20/Makefile | 9 +++++- .../files/extra-patch-gthread_gthread-posix.c | 32 ++++++++++++++++++++++ devel/glib20/files/patch-gthread_gthread-posix.c | 32 ++++------------------ 3 files changed, 45 insertions(+), 28 deletions(-) create mode 100644 devel/glib20/files/extra-patch-gthread_gthread-posix.c (limited to 'devel/glib20') diff --git a/devel/glib20/Makefile b/devel/glib20/Makefile index 783fc928a..a6d5ad9a0 100644 --- a/devel/glib20/Makefile +++ b/devel/glib20/Makefile @@ -7,6 +7,7 @@ PORTNAME= glib PORTVERSION= 2.6.3 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= ${MASTER_SITE_GNOME:S,%SUBDIR%,sources/${PORTNAME}/2.6,} \ ftp://ftp.gtk.org/pub/gtk/v2.6/ \ @@ -38,9 +39,15 @@ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \ PTHREAD_LIBS="${PTHREAD_LIBS}" +.include + +.if ${OSVERSION} < 600012 +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-gthread_gthread-posix.c +.endif + post-patch: @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g ; \ s|%%X11BASE%%|${X11BASE}|g' \ ${WRKSRC}/glib/gutils.c -.include +.include diff --git a/devel/glib20/files/extra-patch-gthread_gthread-posix.c b/devel/glib20/files/extra-patch-gthread_gthread-posix.c new file mode 100644 index 000000000..8796dd629 --- /dev/null +++ b/devel/glib20/files/extra-patch-gthread_gthread-posix.c @@ -0,0 +1,32 @@ +--- gthread/gthread-posix.c.orig Mon Nov 1 13:47:12 2004 ++++ gthread/gthread-posix.c Wed Mar 9 14:21:20 2005 +@@ -115,7 +115,11 @@ + # define PRIORITY_NORMAL_VALUE priority_normal_value + #endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */ + ++#define G_THREAD_STACK_SIZE32 (1*1024*1024) ++#define G_THREAD_STACK_SIZE64 (2*1024*1024) ++ + static gulong g_thread_min_stack_size = 0; ++static gulong g_thread_default_stack_size = 0; + + #define G_MUTEX_SIZE (sizeof (pthread_mutex_t)) + +@@ -307,8 +312,16 @@ + if (stack_size) + { + stack_size = MAX (g_thread_min_stack_size, stack_size); +- posix_check_cmd (pthread_attr_setstacksize (&attr, stack_size)); + } ++ else ++ { ++ if (sizeof(void *) == 8) ++ g_thread_default_stack_size = G_THREAD_STACK_SIZE64; ++ else ++ g_thread_default_stack_size = G_THREAD_STACK_SIZE32; ++ stack_size = MAX (g_thread_min_stack_size, g_thread_default_stack_size); ++ } ++ posix_check_cmd (pthread_attr_setstacksize (&attr, stack_size)); + #endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */ + + #ifdef PTHREAD_SCOPE_SYSTEM diff --git a/devel/glib20/files/patch-gthread_gthread-posix.c b/devel/glib20/files/patch-gthread_gthread-posix.c index bdf24590d..47c5ab8f1 100644 --- a/devel/glib20/files/patch-gthread_gthread-posix.c +++ b/devel/glib20/files/patch-gthread_gthread-posix.c @@ -1,15 +1,7 @@ ---- gthread/gthread-posix.c.orig Tue Sep 7 17:57:53 2004 -+++ gthread/gthread-posix.c Tue Sep 7 17:58:30 2004 -@@ -116,6 +116,7 @@ - #endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */ - - static gulong g_thread_min_stack_size = 0; -+static gulong g_thread_default_stack_size = 0x100000; - - #define G_MUTEX_SIZE (sizeof (pthread_mutex_t)) - -@@ -125,7 +126,8 @@ - g_thread_impl_init() +--- gthread/gthread-posix.c.orig Mon Nov 1 13:47:12 2004 ++++ gthread/gthread-posix.c Wed Mar 9 14:21:20 2005 +@@ -125,7 +129,8 @@ + g_thread_impl_init(void) { #ifdef _SC_THREAD_STACK_MIN - g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0); @@ -18,7 +10,7 @@ #endif /* _SC_THREAD_STACK_MIN */ #ifdef HAVE_PRIORITIES # ifdef G_THREADS_IMPL_POSIX -@@ -176,7 +178,7 @@ +@@ -176,7 +181,7 @@ result = pthread_mutex_trylock ((pthread_mutex_t *) mutex); #ifdef G_THREADS_IMPL_POSIX @@ -27,17 +19,3 @@ return FALSE; #else /* G_THREADS_IMPL_DCE */ if (result == 0) -@@ -307,8 +309,12 @@ - if (stack_size) - { - stack_size = MAX (g_thread_min_stack_size, stack_size); -- posix_check_cmd (pthread_attr_setstacksize (&attr, stack_size)); - } -+ else -+ { -+ stack_size = MAX (g_thread_min_stack_size, g_thread_default_stack_size); -+ } -+ posix_check_cmd (pthread_attr_setstacksize (&attr, stack_size)); - #endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */ - - #ifdef PTHREAD_SCOPE_SYSTEM -- cgit v1.2.3