Files
haikuports/dev-lang/python/patches/python-3.2.patch
2013-03-29 14:04:07 +00:00

188 lines
7.3 KiB
Diff

diff -urN Python-3.2/Lib/plat-haiku/regen Python-3.2-haiku/Lib/plat-haiku/regen
--- Python-3.2/Lib/plat-haiku/regen 1970-01-01 00:00:00.000000000 +0000
+++ Python-3.2-haiku/Lib/plat-haiku/regen 2010-11-22 11:11:57.509870080 +0000
@@ -0,0 +1,3 @@
+#! /bin/sh
+set -v
+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /boot/develop/headers/posix/netinet/in.h
diff -urN Python-3.2/Modules/resource.c Python-3.2-haiku/Modules/resource.c
--- Python-3.2/Modules/resource.c 2010-05-09 15:52:27.011796480 +0000
+++ Python-3.2-haiku/Modules/resource.c 2010-11-22 11:11:57.581173248 +0000
@@ -86,6 +86,7 @@
PyFloat_FromDouble(doubletime(ru.ru_utime)));
PyStructSequence_SET_ITEM(result, 1,
PyFloat_FromDouble(doubletime(ru.ru_stime)));
+#ifndef __HAIKU__
PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(ru.ru_maxrss));
PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(ru.ru_ixrss));
PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(ru.ru_idrss));
@@ -100,7 +101,7 @@
PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(ru.ru_nsignals));
PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(ru.ru_nvcsw));
PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(ru.ru_nivcsw));
-
+#endif
if (PyErr_Occurred()) {
Py_DECREF(result);
return NULL;
diff -urN Python-3.2/Modules/socketmodule.c Python-3.2-haiku/Modules/socketmodule.c
--- Python-3.2/Modules/socketmodule.c 2010-11-05 17:24:13.021233664 +0000
+++ Python-3.2-haiku/Modules/socketmodule.c 2010-11-22 11:11:57.722468864 +0000
@@ -4684,7 +4684,9 @@
PyModule_AddIntConstant(m, "SOCK_DGRAM", SOCK_DGRAM);
/* We have incomplete socket support. */
PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW);
+#ifndef __HAIKU__
PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET);
+#endif
#if defined(SOCK_RDM)
PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM);
#endif
diff -urN Python-3.2/Modules/socketmodule.h Python-3.2-haiku/Modules/socketmodule.h
--- Python-3.2/Modules/socketmodule.h 2010-08-28 20:42:55.019398656 +0000
+++ Python-3.2-haiku/Modules/socketmodule.h 2010-11-22 11:11:57.790626304 +0000
@@ -47,6 +47,10 @@
# undef AF_NETLINK
#endif
+#if defined (__HAIKU__)
+# undef HAVE_BLUETOOTH_BLUETOOTH_H
+#endif
+
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
diff -urN Python-3.2/Modules/spwdmodule.c Python-3.2-haiku/Modules/spwdmodule.c
--- Python-3.2/Modules/spwdmodule.c 2010-05-15 16:27:27.011534336 +0000
+++ Python-3.2-haiku/Modules/spwdmodule.c 2010-11-22 11:11:57.802422784 +0000
@@ -80,7 +80,9 @@
SETS(setIndex++, p->sp_namp);
SETS(setIndex++, p->sp_pwdp);
+#ifndef __HAIKU__
SETI(setIndex++, p->sp_lstchg);
+#endif
SETI(setIndex++, p->sp_min);
SETI(setIndex++, p->sp_max);
SETI(setIndex++, p->sp_warn);
diff -urN Python-3.2/Python/bltinmodule.c Python-3.2-haiku/Python/bltinmodule.c
--- Python-3.2/Python/bltinmodule.c 2010-10-17 20:54:53.028049408 +0000
+++ Python-3.2-haiku/Python/bltinmodule.c 2010-11-22 11:11:57.832831488 +0000
@@ -22,7 +22,7 @@
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
const char *Py_FileSystemDefaultEncoding = "mbcs";
int Py_HasFileSystemDefaultEncoding = 1;
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__HAIKU__)
const char *Py_FileSystemDefaultEncoding = "utf-8";
int Py_HasFileSystemDefaultEncoding = 1;
#elif defined(HAVE_LANGINFO_H) && defined(CODESET)
diff -urN Python-3.2/configure.in Python-3.2-haiku/configure.in
--- Python-3.2/configure.in 2010-11-01 01:44:30.004980736 +0000
+++ Python-3.2-haiku/configure.in 2010-11-22 11:14:04.316407808 +0000
@@ -292,6 +292,7 @@
case $MACHDEP in
cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";;
+ haiku*) MACHDEP="haiku";;
irix646) MACHDEP="irix6";;
'') MACHDEP="unknown";;
esac
@@ -738,7 +739,7 @@
RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
INSTSONAME="$LDLIBRARY".$SOVERSION
;;
- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|Haiku*)
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
@@ -823,6 +824,7 @@
if test -z "$LN" ; then
case $ac_sys_system in
CYGWIN*) LN="ln -s";;
+ Haiku*) LN="ln -s";;
*) LN=ln;;
esac
fi
@@ -1709,7 +1711,7 @@
fi
fi
;;
- Linux*|GNU*|QNX*)
+ Linux*|GNU*|QNX*|Haiku*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
BSD/OS*/4*)
@@ -1778,7 +1780,7 @@
then CCSHARED="-fPIC";
else CCSHARED="+z";
fi;;
- Linux*|GNU*) CCSHARED="-fPIC";;
+ Linux*|GNU*|Haiku*) CCSHARED="-fPIC";;
BSD/OS*/4*) CCSHARED="-fpic";;
FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
OpenUNIX*|UnixWare*)
@@ -1809,7 +1811,7 @@
LINKFORSHARED="-Wl,-E -Wl,+s";;
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
- Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
+ Linux*|GNU*|Haiku*) LINKFORSHARED="-Xlinker -export-dynamic";;
# -u libsys_s pulls in all symbols in libsys
Darwin/*)
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
@@ -1920,6 +1922,8 @@
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
+AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS) # For Haiku
+
AC_MSG_CHECKING(for --with-libs)
AC_ARG_WITH(libs,
AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
@@ -3192,7 +3196,7 @@
# check for --with-libm=...
AC_SUBST(LIBM)
case $ac_sys_system in
-Darwin) ;;
+Darwin|Haiku*) ;;
*) LIBM=-lm
esac
AC_MSG_CHECKING(for --with-libm=STRING)
diff -urN Python-3.2/setup.py Python-3.2-haiku/setup.py
--- Python-3.2/setup.py 2010-10-31 17:11:02.000000000 +0000
+++ Python-3.2-haiku/setup.py 2010-11-22 11:11:58.034603008 +0000
@@ -429,6 +429,10 @@
platform = self.get_platform()
srcdir = sysconfig.get_config_var('srcdir')
+ if platform == 'haiku1':
+ inc_dirs += ['/boot/develop/headers/posix', '/boot/develop/headers/3rdparty', '/boot/common/include']
+ lib_dirs += ['/boot/system/lib', '/boot/develop/lib/x86', '/boot/common/lib']
+
# OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
if platform in ['osf1', 'unixware7', 'openunix8']:
lib_dirs += ['/usr/ccs/lib']
@@ -450,9 +454,9 @@
if item.startswith('-L'):
lib_dirs.append(item[2:])
- # Check for MacOS X, which doesn't need libm.a at all
+ # Check for MacOS X or Haiku, which don't need libm.a at all
math_libs = ['m']
- if platform == 'darwin':
+ if platform == 'darwin' or platform == 'haiku':
math_libs = []
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
@@ -1110,7 +1114,7 @@
exts.append( Extension('resource', ['resource.c']) )
# Sun yellow pages. Some systems have the functions in libc.
- if (platform not in ['cygwin', 'qnx6'] and
+ if (platform not in ['cygwin', 'qnx6', 'haiku'] and
find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
if (self.compiler.find_library_file(lib_dirs, 'nsl')):
libs = ['nsl']