Skip to content

Instantly share code, notes, and snippets.

@goodtiding5
Forked from srid/README.txt
Created December 8, 2015 23:15
Show Gist options
  • Save goodtiding5/a9893f958171d3071719 to your computer and use it in GitHub Desktop.
Save goodtiding5/a9893f958171d3071719 to your computer and use it in GitHub Desktop.
Patches used in ActivePython 2.7 for building on AIX 5.1.
--- python/Modules/signalmodule.c.orig 2008-10-10 12:33:36.000000000 -0700
+++ python/Modules/signalmodule.c 2008-10-10 12:33:18.000000000 -0700
@@ -75,6 +75,18 @@
static pid_t main_pid;
#endif
+/* Code copied from _hotshot.c. Aix's cc dislikes inline in the function definitions. */
+#if !defined(__cplusplus) && !defined(inline)
+#ifdef __GNUC__
+#define inline __inline
+#endif
+#endif
+
+#ifndef inline
+#define inline
+#endif
+
+
static struct {
int tripped;
PyObject *func;
diff
Patch to fix MemoryError when trying to open files in AIX 64-bit
See http://bugs.python.org/issue6600
--- python/Objects/fileobject.c.orig 2009-07-30 14:35:03.000000000 -0700
+++ python/Objects/fileobject.c 2009-07-30 14:35:25.000000000 -0700
@@ -243,7 +243,7 @@
assert(f->f_fp == NULL);
/* probably need to replace 'U' by 'rb' */
- newmode = PyMem_MALLOC(strlen(mode) + 3);
+ newmode = PyMem_MALLOC(3 + strlen(mode));
if (!newmode) {
PyErr_NoMemory();
return NULL;
diff
Patch to fix MemoryError when trying to fdopen files in AIX 64-bit
See http://bugs.python.org/issue6600
From apytest:
[...]
self.stdin = os.fdopen(p2cwrite, 'wb', bufsize)
MemoryError
--- python/Modules/posixmodule.c.orig 2009-08-05 09:47:07.000000000 -0700
+++ python/Modules/posixmodule.c 2009-08-05 09:48:46.000000000 -0700
@@ -6451,7 +6451,7 @@
return NULL;
/* Sanitize mode. See fileobject.c */
- mode = PyMem_MALLOC(strlen(orgmode)+3);
+ mode = PyMem_MALLOC(3+strlen(orgmode));
if (!mode) {
PyErr_NoMemory();
return NULL;
--- Include/token.h.orig 2008-10-08 11:51:52.000000000 -0700
+++ python/Include/token.h 2008-10-08 11:52:53.000000000 -0700
@@ -7,6 +7,8 @@
extern "C" {
#endif
+#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */
+
#define ENDMARKER 0
#define NAME 1
#define NUMBER 2
diff
Allow multiple '-bI:...' arguments. The special processing -- i.e.
default to ./python.exp if no import is given and prepending '-Wl'
if necessary -- is only done for the first occurrence.
--- python/Modules/ld_so_aix.orig Tue Sep 2 17:45:30 1997
+++ python/Modules/ld_so_aix Thu Oct 7 10:01:35 2004
@@ -84,10 +84,6 @@
echo $usage; exit 2
fi
-# Default import file for Python
-# Can be overriden by providing a -bI: argument.
-impfile="./python.exp"
-
# Parse arguments
while test -n "$1"
do
@@ -113,7 +109,12 @@
objfile=`echo $1 | sed "s/-o//"`
;;
-bI:* | -Wl,-bI:*)
- impfile=`echo $1 | sed -e "s/-Wl,//" -e "s/-bI://"`
+ if test -z "$impfile"; then
+ # The first -bI:* is specially processed.
+ impfile=`echo $1 | sed -e "s/-Wl,//" -e "s/-bI://"`
+ else
+ args="$args $1"
+ fi
;;
-bE:* | -Wl,-bE:*)
expfile=`echo $1 | sed -e "s/-Wl,//" -e "s/-bE://"`
@@ -131,6 +132,11 @@
shift
done
+# Default import file for Python
+# Can be overriden by providing a -bI: argument.
+if test -z "$impfile"; then
+ impfile="./python.exp"
+fi
if test -z "$objs"; then
echo "ld_so_aix: No input files; exiting."
For reference see
http://bugs.python.org/issue3876
and http://www.velocityreviews.com/forums/t638521-builing-python-26-on-aix-52.html
This might be fixed in Python 2.6.1. Watch.
Extended with definition for _CMSG_ALIGN for SunOS.
Modified setup for SunOs before 5.10 as well, has no sem_timedwait
diff -Naur Python-2.6/Modules/_multiprocessing/multiprocessing.c Python-2.6-clean-patch/Modules/_multiprocessing/multiprocessing.c
--- python/Modules/_multiprocessing/multiprocessing.c.orig 2008-06-14 00:38:33.000000000 +0200
+++ python/Modules/_multiprocessing/multiprocessing.c 2008-10-07 12:23:55.000000000 +0200
@@ -8,6 +8,16 @@
#include "multiprocessing.h"
+#ifndef _CMSG_ALIGN
+#define _CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & ~(sizeof (size_t) - 1))
+#endif
+#ifndef CMSG_SPACE
+#define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
+#endif
+#ifndef CMSG_LEN
+#define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+#endif
+
PyObject *create_win32_namespace(void);
PyObject *pickle_dumps, *pickle_loads, *pickle_protocol;
diff -Naur Python-2.6/setup.py Python-2.6-clean-patch/setup.py
--- python/setup.py.orig 2008-09-30 02:15:45.000000000 +0200
+++ python/setup.py 2008-10-07 12:23:34.000000000 +0200
@@ -1277,6 +1277,14 @@
)
libraries = []
+ elif platform.startswith('aix'):
+ macros = dict(
+ HAVE_SEM_OPEN=1,
+ HAVE_SEM_TIMEDWAIT=0,
+ HAVE_FD_TRANSFER=1
+ )
+ libraries = ['rt']
+
else: # Linux and other unices
macros = dict(
HAVE_SEM_OPEN=1,
--- python/Makefile.pre.in.xx 2008-10-14 13:15:17.000000000 -0700
+++ python/Makefile.pre.in 2008-10-14 13:15:41.000000000 -0700
@@ -498,11 +498,11 @@
$(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LC_ALL=C $(SVNVERSION)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
- $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
- -DPREFIX='"$(prefix)"' \
- -DEXEC_PREFIX='"$(exec_prefix)"' \
- -DVERSION='"$(VERSION)"' \
- -DVPATH='"$(VPATH)"' \
+ $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='L"$(PYTHONPATH)"' \
+ -DPREFIX='L"$(prefix)"' \
+ -DEXEC_PREFIX='L"$(exec_prefix)"' \
+ -DVERSION='L"$(VERSION)"' \
+ -DVPATH='L"$(VPATH)"' \
-o $@ $(srcdir)/Modules/getpath.c
Modules/python.o: $(srcdir)/Modules/python.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment