Hi, with this patch I can compile pyhton 2.7 on loongson, the same modifications are used in devel/libffi, I don't know if there are side effects on ctypes though.
Samir. regress test "ok": test_ctypes /usr/obj/pobj/Python-2.7.1/Python-2.7.1/Lib/ctypes/util.py:180: DeprecationWarning: the cmp argument is not supported in 3.x res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y))) *** Signal 10 Index: lang/python/2.7/patches/patch-Modules__ctypes_libffi_src_mips_ffitarget_h =================================================================== RCS file: lang/python/2.7/patches/patch-Modules__ctypes_libffi_src_mips_ffitarget_h diff -N lang/python/2.7/patches/patch-Modules__ctypes_libffi_src_mips_ffitarget_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lang/python/2.7/patches/patch-Modules__ctypes_libffi_src_mips_ffitarget_h 13 Jun 2011 16:58:06 -0000 @@ -0,0 +1,20 @@ +$OpenBSD$ +--- Modules/_ctypes/libffi/src/mips/ffitarget.h.orig Mon Jun 13 14:31:24 2011 ++++ Modules/_ctypes/libffi/src/mips/ffitarget.h Mon Jun 13 14:36:33 2011 +@@ -27,10 +27,12 @@ + #ifndef LIBFFI_TARGET_H + #define LIBFFI_TARGET_H + +-#ifdef linux +-# include <asm/sgidefs.h> +-#else +-# include <sgidefs.h> ++#if !defined(__OpenBSD__) ++# ifdef linux ++# include <asm/sgidefs.h> ++# else ++# include <sgidefs.h> ++# endif + #endif + # ifndef _ABIN32 + # define _ABIN32 _MIPS_SIM_NABI32