~ruther/guix-local

32d5c729522d02fe973cb245fe26262f040e0c13 — Mark H Weaver 12 years ago d013fe5
gnu: python: Apply mips n32 fix to bundled libffi.

* gnu/packages/patches/python-libffi-mips-n32-fix.patch: New file.
* gnu/packages/python.scm (python-2, python): Add it.
* gnu-system.am (dist_patch_DATA): Add it.
3 files changed, 27 insertions(+), 1 deletions(-)

M gnu-system.am
A gnu/packages/patches/python-libffi-mips-n32-fix.patch
M gnu/packages/python.scm
M gnu-system.am => gnu-system.am +1 -0
@@ 316,6 316,7 @@ dist_patch_DATA =						\
  gnu/packages/patches/plotutils-libpng-jmpbuf.patch		\
  gnu/packages/patches/procps-make-3.82.patch			\
  gnu/packages/patches/python-fix-tests.patch			\
  gnu/packages/patches/python-libffi-mips-n32-fix.patch		\
  gnu/packages/patches/qemu-make-4.0.patch			\
  gnu/packages/patches/qemu-multiple-smb-shares.patch		\
  gnu/packages/patches/qt4-tests.patch				\

A gnu/packages/patches/python-libffi-mips-n32-fix.patch => gnu/packages/patches/python-libffi-mips-n32-fix.patch +21 -0
@@ 0,0 1,21 @@
Fix handling of uint32_t arguments on the MIPS N32 ABI.

Patch by Mark H Weaver <mhw@netris.org>.

--- Modules/_ctypes/libffi/src/mips/ffi.c.orig	2013-03-16 07:19:39.000000000 -0400
+++ Modules/_ctypes/libffi/src/mips/ffi.c	2013-10-22 01:11:03.111985247 -0400
@@ -170,7 +170,14 @@
 		break;
 		  
 	      case FFI_TYPE_UINT32:
+#ifdef FFI_MIPS_N32
+		/* The N32 ABI requires that 32-bit integers
+		   be sign-extended to 64-bits, regardless of
+		   whether they are signed or unsigned. */
+		*(ffi_arg *)argp = *(SINT32 *)(* p_argv);
+#else
 		*(ffi_arg *)argp = *(UINT32 *)(* p_argv);
+#endif
 		break;
 
 	      /* This can only happen with 64bit slots.  */

M gnu/packages/python.scm => gnu/packages/python.scm +5 -1
@@ 2,6 2,7 @@
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 50,6 51,8 @@
      (method url-fetch)
      (uri (string-append "https://www.python.org/ftp/python/"
                          version "/Python-" version ".tar.xz"))
      (patches (list (search-patch "python-libffi-mips-n32-fix.patch")))
      (patch-flags '("-p0"))
      (sha256
       (base32
        "18gnpyh071dxa0rv3silrz92jw9qpblswzwv4gzqcwxzz20qxmhz"))))


@@ 190,7 193,8 @@ data types.")
              (method url-fetch)
              (uri (string-append "https://www.python.org/ftp/python/"
                                  version "/Python-" version ".tar.xz"))
              (patches (list (search-patch "python-fix-tests.patch")))
              (patches (list (search-patch "python-fix-tests.patch")
                             (search-patch "python-libffi-mips-n32-fix.patch")))
              (patch-flags '("-p0"))
              (sha256
               (base32