diff -urN Python-2.5.2/Modules/_ctypes/libffi/configure.ac Python-2.5.2-haiku/Modules/_ctypes/libffi/configure.ac --- Python-2.5.2/Modules/_ctypes/libffi/configure.ac 2007-09-04 23:47:16.000000000 +0000 +++ Python-2.5.2-haiku/Modules/_ctypes/libffi/configure.ac 2008-10-09 18:14:32.000000000 +0000 @@ -34,6 +34,7 @@ i*86-*-solaris2.1[[0-9]]*) TARGET=X86_64; TARGETDIR=x86;; i*86-*-solaris*) TARGET=X86; TARGETDIR=x86;; i*86-*-beos*) TARGET=X86; TARGETDIR=x86;; +i*86-*-haiku*) TARGET=X86; TARGETDIR=x86;; i*86-*-freebsd* | i*86-*-kfreebsd*-gnu) TARGET=X86; TARGETDIR=x86;; i*86-*-netbsdelf* | i*86-*-knetbsd*-gnu) TARGET=X86; TARGETDIR=x86;; i*86-*-openbsd*) TARGET=X86; TARGETDIR=x86;; diff -urN Python-2.5.2/Modules/resource.c Python-2.5.2-haiku/Modules/resource.c --- Python-2.5.2/Modules/resource.c 2006-05-29 21:04:52.000000000 +0000 +++ Python-2.5.2-haiku/Modules/resource.c 2008-10-09 18:14:32.000000000 +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, 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,6 +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); diff -urN Python-2.5.2/Modules/selectmodule.c Python-2.5.2-haiku/Modules/selectmodule.c --- Python-2.5.2/Modules/selectmodule.c 2006-07-10 01:18:57.000000000 +0000 +++ Python-2.5.2-haiku/Modules/selectmodule.c 2008-10-09 18:14:32.000000000 +0000 @@ -49,7 +49,7 @@ # include #else # define SOCKET int -# ifdef __BEOS__ +# if defined(__BEOS__) && !defined(__HAIKU__) # include # elif defined(__VMS) # include diff -urN Python-2.5.2/Modules/socketmodule.c Python-2.5.2-haiku/Modules/socketmodule.c --- Python-2.5.2/Modules/socketmodule.c 2007-03-31 18:56:11.000000000 +0000 +++ Python-2.5.2-haiku/Modules/socketmodule.c 2008-10-09 18:14:33.000000000 +0000 @@ -244,7 +244,7 @@ # include /* Headers needed for inet_ntoa() and inet_addr() */ -# ifdef __BEOS__ +# if defined(__BEOS__) && !defined(__HAIKU__) # include # elif defined(PYOS_OS2) && defined(PYCC_VACPP) # include @@ -336,7 +336,7 @@ #include "getnameinfo.c" #endif -#if defined(MS_WINDOWS) || defined(__BEOS__) +#if defined(MS_WINDOWS) || (defined(__BEOS__) && !defined(__HAIKU__)) /* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */ /* seem to be a few differences in the API */ #define SOCKETCLOSE closesocket @@ -667,7 +667,7 @@ #endif Py_BEGIN_ALLOW_THREADS -#ifdef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) block = !block; setsockopt(s->sock_fd, SOL_SOCKET, SO_NONBLOCK, (void *)(&block), sizeof(int)); @@ -696,7 +696,7 @@ block = !block; socketioctl(s->sock_fd, FIONBIO, (u_long*)&block); #endif /* RISCOS */ -#endif /* __BEOS__ */ +#endif /* defined(__BEOS__) && !defined(__HAIKU__) */ Py_END_ALLOW_THREADS /* Since these don't return anything */ @@ -1021,7 +1021,7 @@ return Py_None; } -#ifdef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) /* XXX: BeOS version of accept() doesn't set family correctly */ addr->sa_family = AF_INET; #endif @@ -1756,7 +1756,7 @@ PyObject *buf; socklen_t buflen = 0; -#ifdef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) /* We have incomplete socket support. */ PyErr_SetString(socket_error, "getsockopt not supported"); return NULL; @@ -1797,7 +1797,7 @@ } _PyString_Resize(&buf, buflen); return buf; -#endif /* __BEOS__ */ +#endif /* defined(__BEOS__) && !defined(__HAIKU__) */ } PyDoc_STRVAR(getsockopt_doc, @@ -3354,7 +3354,7 @@ { char *name; struct protoent *sp; -#ifdef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) /* Not available in BeOS yet. - [cjh] */ PyErr_SetString(socket_error, "getprotobyname not supported"); return NULL; @@ -4440,7 +4440,7 @@ /* Socket types */ PyModule_AddIntConstant(m, "SOCK_STREAM", SOCK_STREAM); PyModule_AddIntConstant(m, "SOCK_DGRAM", SOCK_DGRAM); -#ifndef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) /* We have incomplete socket support. */ PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW); PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET); diff -urN Python-2.5.2/Modules/socketmodule.h Python-2.5.2-haiku/Modules/socketmodule.h --- Python-2.5.2/Modules/socketmodule.h 2006-12-03 11:24:00.000000000 +0000 +++ Python-2.5.2-haiku/Modules/socketmodule.h 2008-10-09 18:14:33.000000000 +0000 @@ -41,6 +41,10 @@ # undef AF_NETLINK #endif +#if defined(__HAIKU__) +#undef HAVE_BLUETOOTH_BLUETOOTH_H +#endif + #ifdef HAVE_BLUETOOTH_BLUETOOTH_H #include #include diff -urN Python-2.5.2/Modules/spwdmodule.c Python-2.5.2-haiku/Modules/spwdmodule.c --- Python-2.5.2/Modules/spwdmodule.c 2006-08-02 06:15:10.000000000 +0000 +++ Python-2.5.2-haiku/Modules/spwdmodule.c 2008-10-09 18:15:56.000000000 +0000 @@ -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 Python-2.5.2/Modules/timemodule.c Python-2.5.2-haiku/Modules/timemodule.c --- Python-2.5.2/Modules/timemodule.c 2007-12-24 20:00:42.000000000 +0000 +++ Python-2.5.2-haiku/Modules/timemodule.c 2008-10-09 18:20:00.000000000 +0000 @@ -968,11 +968,11 @@ return -1; } Py_END_ALLOW_THREADS -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) /* This sleep *CAN BE* interrupted. */ { if( secs <= 0.0 ) { - return; + return 0; } Py_BEGIN_ALLOW_THREADS diff -urN Python-2.5.2/Tools/scripts/h2py.py Python-2.5.2-haiku/Tools/scripts/h2py.py --- Python-2.5.2/Tools/scripts/h2py.py 2004-08-09 17:27:55.000000000 +0000 +++ Python-2.5.2-haiku/Tools/scripts/h2py.py 2008-10-09 18:14:33.000000000 +0000 @@ -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(':') diff -urN Python-2.5.2/configure.in Python-2.5.2-haiku/configure.in --- Python-2.5.2/configure.in 2008-02-13 19:17:17.000000000 +0000 +++ Python-2.5.2-haiku/configure.in 2008-10-09 18:15:55.000000000 +0000 @@ -631,6 +631,11 @@ BeOS*) LDLIBRARY='libpython$(VERSION).so' ;; + Haiku*) + LDLIBRARY='libpython$(VERSION).so' + BLDLIBRARY='-L. -lpython$(VERSION)' + RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} + ;; CYGWIN*) LDLIBRARY='libpython$(VERSION).dll.a' DLLLIBRARY='libpython$(VERSION).dll' @@ -713,7 +718,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;; @@ -1449,6 +1454,10 @@ BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY" LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY" ;; + Haiku*) + LDFLAGS="-L." # help ld find libpythonX.Y.so in root directory + LDSHARED="gcc -shared" + ;; IRIX/5*) LDSHARED="ld -shared";; IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; SunOS/5*) @@ -1589,6 +1598,7 @@ *) CCSHARED="";; esac;; atheos*) CCSHARED="-fPIC";; + Haiku*) CCSHARED="-fPIC";; esac fi AC_MSG_RESULT($CCSHARED) @@ -1714,6 +1724,9 @@ BeOS*) AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS ;; +Haiku*) +AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS) # Haiku +;; esac AC_MSG_CHECKING(for --with-libs) @@ -2883,7 +2896,7 @@ AC_SUBST(LIBM) case $ac_sys_system in Darwin) ;; -BeOS) ;; +BeOS|Haiku) ;; *) LIBM=-lm esac AC_MSG_CHECKING(for --with-libm=STRING) diff -urN Python-2.5.2/setup.py Python-2.5.2-haiku/setup.py --- Python-2.5.2/setup.py 2008-02-04 23:41:02.000000000 +0000 +++ Python-2.5.2-haiku/setup.py 2008-10-09 18:15:55.000000000 +0000 @@ -337,7 +337,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 @@ -911,7 +911,7 @@ exts.append( Extension('resource', ['resource.c']) ) # Sun yellow pages. Some systems have the functions in libc. - if platform not in ['cygwin', 'atheos']: + if platform not in ['cygwin', 'atheos', 'haiku1']: if (self.compiler.find_library_file(lib_dirs, 'nsl')): libs = ['nsl'] else: