diff -urN orig/Python-2.6.8/configure.in Python-2.6.8/configure.in --- orig/Python-2.6.8/configure.in 2012-04-10 17:32:11.057409536 +0200 +++ Python-2.6.8/configure.in 2013-05-03 15:23:53.332922880 +0200 @@ -745,7 +745,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$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} @@ -753,6 +753,9 @@ FreeBSD*) SOVERSION=`echo $SOVERSION|cut -d "." -f 1` ;; + Haiku*) + RUNSHARED=LIBRARY_PATH=`pwd`:${LIBRARY_PATH} + ;; esac INSTSONAME="$LDLIBRARY".$SOVERSION ;; @@ -823,7 +826,7 @@ AC_SUBST(LN) if test -z "$LN" ; then case $ac_sys_system in - BeOS*) LN="ln -s";; + BeOS*|Haiku*) LN="ln -s";; CYGWIN*) LN="ln -s";; atheos*) LN="ln -s";; *) LN=ln;; @@ -1829,7 +1832,7 @@ fi fi ;; - Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';; + Linux*|GNU*|QNX*|Haiku*) LDSHARED='$(CC) -shared';; BSD/OS*/4*) LDSHARED="gcc -shared";; FreeBSD*) if [[ "`$CC -dM -E - -#include +#include #include "structmember.h" #ifdef WITH_THREAD diff -urN orig/Python-2.6.8/Modules/resource.c Python-2.6.8/Modules/resource.c --- orig/Python-2.6.8/Modules/resource.c 2012-04-10 17:32:10.057147392 +0200 +++ Python-2.6.8/Modules/resource.c 2013-05-03 15:23:53.340787200 +0200 @@ -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, PyInt_FromLong(ru.ru_maxrss)); PyStructSequence_SET_ITEM(result, 3, PyInt_FromLong(ru.ru_ixrss)); PyStructSequence_SET_ITEM(result, 4, PyInt_FromLong(ru.ru_idrss)); @@ -100,7 +101,7 @@ PyStructSequence_SET_ITEM(result, 13, PyInt_FromLong(ru.ru_nsignals)); PyStructSequence_SET_ITEM(result, 14, PyInt_FromLong(ru.ru_nvcsw)); PyStructSequence_SET_ITEM(result, 15, PyInt_FromLong(ru.ru_nivcsw)); - +#endif if (PyErr_Occurred()) { Py_DECREF(result); return NULL; diff -urN orig/Python-2.6.8/Modules/socketmodule.c Python-2.6.8/Modules/socketmodule.c --- orig/Python-2.6.8/Modules/socketmodule.c 2012-04-10 17:32:10.066846720 +0200 +++ Python-2.6.8/Modules/socketmodule.c 2013-05-03 15:23:53.342622208 +0200 @@ -4661,7 +4661,9 @@ #ifndef __BEOS__ /* We have incomplete socket support. */ PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW); - PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET); +#ifndef __HAIKU__ + PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET); +#endif #if defined(SOCK_RDM) PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM); #endif diff -urN orig/Python-2.6.8/Modules/socketmodule.h Python-2.6.8/Modules/socketmodule.h --- orig/Python-2.6.8/Modules/socketmodule.h 2012-04-10 17:32:10.006029312 +0200 +++ Python-2.6.8/Modules/socketmodule.h 2013-05-03 15:23:53.343146496 +0200 @@ -47,6 +47,10 @@ # undef AF_NETLINK #endif +#if defined(__HAIKU__) +#undef HAVE_BLUETOOTH_BLUETOOTH_H +#endif + #ifdef HAVE_BLUETOOTH_BLUETOOTH_H #include #include diff -urN orig/Python-2.6.8/Modules/spwdmodule.c Python-2.6.8/Modules/spwdmodule.c --- orig/Python-2.6.8/Modules/spwdmodule.c 2012-04-10 17:32:10.033554432 +0200 +++ Python-2.6.8/Modules/spwdmodule.c 2013-05-03 15:23:53.343670784 +0200 @@ -79,7 +79,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 orig/Python-2.6.8/Python/bltinmodule.c Python-2.6.8/Python/bltinmodule.c --- orig/Python-2.6.8/Python/bltinmodule.c 2012-04-10 17:32:11.047710208 +0200 +++ Python-2.6.8/Python/bltinmodule.c 2013-05-03 15:23:53.344981504 +0200 @@ -18,7 +18,7 @@ */ #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) const char *Py_FileSystemDefaultEncoding = "mbcs"; -#elif defined(__APPLE__) +#elif defined(__APPLE__) || defined(__HAIKU__) const char *Py_FileSystemDefaultEncoding = "utf-8"; #else const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ diff -urN orig/Python-2.6.8/setup.py Python-2.6.8/setup.py --- orig/Python-2.6.8/setup.py 2012-04-10 17:32:11.057147392 +0200 +++ Python-2.6.8/setup.py 2013-05-03 15:23:53.346816512 +0200 @@ -428,6 +428,10 @@ inc_dirs += ['/system/include', '/atheos/autolnk/include'] inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) + if platform == 'haiku1': + inc_dirs += ['/boot/common/non-packaged/develop/headers', '/boot/common/develop/headers', '/boot/system/develop/headers/posix', '/boot/system/develop/headers/3rdparty'] + lib_dirs += ['/boot/common/non-packaged/develop/lib', '/boot/common/develop/lib', '/boot/system/develop/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'] @@ -451,7 +455,7 @@ # Check for MacOS X, which doesn't need libm.a at all math_libs = ['m'] - if platform in ['darwin', 'beos', 'mac']: + if platform in ['darwin', 'beos', 'haiku1', 'mac']: math_libs = [] # XXX Omitted modules: gl, pure, dl, SGI-specific modules @@ -694,15 +698,22 @@ '/usr/local/ssl/include', '/usr/contrib/ssl/include/' ] - ssl_incs = find_file('openssl/ssl.h', inc_dirs, + ssl_incs = find_file('openssl/ssl.h', [], + inc_dirs + search_for_ssl_incs_in + ) + ssl_incs_to_add = find_file('openssl/ssl.h', inc_dirs, search_for_ssl_incs_in ) if ssl_incs is not None: krb5_h = find_file('krb5.h', inc_dirs, ['/usr/kerberos/include']) if krb5_h: - ssl_incs += krb5_h - ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, + ssl_incs_to_add += krb5_h + ssl_libs = find_library_file(self.compiler, 'ssl', [], + lib_dirs + ['/usr/local/ssl/lib', + '/usr/contrib/ssl/lib/' + ] ) + ssl_libs_to_add = find_library_file(self.compiler, 'ssl', lib_dirs, ['/usr/local/ssl/lib', '/usr/contrib/ssl/lib/' ] ) @@ -710,8 +721,8 @@ if (ssl_incs is not None and ssl_libs is not None): exts.append( Extension('_ssl', ['_ssl.c'], - include_dirs = ssl_incs, - library_dirs = ssl_libs, + include_dirs = ssl_incs_to_add, + library_dirs = ssl_libs_to_add, libraries = ['ssl', 'crypto'], depends = ['socketmodule.h']), ) else: @@ -746,8 +757,8 @@ # The _hashlib module wraps optimized implementations # of hash functions from the OpenSSL library. exts.append( Extension('_hashlib', ['_hashopenssl.c'], - include_dirs = ssl_incs, - library_dirs = ssl_libs, + include_dirs = ssl_incs_to_add, + library_dirs = ssl_libs_to_add, libraries = ['ssl', 'crypto']) ) # these aren't strictly missing since they are unneeded. #missing.extend(['_sha', '_md5']) @@ -1176,7 +1187,7 @@ missing.append('resource') # Sun yellow pages. Some systems have the functions in libc. - if (platform not in ['cygwin', 'atheos', 'qnx6'] and + if (platform not in ['cygwin', 'atheos', 'qnx6', 'haiku1'] and find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): if (self.compiler.find_library_file(lib_dirs, 'nsl')): libs = ['nsl'] diff -urN orig/Python-2.6.8/Tools/scripts/h2py.py Python-2.6.8/Tools/scripts/h2py.py --- orig/Python-2.6.8/Tools/scripts/h2py.py 2012-04-10 17:32:11.043253760 +0200 +++ Python-2.6.8/Tools/scripts/h2py.py 2013-05-03 15:23:53.347340800 +0200 @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /bin/env python # Read #define's and translate to Python code. # Handle #include statements. @@ -50,7 +50,7 @@ searchdirs=os.environ['INCLUDE'].split(';') except KeyError: try: - if sys.platform.find("beos") == 0: + if sys.platform.find("beos") == 0 or sys.platform.find("haiku1") == 0: searchdirs=os.environ['BEINCLUDES'].split(';') elif sys.platform.startswith("atheos"): searchdirs=os.environ['C_INCLUDE_PATH'].split(':')