Files
haikuports/dev-lang/python/python-2.5.2-haiku.diff
Scott McCreary 3068875682
2008-08-15 04:41:51 +00:00

301 lines
9.8 KiB
Diff

diff -urN Python-2.5.2/Makefile.pre.in Python-2.5.2-haiku/Makefile.pre.in
--- Python-2.5.2/Makefile.pre.in 2007-12-05 12:43:57.000000000 -0800
+++ Python-2.5.2-haiku/Makefile.pre.in 2008-08-14 19:44:04.000000000 -0700
@@ -890,6 +890,15 @@
echo; echo "See Misc/BeOS-NOTES for details."; \
;; \
esac
+ @case "$(MACHDEP)" in haiku*) \
+ echo; echo "Installing support files for building shared extension modules on Haiku:"; \
+ $(INSTALL_DATA) Misc/Haiku-NOTES $(DESTDIR)$(LIBPL)/README; \
+ echo; echo "$(LIBPL)/README"; \
+ $(INSTALL_SCRIPT) Modules/ld_so_haiku $(DESTDIR)$(LIBPL)/ld_so_haiku; \
+ echo "$(LIBPL)/ld_so_haiku"; \
+ echo; echo "See Misc/Haiku-NOTES for details."; \
+ ;; \
+ esac
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
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 16:47:16.000000000 -0700
+++ Python-2.5.2-haiku/Modules/_ctypes/libffi/configure.ac 2008-08-14 18:02:59.000000000 -0700
@@ -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/ld_so_haiku Python-2.5.2-haiku/Modules/ld_so_haiku
--- Python-2.5.2/Modules/ld_so_haiku 1969-12-31 16:00:00.000000000 -0800
+++ Python-2.5.2-haiku/Modules/ld_so_haiku 2008-08-14 19:45:12.000000000 -0700
@@ -0,0 +1,78 @@
+#! /bin/sh
+#
+# linkmodule for Python
+# Chris Herborth (chrish@qnx.com)
+#
+# This is covered by the same copyright/licensing terms as the rest of
+# Python.
+#
+# Shell script to build shared library versions of the modules; since
+# the change to the *ahem* "proper" import/export mechanism, this script
+# is much simpler. It handles PowerPC and x86, too.
+#
+# This is called by the Modules/Makefile as $(LDSHARED):
+#
+# $(LDSHARED) foomodule.o -o foomodule$(SO)
+#
+# Could also be called as:
+#
+# $(LDSHARED) readline.o -L/boot/home/config/lib -lreadline -ltermcap \
+# -o readline$(SO)
+#
+# so we need to preserve the arguments, sort of.
+
+# Make sure we got reasonable arguments.
+TARGET=""
+ARGS=""
+
+while [ "$#" != "0" ]; do
+ case "$1" in
+ -o) TARGET="$2"; shift; shift;;
+ *) ARGS="$ARGS $1"; shift;;
+ esac
+done
+
+if [ "$TARGET" = "" ] ; then
+ echo "Usage:"
+ echo
+ echo " $0 [args] -o foomodule.so [args] foomodule.o [args]"
+ echo
+ echo "Where:"
+ echo
+ echo " [args] normal compiler arguments"
+ exit 1
+fi
+
+# The shared libraries and glue objects we need to link against; these
+# libs are overkill for most of the standard modules, but it makes life
+# in this shell script easier.
+LIBS="-lbe -lnetwork -lroot"
+
+case $BE_HOST_CPU in
+ ppc)
+ # Boy, do we need a lot of crap...
+ GLUE_LOC=/boot/develop/lib/ppc
+ GLUE="${GLUE_LOC}/glue-noinit.a ${GLUE_LOC}/init_term_dyn.o"
+ case $(uname -r) in
+ 4.0*) CC="mwcc -xms -export pragma -nodup" ;;
+ *) CC="mwcc -shared -export pragma -nodup" ;;
+ esac
+ ;;
+
+ x86)
+ # We don't need as much crap here...
+ GLUE=""
+ CC="gcc -nostart -Wl,-soname=${TARGET}"
+ ;;
+
+ *)
+ # What the?!?
+ echo "$0 doesn't support $BE_HOST_CPU systems..."
+ echo "You're on your own... I'd be surprised if this works."
+ GLUE=""
+ CC="cc"
+ ;;
+esac
+
+# Now link that shared lib...
+$CC -o $TARGET $ARGS $GLUE $LIBS
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 14:04:52.000000000 -0700
+++ Python-2.5.2-haiku/Modules/resource.c 2008-08-14 18:02:59.000000000 -0700
@@ -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-09 18:18:57.000000000 -0700
+++ Python-2.5.2-haiku/Modules/selectmodule.c 2008-08-14 18:02:59.000000000 -0700
@@ -49,7 +49,7 @@
# include <winsock.h>
#else
# define SOCKET int
-# ifdef __BEOS__
+# if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/socket.h>
# elif defined(__VMS)
# include <socket.h>
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 11:56:11.000000000 -0700
+++ Python-2.5.2-haiku/Modules/socketmodule.c 2008-08-14 18:02:59.000000000 -0700
@@ -244,7 +244,7 @@
# include <netdb.h>
/* Headers needed for inet_ntoa() and inet_addr() */
-# ifdef __BEOS__
+# if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/netdb.h>
# elif defined(PYOS_OS2) && defined(PYCC_VACPP)
# include <netdb.h>
@@ -3740,6 +3740,10 @@
\n\
Convert a packed IP address of the given family to string format.");
+#ifndef INET_ADDRSTRLEN
+#define INET_ADDRSTRLEN 16
+#endif
+
static PyObject *
socket_inet_ntop(PyObject *self, PyObject *args)
{
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 03:24:00.000000000 -0800
+++ Python-2.5.2-haiku/Modules/socketmodule.h 2008-08-14 18:02:59.000000000 -0700
@@ -2,7 +2,7 @@
/* Includes needed for the sockaddr_* symbols below */
#ifndef MS_WINDOWS
-#ifdef __VMS
+# ifdef __VMS
# include <socket.h>
# else
# include <sys/socket.h>
@@ -41,6 +41,8 @@
# undef AF_NETLINK
#endif
+#undef HAVE_BLUETOOTH_BLUETOOTH_H
+
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
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-01 23:15:10.000000000 -0700
+++ Python-2.5.2-haiku/Modules/spwdmodule.c 2008-08-14 18:02:59.000000000 -0700
@@ -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/syslogmodule.c Python-2.5.2-haiku/Modules/syslogmodule.c
--- Python-2.5.2/Modules/syslogmodule.c 2006-05-29 14:04:52.000000000 -0700
+++ Python-2.5.2-haiku/Modules/syslogmodule.c 2008-08-14 18:02:59.000000000 -0700
@@ -136,7 +136,11 @@
long pri;
if (!PyArg_ParseTuple(args, "l:LOG_UPTO", &pri))
return NULL;
+#ifdef __HAIKU__
+ mask = 0;
+#else
mask = LOG_UPTO(pri);
+#endif
return PyInt_FromLong(mask);
}
diff -urN Python-2.5.2/Parser/asdl_c.py Python-2.5.2-haiku/Parser/asdl_c.py
--- Python-2.5.2/Parser/asdl_c.py 2007-01-18 22:42:33.000000000 -0800
+++ Python-2.5.2-haiku/Parser/asdl_c.py 2008-08-14 18:02:59.000000000 -0700
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /bin/env python
"""Generate C code from an ASDL description."""
# TO DO
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 10:27:55.000000000 -0700
+++ Python-2.5.2-haiku/Tools/scripts/h2py.py 2008-08-14 18:02:59.000000000 -0700
@@ -50,7 +50,7 @@
searchdirs=os.environ['INCLUDE'].split(';')
except KeyError:
try:
- if sys.platform.find("beos") == 0:
+ if sys.platform.find("beos") == 0 || sys.platform.find("haiku") == 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 11:17:17.000000000 -0800
+++ Python-2.5.2-haiku/configure.in 2008-08-14 19:42:26.000000000 -0700
@@ -379,6 +379,11 @@
AR="\$(srcdir)/Modules/ar_beos"
RANLIB=:
;;
+ Haiku*)
+ CC=gcc
+ without_gcc=no
+ OPT="$OPT -O"
+ ;;
Monterey*)
RANLIB=:
without_gcc=;;
@@ -628,7 +633,7 @@
if test $enable_shared = "yes"; then
AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
case $ac_sys_system in
- BeOS*)
+ BeOS*|Haiku*)
LDLIBRARY='libpython$(VERSION).so'
;;
CYGWIN*)
@@ -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*)
+ BLDSHARED="\$(srcdir)/Modules/ld_so_haiku $LDLIBRARY"
+ LDSHARED="\$(BINLIBDEST)/config/ld_so_haiku \$(LIBDIR)/$LDLIBRARY"
+ ;;
IRIX/5*) LDSHARED="ld -shared";;
IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
SunOS/5*)
@@ -1711,8 +1720,9 @@
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
case "$ac_sys_system" in
-BeOS*)
+BeOS* | Haiku*)
AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
+AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS) # Haiku
;;
esac
@@ -2883,7 +2893,7 @@
AC_SUBST(LIBM)
case $ac_sys_system in
Darwin) ;;
-BeOS) ;;
+BeOS|Haiku) ;;
*) LIBM=-lm
esac
AC_MSG_CHECKING(for --with-libm=STRING)