update package pthreads

This commit is contained in:
Mark Brand 2012-05-27 22:12:14 +02:00
parent 2613e25a91
commit 6b59104763
4 changed files with 33 additions and 156 deletions

View File

@ -1745,7 +1745,7 @@ USE_OSGPLUGIN(<plugin2>)
</tr>
<tr>
<td id="pthreads-package">pthreads</td>
<td id="pthreads-version">2-8-0</td>
<td id="pthreads-version">2-9-1</td>
<td id="pthreads-website"><a href="http://sourceware.org/pthreads-win32/">Pthreads-w32</a></td>
</tr>
<tr>

View File

@ -1,150 +0,0 @@
This file is part of MXE.
See index.html for further information.
This patch has been taken from:
http://sourceware.org/ml/pthreads-win32/2010/msg00006.html
diff -ur pthreads-win32-20091019.orig/GNUmakefile pthreads-win32-20091019/GNUmakefile
--- pthreads-win32-20091019.orig/GNUmakefile 2009-10-19 08:07:32.000000000 -0200
+++ pthreads-win32-20091019/GNUmakefile 2010-02-01 14:45:28.471432337 -0200
@@ -63,7 +63,6 @@
XOPT =
RCFLAGS = --include-dir=.
-LFLAGS = -lwsock32
# ----------------------------------------------------------------------
# The library can be built with some alternative behaviour to
diff -ur pthreads-win32-20091019.orig/pthread.c pthreads-win32-20091019/pthread.c
--- pthreads-win32-20091019.orig/pthread.c 2009-10-19 08:07:32.000000000 -0200
+++ pthreads-win32-20091019/pthread.c 2010-02-01 14:26:48.601487556 -0200
@@ -49,6 +49,7 @@
#include "condvar.c"
#include "create.c"
#include "dll.c"
+#include "autostatic.c"
#include "errno.c"
#include "exit.c"
#include "fork.c"
diff -ur pthreads-win32-20091019.orig/pthread_getspecific.c pthreads-win32-20091019/pthread_getspecific.c
--- pthreads-win32-20091019.orig/pthread_getspecific.c 2009-10-19 08:07:32.000000000 -0200
+++ pthreads-win32-20091019/pthread_getspecific.c 2010-02-01 14:28:36.603981857 -0200
@@ -72,12 +72,10 @@
else
{
int lasterror = GetLastError ();
- int lastWSAerror = WSAGetLastError ();
ptr = TlsGetValue (key->key);
SetLastError (lasterror);
- WSASetLastError (lastWSAerror);
}
return ptr;
diff -ur pthreads-win32-20091019.orig/pthread.h pthreads-win32-20091019/pthread.h
--- pthreads-win32-20091019.orig/pthread.h 2009-10-19 08:07:32.000000000 -0200
+++ pthreads-win32-20091019/pthread.h 2010-02-02 16:51:05.047931915 -0200
@@ -533,7 +533,7 @@
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
-#ifndef PTW32_STATIC_LIB
+#if !defined(PTW32_STATIC_LIB) && !defined(__MINGW32__)
# ifdef PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
# else
diff -ur pthreads-win32-20091019.orig/sched.h pthreads-win32-20091019/sched.h
--- pthreads-win32-20091019.orig/sched.h 2009-10-19 08:07:32.000000000 -0200
+++ pthreads-win32-20091019/sched.h 2010-02-02 16:51:00.665887720 -0200
@@ -76,7 +76,7 @@
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
-#ifndef PTW32_STATIC_LIB
+#if !defined(PTW32_STATIC_LIB) && !defined(__MINGW32__)
# ifdef PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
# else
diff -ur pthreads-win32-20091019.orig/semaphore.h pthreads-win32-20091019/semaphore.h
--- pthreads-win32-20091019.orig/semaphore.h 2009-10-19 08:07:32.000000000 -0200
+++ pthreads-win32-20091019/semaphore.h 2010-02-02 16:50:45.916576916 -0200
@@ -75,7 +75,7 @@
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
-#ifndef PTW32_STATIC_LIB
+#if !defined(PTW32_STATIC_LIB) && !defined(__MINGW32__)
# ifdef PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
# else
--- /dev/null 2010-01-29 12:57:37.677072272 -0200
+++ pthreads-win32-20091019/autostatic.c 2010-02-01 14:26:48.601487556 -0200
@@ -0,0 +1,67 @@
+/*
+ * autostatic.c
+ *
+ * Description:
+ * This translation unit implements static library initialisation.
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2005 Pthreads-win32 contributors
+ *
+ * Contact Email: rpj@callisto.canberra.edu.au
+ *
+ * The current list of contributors is contained
+ * in the file CONTRIBUTORS included with the source
+ * code distribution. The list can also be seen at the
+ * following World Wide Web location:
+ * http://sources.redhat.com/pthreads-win32/contributors.html
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifdef PTW32_STATIC_LIB
+
+#include "pthread.h"
+#include "implement.h"
+
+static void on_process_init(void)
+{
+ pthread_win32_process_attach_np ();
+}
+
+static void on_process_exit(void)
+{
+ pthread_win32_thread_detach_np ();
+ pthread_win32_process_detach_np ();
+}
+
+#ifdef __MINGW32__
+# define attribute_section(a) __attribute__((section(a)))
+#elif defined(_MSC_VER)
+# define attribute_section(a) __pragma(section(a,long,read)); __declspec(allocate(a))
+#else
+#error compiler not supported!
+#endif
+
+attribute_section(".CRT$XCU") void *msc_ctor = on_process_init;
+attribute_section(".CRT$XPU") void *msc_dtor = on_process_exit;
+
+attribute_section(".ctors" ) void *gcc_ctor = on_process_init;
+attribute_section(".dtors" ) void *gcc_dtor = on_process_exit;
+
+#endif /* PTW32_STATIC_LIB */

View File

@ -0,0 +1,31 @@
This file is part of MXE.
See index.html for further information.
Commits backported (cherry-picked) from upstream.
From 9348978f78c6feae6e9bab4499ab035c6e5e25ea Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sun, 27 May 2012 22:00:19 +0200
Subject: [PATCH] force static for convenience
---
pthread.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pthread.h b/pthread.h
index b4072f7..c88c886 100755
--- a/pthread.h
+++ b/pthread.h
@@ -547,6 +547,10 @@ extern "C"
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
+
+// MXE: Set this for convenience here since MXE only does static.
+#define PTW32_STATIC_LIB
+
#if !defined(PTW32_STATIC_LIB)
# if defined(PTW32_BUILD)
# define PTW32_DLLPORT __declspec (dllexport)
--
1.7.9.2

View File

@ -3,7 +3,7 @@
PKG := pthreads
$(PKG)_IGNORE :=
$(PKG)_CHECKSUM := da8371cb20e8e238f96a1d0651212f154d84a9ac
$(PKG)_CHECKSUM := 24d40e89c2e66a765733e8c98d6f94500343da86
$(PKG)_SUBDIR := pthreads-w32-$($(PKG)_VERSION)-release
$(PKG)_FILE := pthreads-w32-$($(PKG)_VERSION)-release.tar.gz
$(PKG)_URL := ftp://sourceware.org/pub/pthreads-win32/$($(PKG)_FILE)
@ -17,10 +17,6 @@ define $(PKG)_UPDATE
endef
define $(PKG)_BUILD
$(SED) -i '35i\#define PTW32_STATIC_LIB' '$(1)/pthread.h'
$(SED) -i '41i\#define PTW32_STATIC_LIB' '$(1)/sched.h'
$(SED) -i '41i\#define PTW32_STATIC_LIB' '$(1)/semaphore.h'
$(SED) -i 's,#include "config.h",,' '$(1)/pthread.h'
$(MAKE) -C '$(1)' -j 1 GC-static CROSS='$(TARGET)-'
$(INSTALL) -d '$(PREFIX)/$(TARGET)/lib'
$(INSTALL) -m644 '$(1)/libpthreadGC2.a' '$(PREFIX)/$(TARGET)/lib/libpthread.a'