xref: /AOO41X/main/python/python-freebsd.patch (revision 0a45483e01a86ec7714287aa9352d33c2279579a)
1*0a45483eSPedro GiffuniOnly in misc/build/Python-2.7.3/Lib: plat-freebsd9
2*0a45483eSPedro Giffunidiff -ru misc/Python-2.7.3/Lib/test/test_threading.py misc/build/Python-2.7.3/Lib/test/test_threading.py
3*0a45483eSPedro Giffuni--- misc/Python-2.7.3/Lib/test/test_threading.py	2012-04-09 18:07:32.000000000 -0500
4*0a45483eSPedro Giffuni+++ misc/build/Python-2.7.3/Lib/test/test_threading.py	2012-07-24 22:39:03.000000000 -0500
5*0a45483eSPedro Giffuni@@ -421,7 +421,7 @@
6*0a45483eSPedro Giffuni     # #12316 and #11870), and fork() from a worker thread is known to trigger
7*0a45483eSPedro Giffuni     # problems with some operating systems (issue #3863): skip problematic tests
8*0a45483eSPedro Giffuni     # on platforms known to behave badly.
9*0a45483eSPedro Giffuni-    platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
10*0a45483eSPedro Giffuni+    platforms_to_skip = ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9', 'netbsd5',
11*0a45483eSPedro Giffuni                          'os2emx')
12*0a45483eSPedro Giffuni
13*0a45483eSPedro Giffuni     def _run_and_join(self, script):
14*0a45483eSPedro Giffunidiff -ru misc/Python-2.7.3/Modules/_ctypes/libffi/configure misc/build/Python-2.7.3/Modules/_ctypes/libffi/configure
15*0a45483eSPedro Giffuni--- misc/Python-2.7.3/Modules/_ctypes/libffi/configure	2012-04-09 18:07:33.000000000 -0500
16*0a45483eSPedro Giffuni+++ misc/build/Python-2.7.3/Modules/_ctypes/libffi/configure	2012-07-24 22:39:03.000000000 -0500
17*0a45483eSPedro Giffuni@@ -6289,7 +6289,7 @@
18*0a45483eSPedro Giffuni   rm -rf conftest*
19*0a45483eSPedro Giffuni   ;;
20*0a45483eSPedro Giffuni
21*0a45483eSPedro Giffuni-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
22*0a45483eSPedro Giffuni+amd64-*-freebsd*|x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
23*0a45483eSPedro Giffuni s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
24*0a45483eSPedro Giffuni   # Find out which ABI we are using.
25*0a45483eSPedro Giffuni   echo 'int i;' > conftest.$ac_ext
26*0a45483eSPedro Giffunidiff -ru misc/Python-2.7.3/Python/thread_pthread.h misc/build/Python-2.7.3/Python/thread_pthread.h
27*0a45483eSPedro Giffuni--- misc/Python-2.7.3/Python/thread_pthread.h	2012-04-09 18:07:35.000000000 -0500
28*0a45483eSPedro Giffuni+++ misc/build/Python-2.7.3/Python/thread_pthread.h	2012-07-24 22:39:03.000000000 -0500
29*0a45483eSPedro Giffuni@@ -56,7 +56,6 @@
30*0a45483eSPedro Giffuni    in default setting.  So the process scope is preferred to get
31*0a45483eSPedro Giffuni    enough number of threads to work. */
32*0a45483eSPedro Giffuni #ifdef __FreeBSD__
33*0a45483eSPedro Giffuni-#include <osreldate.h>
34*0a45483eSPedro Giffuni #if __FreeBSD_version >= 500000 && __FreeBSD_version < 504101
35*0a45483eSPedro Giffuni #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
36*0a45483eSPedro Giffuni #endif
37*0a45483eSPedro Giffuni@@ -161,6 +160,9 @@
38*0a45483eSPedro Giffuni {
39*0a45483eSPedro Giffuni     pthread_t th;
40*0a45483eSPedro Giffuni     int status;
41*0a45483eSPedro Giffuni+#ifdef __FreeBSD__
42*0a45483eSPedro Giffuni+	sigset_t set, oset;
43*0a45483eSPedro Giffuni+#endif
44*0a45483eSPedro Giffuni #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
45*0a45483eSPedro Giffuni     pthread_attr_t attrs;
46*0a45483eSPedro Giffuni #endif
47*0a45483eSPedro Giffuni@@ -172,6 +174,9 @@
48*0a45483eSPedro Giffuni     if (!initialized)
49*0a45483eSPedro Giffuni         PyThread_init_thread();
50*0a45483eSPedro Giffuni
51*0a45483eSPedro Giffuni+#ifdef __FreeBSD__
52*0a45483eSPedro Giffuni+	SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
53*0a45483eSPedro Giffuni+#endif
54*0a45483eSPedro Giffuni #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
55*0a45483eSPedro Giffuni     if (pthread_attr_init(&attrs) != 0)
56*0a45483eSPedro Giffuni         return -1;
57*0a45483eSPedro Giffuni@@ -189,7 +194,10 @@
58*0a45483eSPedro Giffuni #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
59*0a45483eSPedro Giffuni     pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
60*0a45483eSPedro Giffuni #endif
61*0a45483eSPedro Giffuni-
62*0a45483eSPedro Giffuni+#ifdef __FreeBSD__
63*0a45483eSPedro Giffuni+	sigfillset(&set);
64*0a45483eSPedro Giffuni+	SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
65*0a45483eSPedro Giffuni+#endif
66*0a45483eSPedro Giffuni     status = pthread_create(&th,
67*0a45483eSPedro Giffuni #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
68*0a45483eSPedro Giffuni                              &attrs,
69*0a45483eSPedro Giffuni@@ -200,6 +208,9 @@
70*0a45483eSPedro Giffuni                              (void *)arg
71*0a45483eSPedro Giffuni                              );
72*0a45483eSPedro Giffuni
73*0a45483eSPedro Giffuni+#ifdef __FreeBSD__
74*0a45483eSPedro Giffuni+	SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
75*0a45483eSPedro Giffuni+#endif
76*0a45483eSPedro Giffuni #if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
77*0a45483eSPedro Giffuni     pthread_attr_destroy(&attrs);
78*0a45483eSPedro Giffuni #endif
79*0a45483eSPedro Giffunidiff -ru misc/Python-2.7.3/configure misc/build/Python-2.7.3/configure
80*0a45483eSPedro Giffuni--- misc/Python-2.7.3/configure	2012-04-09 18:07:36.000000000 -0500
81*0a45483eSPedro Giffuni+++ misc/build/Python-2.7.3/configure	2012-07-24 22:39:03.000000000 -0500
82*0a45483eSPedro Giffuni@@ -4916,7 +4916,7 @@
83*0a45483eSPedro Giffuni           ;;
84*0a45483eSPedro Giffuni     SunOS*)
85*0a45483eSPedro Giffuni 	  LDLIBRARY='libpython$(VERSION).so'
86*0a45483eSPedro Giffuni-	  BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
87*0a45483eSPedro Giffuni+	  BLDLIBRARY=-R\'\$\$ORIGIN\'' -L. -lpython$(VERSION)'
88*0a45483eSPedro Giffuni 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
89*0a45483eSPedro Giffuni 	  INSTSONAME="$LDLIBRARY".$SOVERSION
90*0a45483eSPedro Giffuni           ;;
91*0a45483eSPedro Giffuni@@ -4924,11 +4924,6 @@
92*0a45483eSPedro Giffuni 	  LDLIBRARY='libpython$(VERSION).so'
93*0a45483eSPedro Giffuni 	  BLDLIBRARY='-L. -lpython$(VERSION)'
94*0a45483eSPedro Giffuni 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
95*0a45483eSPedro Giffuni-	  case $ac_sys_system in
96*0a45483eSPedro Giffuni-	      FreeBSD*)
97*0a45483eSPedro Giffuni-		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
98*0a45483eSPedro Giffuni-		;;
99*0a45483eSPedro Giffuni-	  esac
100*0a45483eSPedro Giffuni 	  INSTSONAME="$LDLIBRARY".$SOVERSION
101*0a45483eSPedro Giffuni 	  ;;
102*0a45483eSPedro Giffuni     hp*|HP*)
103*0a45483eSPedro Giffunidiff -ru misc/Python-2.7.3/setup.py misc/build/Python-2.7.3/setup.py
104*0a45483eSPedro Giffuni--- misc/Python-2.7.3/setup.py	2012-04-09 18:07:36.000000000 -0500
105*0a45483eSPedro Giffuni+++ misc/build/Python-2.7.3/setup.py	2012-07-24 22:39:03.000000000 -0500
106*0a45483eSPedro Giffuni@@ -1432,7 +1432,7 @@
107*0a45483eSPedro Giffuni             macros = dict()
108*0a45483eSPedro Giffuni             libraries = []
109*0a45483eSPedro Giffuni
110*0a45483eSPedro Giffuni-        elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
111*0a45483eSPedro Giffuni+        elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9'):
112*0a45483eSPedro Giffuni             # FreeBSD's P1003.1b semaphore support is very experimental
113*0a45483eSPedro Giffuni             # and has many known problems. (as of June 2008)
114*0a45483eSPedro Giffuni             macros = dict()
115*0a45483eSPedro Giffuni@@ -1484,7 +1484,7 @@
116*0a45483eSPedro Giffuni             missing.append('linuxaudiodev')
117*0a45483eSPedro Giffuni
118*0a45483eSPedro Giffuni         if (platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
119*0a45483eSPedro Giffuni-                        'freebsd7', 'freebsd8')
120*0a45483eSPedro Giffuni+                        'freebsd7', 'freebsd8', 'freebsd9')
121*0a45483eSPedro Giffuni             or platform.startswith("gnukfreebsd")):
122*0a45483eSPedro Giffuni             exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
123*0a45483eSPedro Giffuni         else:
124