From 2a2f97a1dab793e90a3cf957a8cbcfb27e07ad73 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 30 Sep 2008 17:16:02 +0200 Subject: [PATCH] Really fix python build this time, and use some patches from pkgsrc to fix curses, mremap, and bluetooth modules. --HG-- extra : convert_revision : fd555dc3aeb2085fe1d7913bd5d4fdc24c41959e --- templates/python-2.5.2-fix-bluetooth.diff | 14 +++ templates/python-2.5.2-fix-build.diff | 11 +++ templates/python-2.5.2-fix-curses-module.diff | 86 +++++++++++++++++++ templates/python-2.5.2-fix-mremap.diff | 25 ++++++ templates/python-2.5.2.tmpl | 4 +- 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 templates/python-2.5.2-fix-bluetooth.diff create mode 100644 templates/python-2.5.2-fix-build.diff create mode 100644 templates/python-2.5.2-fix-curses-module.diff create mode 100644 templates/python-2.5.2-fix-mremap.diff diff --git a/templates/python-2.5.2-fix-bluetooth.diff b/templates/python-2.5.2-fix-bluetooth.diff new file mode 100644 index 00000000000..3fc5aba9264 --- /dev/null +++ b/templates/python-2.5.2-fix-bluetooth.diff @@ -0,0 +1,14 @@ +$NetBSD: patch-ap,v 1.1.1.1 2008/04/24 01:50:58 tnn Exp $ + +--- Modules/socketmodule.c.orig 2007-03-31 20:56:11.000000000 +0200 ++++ Modules/socketmodule.c +@@ -357,7 +357,8 @@ const char *inet_ntop(int af, const void + #define SOCKETCLOSE close + #endif + +-#if defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H) ++#if (defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H)) && \ ++ !defined(__NetBSD__) && !defined(__DragonFly__) + #define USE_BLUETOOTH 1 + #if defined(__FreeBSD__) + #define BTPROTO_L2CAP BLUETOOTH_PROTO_L2CAP diff --git a/templates/python-2.5.2-fix-build.diff b/templates/python-2.5.2-fix-build.diff new file mode 100644 index 00000000000..10ba88a296b --- /dev/null +++ b/templates/python-2.5.2-fix-build.diff @@ -0,0 +1,11 @@ +--- Makefile.pre.in.orig 2007-12-05 21:43:57.000000000 +0100 ++++ Makefile.pre.in 2008-09-30 16:56:46.000000000 +0200 +@@ -806,7 +806,7 @@ $(srcdir)/Lib/$(PLATDIR): + export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \ + export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \ + export EXE; EXE="$(BUILDEXE)"; \ +- cd $(srcdir)/Lib/$(PLATDIR); ./regen ++ cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen + + # Install the include files + INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) diff --git a/templates/python-2.5.2-fix-curses-module.diff b/templates/python-2.5.2-fix-curses-module.diff new file mode 100644 index 00000000000..80cd7c0398e --- /dev/null +++ b/templates/python-2.5.2-fix-curses-module.diff @@ -0,0 +1,86 @@ +$NetBSD: patch-ah,v 1.1.1.1 2008/04/24 01:50:58 tnn Exp $ + +--- Modules/_cursesmodule.c.orig 2008-01-26 15:03:51.000000000 +0100 ++++ Modules/_cursesmodule.c +@@ -314,17 +314,9 @@ Window_NoArg2TupleReturnFunction(getpary + + Window_OneArgNoReturnFunction(clearok, int, "i;True(1) or False(0)") + Window_OneArgNoReturnFunction(idlok, int, "i;True(1) or False(0)") +-#if defined(__NetBSD__) +-Window_OneArgNoReturnVoidFunction(keypad, int, "i;True(1) or False(0)") +-#else + Window_OneArgNoReturnFunction(keypad, int, "i;True(1) or False(0)") +-#endif + Window_OneArgNoReturnFunction(leaveok, int, "i;True(1) or False(0)") +-#if defined(__NetBSD__) +-Window_OneArgNoReturnVoidFunction(nodelay, int, "i;True(1) or False(0)") +-#else + Window_OneArgNoReturnFunction(nodelay, int, "i;True(1) or False(0)") +-#endif + Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)") + Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)") + Window_OneArgNoReturnFunction(winsdelln, int, "i;nlines") +@@ -827,11 +819,7 @@ PyCursesWindow_GetKey(PyCursesWindowObje + } else if (rtn<=255) + return Py_BuildValue("c", rtn); + else +-#if defined(__NetBSD__) +- return PyString_FromString(unctrl(rtn)); +-#else + return PyString_FromString((char *)keyname(rtn)); +-#endif + } + + static PyObject * +@@ -2039,7 +2027,6 @@ PyCurses_Is_Term_Resized(PyObject *self, + } + #endif /* HAVE_CURSES_IS_TERM_RESIZED */ + +-#if !defined(__NetBSD__) + static PyObject * + PyCurses_KeyName(PyObject *self, PyObject *args) + { +@@ -2058,7 +2045,6 @@ PyCurses_KeyName(PyObject *self, PyObjec + + return PyString_FromString((knp == NULL) ? "" : (char *)knp); + } +-#endif + + static PyObject * + PyCurses_KillChar(PyObject *self) +@@ -2603,9 +2589,7 @@ static PyMethodDef PyCurses_methods[] = + #ifdef HAVE_CURSES_IS_TERM_RESIZED + {"is_term_resized", (PyCFunction)PyCurses_Is_Term_Resized, METH_VARARGS}, + #endif +-#if !defined(__NetBSD__) + {"keyname", (PyCFunction)PyCurses_KeyName, METH_VARARGS}, +-#endif + {"killchar", (PyCFunction)PyCurses_KillChar, METH_NOARGS}, + {"longname", (PyCFunction)PyCurses_longname, METH_NOARGS}, + {"meta", (PyCFunction)PyCurses_Meta, METH_VARARGS}, +@@ -2714,9 +2698,7 @@ init_curses(void) + SetDictInt("A_DIM", A_DIM); + SetDictInt("A_BOLD", A_BOLD); + SetDictInt("A_ALTCHARSET", A_ALTCHARSET); +-#if !defined(__NetBSD__) + SetDictInt("A_INVIS", A_INVIS); +-#endif + SetDictInt("A_PROTECT", A_PROTECT); + SetDictInt("A_CHARTEXT", A_CHARTEXT); + SetDictInt("A_COLOR", A_COLOR); +@@ -2788,7 +2770,6 @@ init_curses(void) + int key; + char *key_n; + char *key_n2; +-#if !defined(__NetBSD__) + for (key=KEY_MIN;key < KEY_MAX; key++) { + key_n = (char *)keyname(key); + if (key_n == NULL || strcmp(key_n,"UNKNOWN KEY")==0) +@@ -2816,7 +2797,6 @@ init_curses(void) + if (key_n2 != key_n) + free(key_n2); + } +-#endif + SetDictInt("KEY_MIN", KEY_MIN); + SetDictInt("KEY_MAX", KEY_MAX); + } diff --git a/templates/python-2.5.2-fix-mremap.diff b/templates/python-2.5.2-fix-mremap.diff new file mode 100644 index 00000000000..0a09ce43a34 --- /dev/null +++ b/templates/python-2.5.2-fix-mremap.diff @@ -0,0 +1,25 @@ +$NetBSD: patch-at,v 1.2 2008/08/30 10:02:33 tron Exp $ + +The first change is part of the fix for CVE-2008-2315 taken from Gentto. + +--- Modules/mmapmodule.c.orig 2006-08-22 14:57:07.000000000 +0100 ++++ Modules/mmapmodule.c 2008-08-30 10:16:13.000000000 +0100 +@@ -223,7 +223,7 @@ + return(NULL); + + /* silently 'adjust' out-of-range requests */ +- if ((self->pos + num_bytes) > self->size) { ++ if (num_bytes > self->size - self->pos) { + num_bytes -= (self->pos+num_bytes) - self->size; + } + result = Py_BuildValue("s#", self->data+self->pos, num_bytes); +@@ -449,6 +449,9 @@ + + #ifdef MREMAP_MAYMOVE + newmap = mremap(self->data, self->size, new_size, MREMAP_MAYMOVE); ++#elif defined(__NetBSD__) ++ newmap = mremap(self->data, self->size, self->data, new_size, 0); ++ + #else + newmap = mremap(self->data, self->size, new_size, 0); + #endif diff --git a/templates/python-2.5.2.tmpl b/templates/python-2.5.2.tmpl index 730d0623e40..3f5b20efd54 100755 --- a/templates/python-2.5.2.tmpl +++ b/templates/python-2.5.2.tmpl @@ -2,10 +2,12 @@ pkgname=python-2.5.2 distfiles="Python-2.5.2" extract_sufx=".tar.bz2" +patch_files="python-2.5.2-fix-build.diff python-2.5.2-fix-curses-module.diff + python-2.5.2-fix-bluetooth.diff python-2.5.2-fix-mremap.diff" url=http://www.python.org/ftp/python/2.5.2 configure_args="--with-threads --enable-shared" # Python needs the following in LDFLAGS, otherwise modules don't work. -LDFLAGS="-L$PKGFS_BUILDDIR/$pkgname/ -Wl,-R$PKGFS_MASTERDIR/lib/python2.5" +LDFLAGS="-L. -L$PKGFS_DESTDIR/$pkgname -Wl,-R$PKGFS_MASTERDIR/lib/python2.5" build_style=gnu_configure short_desc="Interpreted, interactive, object-oriented programming language" maintainer="Juan RP "