IRIX patch by Stuart Shelton http://bugs.gentoo.org/show_bug.cgi?id=266494 --- setup.py.orig 2009-06-19 19:36:59.000000000 +0200 +++ setup.py 2009-06-19 19:52:42.000000000 +0200 @@ -1311,6 +1311,14 @@ class PyBuildExt(build_ext): ) libraries = [] + elif platform.startswith('irix'): + macros = dict( # IRIX + HAVE_SEM_OPEN=1, + HAVE_SEM_TIMEDWAIT=0, + HAVE_FD_TRANSFER=1, + ) + libraries = [] + else: # Linux and other unices macros = dict( HAVE_SEM_OPEN=1, --- Lib/test/test_fileio.py.orig 2009-09-25 10:23:21.948485520 +0100 +++ Lib/test/test_fileio.py 2009-09-25 10:24:19.035311480 +0100 @@ -152,7 +152,8 @@ class OtherFileTests(unittest.TestCase): self.assertEquals(f.writable(), True) if sys.platform != "darwin" and \ not sys.platform.startswith('freebsd') and \ - not sys.platform.startswith('sunos'): + not sys.platform.startswith('sunos') and \ + not sys.platform.startswith('irix'): # Somehow /dev/tty appears seekable on some BSDs self.assertEquals(f.seekable(), False) self.assertEquals(f.isatty(), True) --- Modules/_cursesmodule.c.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_cursesmodule.c 2009-06-19 19:52:42.000000000 +0200 @@ -120,9 +120,6 @@ char *PyCursesVersion = "2.2"; curses module in other ways. So the code will just specify explicit prototypes here. */ extern int setupterm(char *,int,int *); -#ifdef __sgi -#include -#endif #if !defined(HAVE_NCURSES_H) && (defined(sgi) || defined(__sun) || defined(SCO5)) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ --- Modules/_fileio.c.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_fileio.c 2009-06-19 19:52:42.000000000 +0200 @@ -33,7 +33,7 @@ typedef struct { unsigned readable : 1; unsigned writable : 1; int seekable : 2; /* -1 means unknown */ - int closefd : 1; + unsigned int closefd : 1; PyObject *weakreflist; } PyFileIOObject; --- Modules/mmapmodule.c.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/mmapmodule.c 2009-06-19 19:52:42.000000000 +0200 @@ -50,6 +50,10 @@ my_getallocationgranularity (void) #include #include +#ifdef HAVE_FCNTL_H +#include +#endif + #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) static int my_getpagesize(void) --- Modules/posixmodule.c.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/posixmodule.c 2009-06-19 19:52:42.000000000 +0200 @@ -169,7 +169,9 @@ corresponding Unix manual entries for mo extern char *ctermid_r(char *); #endif -#ifndef HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H +#include +#else #if defined(PYCC_VACPP) extern int mkdir(char *); #else --- Modules/python.c.orig 2009-09-25 11:33:05.391785600 +0100 +++ Modules/python.c 2009-09-25 11:33:43.150227520 +0100 @@ -3,7 +3,10 @@ #include "Python.h" #ifdef __FreeBSD__ -#include +# include +#endif +#ifdef __sgi +# include #endif int @@ -20,5 +23,11 @@ main(int argc, char **argv) m = fpgetmask(); fpsetmask(m & ~FP_X_OFL); #endif +#ifdef __sgi + unsigned int m; + + m = get_fpc_csr(); + set_fpc_csr(m & ~FPCSR_FLUSH_ZERO); +#endif return Py_Main(argc, argv); } --- Modules/_ctypes/_ctypes.c.orig 2009-04-05 23:48:06.000000000 +0200 +++ Modules/_ctypes/_ctypes.c 2009-06-19 19:52:42.000000000 +0200 @@ -111,11 +111,11 @@ bytes(cdata) #include #ifdef MS_WIN32 -#include -#include -#ifndef IS_INTRESOURCE -#define IS_INTRESOURCE(x) (((size_t)(x) >> 16) == 0) -#endif +# include +# include +# ifndef IS_INTRESOURCE +# define IS_INTRESOURCE(x) (((size_t)(x) >> 16) == 0) +# endif # ifdef _WIN32_WCE /* Unlike desktop Windows, WinCE has both W and A variants of GetProcAddress, but the default W version is not what we want */ @@ -123,8 +123,11 @@ bytes(cdata) # define GetProcAddress GetProcAddressA # endif #else -#include "ctypes_dlfcn.h" +# include "ctypes_dlfcn.h" #endif +/* #ifdef HAVE_ALLOCA_H */ +#include +/* #endif */ #include "ctypes.h" PyObject *PyExc_ArgError; @@ -3854,7 +3857,7 @@ CFuncPtr_call(CFuncPtrObject *self, PyOb } } - result = _CallProc(pProc, + result = _CallProc((PPROC)pProc, callargs, #ifdef MS_WIN32 piunk, --- Modules/_ctypes/_ctypes_test.c.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_ctypes/_ctypes_test.c 2009-06-19 19:52:43.000000000 +0200 @@ -369,8 +369,8 @@ EXPORT(PY_LONG_LONG) last_tf_arg_s; EXPORT(unsigned PY_LONG_LONG) last_tf_arg_u; struct BITS { - int A: 1, B:2, C:3, D:4, E: 5, F: 6, G: 7, H: 8, I: 9; - short M: 1, N: 2, O: 3, P: 4, Q: 5, R: 6, S: 7; + unsigned int A: 1, B:2, C:3, D:4, E: 5, F: 6, G: 7, H: 8, I: 9; + unsigned short M: 1, N: 2, O: 3, P: 4, Q: 5, R: 6, S: 7; }; DL_EXPORT(void) set_bitfields(struct BITS *bits, char name, int value) --- Modules/_ctypes/callproc.c.orig 2009-02-10 19:46:11.000000000 +0100 +++ Modules/_ctypes/callproc.c 2009-06-19 19:52:43.000000000 +0200 @@ -73,6 +73,10 @@ #include #endif +/* #ifdef HAVE_ALLOCA_H */ +#include +/* #endif */ + #include #include "ctypes.h" @@ -463,7 +467,7 @@ PyCArg_repr(PyCArgObject *self) #ifdef MS_WIN32 "", #else - "", + "", #endif self->tag, self->value.q); break; @@ -812,7 +816,7 @@ static int _call_function_pointer(int fl #endif delta = #endif - ffi_call(&cif, (void *)pProc, resmem, avalues); + ffi_call(&cif, FFI_FN(pProc), resmem, avalues); #ifdef MS_WIN32 #ifndef DONT_USE_SEH } --- Modules/_ctypes/malloc_closure.c.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_ctypes/malloc_closure.c 2009-06-19 19:52:43.000000000 +0200 @@ -5,12 +5,18 @@ #include #include #ifdef MS_WIN32 -#include +# include #else -#include -#include -# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -# define MAP_ANONYMOUS MAP_ANON +# include +# include +# if !defined(MAP_ANONYMOUS) +# if defined(MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +# else /* For open(), O_RDWR, etc. */ +# include +# include +# include +# endif # endif #endif #include "ctypes.h" @@ -37,6 +43,8 @@ int _pagesize; static void more_core(void) { ITEM *item; + int flags = MAP_PRIVATE; + int devzero = -1; int count, i; /* determine the pagesize */ @@ -68,12 +76,24 @@ static void more_core(void) if (item == NULL) return; #else +#ifdef MAP_ANONYMOUS + /* BSD way to map anonymous memory */ + flags |= MAP_ANONYMOUS; +#else + /* SVR4 method to map anonymous memory is to open /dev/zero */ + devzero = open("/dev/zero", O_RDWR); + if (devzero == -1) + return; +#endif item = (ITEM *)mmap(NULL, count * sizeof(ITEM), PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, - -1, + flags, + devzero, 0); + if (devzero != -1) + close(devzero); + if (item == (void *)MAP_FAILED) return; #endif --- Modules/_ctypes/libffi/configure.ac.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_ctypes/libffi/configure.ac 2009-06-19 19:52:43.000000000 +0200 @@ -106,10 +106,10 @@ case "$host" in ;; mips-sgi-irix5.* | mips-sgi-irix6.*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; mips*-*-linux*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_LINUX; TARGETDIR=mips ;; powerpc*-*-linux* | powerpc-*-sysv*) @@ -162,7 +162,8 @@ if test $TARGETDIR = unknown; then AC_MSG_ERROR(["libffi has not been ported to $host."]) fi -AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) +AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS_IRIX) +AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS_LINUX) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) --- Modules/_ctypes/libffi/configure.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_ctypes/libffi/configure 2009-06-19 19:52:43.000000000 +0200 @@ -20426,10 +20426,10 @@ case "$host" in ;; mips-sgi-irix5.* | mips-sgi-irix6.*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; mips*-*-linux*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_LINUX; TARGETDIR=mips ;; powerpc*-*-linux* | powerpc-*-sysv*) @@ -20484,7 +20484,15 @@ echo "$as_me: error: \"libffi has not be { (exit 1); exit 1; }; } fi - if test x$TARGET = xMIPS; then + if test x$TARGET = xMIPS_IRIX; then + MIPS_TRUE= + MIPS_FALSE='#' +else + MIPS_TRUE='#' + MIPS_FALSE= +fi + + if test x$TARGET = xMIPS_LINUX; then MIPS_TRUE= MIPS_FALSE='#' else --- Modules/_ctypes/libffi/src/mips/n32.S.orig 2009-09-25 10:25:10.835555720 +0100 +++ Modules/_ctypes/libffi/src/mips/n32.S 2009-09-25 10:26:46.016867360 +0100 @@ -40,7 +40,7 @@ #define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG ) - .abicalls +/* .abicalls */ .text .align 2 .globl ffi_call_N32 @@ -474,7 +474,7 @@ cls_epilogue: .LFE2: .end ffi_closure_N32 - .section .eh_frame,"aw",@progbits +/* .section .eh_frame,"aw",@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # length .LSCIE1: @@ -530,5 +530,6 @@ cls_epilogue: .uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4 .align EH_FRAME_ALIGN .LEFDE3: +*/ #endif --- Modules/_ctypes/libffi/src/mips/ffitarget.h.orig 2009-06-19 19:52:37.000000000 +0200 +++ Modules/_ctypes/libffi/src/mips/ffitarget.h 2009-06-19 19:52:43.000000000 +0200 @@ -27,8 +27,13 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H -#ifdef linux -#include +#if defined(linux) || defined (__sgi) +# ifdef linux +# include +# endif +# ifdef __sgi +# include +# endif # ifndef _ABIN32 # define _ABIN32 _MIPS_SIM_NABI32 # endif @@ -41,7 +46,7 @@ #endif #if !defined(_MIPS_SIM) --- something is very wrong -- +# error -- something is very wrong -- #else # if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) # define FFI_MIPS_N32 @@ -49,7 +54,7 @@ # if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) # define FFI_MIPS_O32 # else --- this is an unsupported platform -- +# error -- this is an unsupported platform -- # endif # endif #endif @@ -145,14 +150,26 @@ # endif /* _MIPS_SIM==_ABI64 */ #endif /* !FFI_MIPS_O32 */ #else /* !LIBFFI_ASM */ -#ifdef FFI_MIPS_O32 +#ifdef __GNUC__ +# ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__SI__))); typedef signed int ffi_sarg __attribute__((__mode__(__SI__))); -#else +# else /* N32 and N64 frames have 64bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__DI__))); typedef signed int ffi_sarg __attribute__((__mode__(__DI__))); +# endif +#else +# ifdef FFI_MIPS_O32 +/* O32 stack frames have 32bit integer args */ +typedef __uint32_t ffi_arg; +typedef __int32_t ffi_sarg; +# else +/* N32 and N64 frames have 64bit integer args */ +typedef __uint64_t ffi_arg; +typedef __int64_t ffi_sarg; +# endif #endif typedef enum ffi_abi { --- Modules/_ctypes/libffi/include/ffi.h.in.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_ctypes/libffi/include/ffi.h.in 2009-06-19 19:52:43.000000000 +0200 @@ -249,12 +249,22 @@ size_t ffi_java_raw_size (ffi_cif *cif); #if FFI_CLOSURES +#ifdef __sgi +# pragma pack 8 +#endif typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; +#ifdef __GNUC__ } ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif +#endif void *ffi_closure_alloc (size_t size, void **code); void ffi_closure_free (void *); --- Modules/_ctypes/libffi/include/ffi_common.h.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_ctypes/libffi/include/ffi_common.h 2009-06-19 19:53:26.000000000 +0200 @@ -44,6 +44,14 @@ char *alloca (); # endif #endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_SYS_TYPES_H +# include +# endif +#endif + #if defined(FFI_DEBUG) #include #endif @@ -77,6 +85,7 @@ typedef struct } extended_cif; /* Terse sized type definitions. */ +#if defined(__GNUC__) typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); typedef signed int SINT8 __attribute__((__mode__(__QI__))); typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); @@ -85,6 +94,16 @@ typedef unsigned int UINT32 __attribute_ typedef signed int SINT32 __attribute__((__mode__(__SI__))); typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); typedef signed int SINT64 __attribute__((__mode__(__DI__))); +#else +typedef uint8_t UINT8; +typedef int8_t SINT8; +typedef uint16_t UINT16; +typedef int16_t SINT16; +typedef uint32_t UINT32; +typedef int32_t SINT32; +typedef uint64_t UINT64; +typedef int64_t SINT64; +#endif typedef float FLOAT32; --- Modules/_ctypes/stgdict.c.orig 2009-06-19 19:52:36.000000000 +0200 +++ Modules/_ctypes/stgdict.c 2009-06-19 19:52:43.000000000 +0200 @@ -8,6 +8,9 @@ #include #include #endif +/* #ifdef HAVE_ALLOCA_H */ +#include +/* #endif */ #include "ctypes.h" /******************************************************************/