[Python-modules-team] Bug#655388: python-numpy: FTBFS: [m68k] unrecognised long double format

Thorsten Glaser tg at mirbsd.de
Thu Jan 12 09:18:19 UTC 2012


tags 655388 + patch
tags 655014 + patch
thanks

Andreas Schwab dixit:

>diff --git i/numpy/core/scons_support.py w/numpy/core/scons_support.py
[…]

The patch you put into the upstream bugtracker indeed worked. I’ve
attached a debdiff to a package where I applied it. I’ve also moved
matplotlib to B-D-Indep, which (when calling build-arch instead of
build in dpkg-buildpackage) allows the package to compile on m68k.

Thanks!

(I think, for build-arch, we may need a new flag or something, if
it’s already supported by dpkg, that is; might want to ask buxy.)

bye,
//mirabilos
-- 
http://loldebian.wordpress.com/2011/05/04/rrrrrrrrrrrrrrrrrrrrrrrrolling/
-------------- next part --------------
diff -Nru python-numpy-1.5.1/debian/changelog python-numpy-1.5.1/debian/changelog
--- python-numpy-1.5.1/debian/changelog	2011-10-04 09:43:59.000000000 +0000
+++ python-numpy-1.5.1/debian/changelog	2012-01-11 21:10:48.000000000 +0000
@@ -1,3 +1,19 @@
+python-numpy (1:1.5.1-3+m68k.2) unreleased; urgency=low
+
+  [ Andreas Schwab ]
+  * debian/patches/20_m68k_long_double_format.diff
+    - add support for the Motorola 68k big endian long double
+      floating point representation format
+      Closes: #655388
+
+  [ Thorsten Glaser ]
+  * debian/control
+    - move python-matplotlib to Build-Depends-Indep as it’s only
+      needed when building the arch:all documentation package
+      Closes: #655014
+
+ -- Thorsten Glaser <tg at mirbsd.de>  Wed, 11 Jan 2012 21:10:30 +0000
+
 python-numpy (1:1.5.1-3) unstable; urgency=low
 
   * debian/rules
diff -Nru python-numpy-1.5.1/debian/control python-numpy-1.5.1/debian/control
--- python-numpy-1.5.1/debian/control	2010-12-23 23:06:58.000000000 +0000
+++ python-numpy-1.5.1/debian/control	2012-01-11 20:25:05.000000000 +0000
@@ -3,7 +3,8 @@
 Priority: optional
 Maintainer: Debian Python Modules Team <python-modules-team at lists.alioth.debian.org>
 Uploaders: Alexandre Fayolle <afayolle at debian.org>, Matthias Klose <doko at debian.org>, Ondrej Certik <ondrej at certik.cz>, David Cournapeau <cournape at gmail.com>, Sandro Tosi <morph at debian.org>
-Build-Depends: python-all-dev, python-all-dbg, python-support (>= 1), gfortran (>= 4:4.2), libblas-dev [!arm !m68k], liblapack-dev [!arm !m68k], debhelper (>= 7.0.50~), patchutils, python-docutils, quilt, python-sphinx (>= 1.0.1), python-matplotlib
+Build-Depends: python-all-dev, python-all-dbg, python-support (>= 1), gfortran (>= 4:4.2), libblas-dev [!arm !m68k], liblapack-dev [!arm !m68k], debhelper (>= 7.0.50~), patchutils, python-docutils, quilt, python-sphinx (>= 1.0.1)
+Build-Depends-Indep: python-matplotlib
 XS-Python-Version: >= 2.4
 Standards-Version: 3.9.1
 Vcs-Svn: svn://svn.debian.org/python-modules/packages/numpy/trunk
diff -Nru python-numpy-1.5.1/debian/patches/20_m68k_long_double_format.diff python-numpy-1.5.1/debian/patches/20_m68k_long_double_format.diff
--- python-numpy-1.5.1/debian/patches/20_m68k_long_double_format.diff	1970-01-01 00:00:00.000000000 +0000
+++ python-numpy-1.5.1/debian/patches/20_m68k_long_double_format.diff	2012-01-11 21:10:01.000000000 +0000
@@ -0,0 +1,152 @@
+From 57f90a03df614e21369956cd83648c5635944976 Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab at linux-m68k.org>
+Date: Wed, 11 Jan 2012 14:47:58 +0100
+Subject: [PATCH] ENH: Add support for Motorola extended float format
+Bug-Debian: http://bugs.debian.org/655388
+Bug: http://projects.scipy.org/numpy/ticket/2014
+
+---
+ numpy/core/include/numpy/npy_cpu.h        |    2 +
+ numpy/core/include/numpy/npy_endian.h     |    3 +-
+ numpy/core/scons_support.py               |    1 +
+ numpy/core/setup.py                       |    1 +
+ numpy/core/setup_common.py                |    4 +++
+ numpy/core/src/npymath/npy_math_private.h |   39 +++++++++++++++++++++++++++++
+ numpy/core/src/private/npy_fpmath.h       |    1 +
+ 7 files changed, 50 insertions(+), 1 deletions(-)
+
+Index: python-numpy-1.5.1/numpy/core/include/numpy/npy_cpu.h
+===================================================================
+--- python-numpy-1.5.1.orig/numpy/core/include/numpy/npy_cpu.h	2010-11-08 23:58:22.000000000 +0000
++++ python-numpy-1.5.1/numpy/core/include/numpy/npy_cpu.h	2012-01-11 21:09:57.000000000 +0000
+@@ -66,6 +66,8 @@
+     #define NPY_CPU_MIPSEL
+ #elif defined(__MIPSEB__)
+     #define NPY_CPU_MIPSEB
++#elif defined(__mc68000__)
++    #define NPY_CPU_M68K
+ #else
+     #error Unknown CPU, please report this to numpy maintainers with \
+     information about your platform (OS, CPU and compiler)
+Index: python-numpy-1.5.1/numpy/core/include/numpy/npy_endian.h
+===================================================================
+--- python-numpy-1.5.1.orig/numpy/core/include/numpy/npy_endian.h	2010-11-08 23:58:22.000000000 +0000
++++ python-numpy-1.5.1/numpy/core/include/numpy/npy_endian.h	2012-01-11 21:09:57.000000000 +0000
+@@ -35,7 +35,8 @@
+             || defined(NPY_CPU_PPC64)   \
+             || defined(NPY_CPU_ARMEB)   \
+             || defined(NPY_CPU_SH_BE)   \
+-            || defined(NPY_CPU_MIPSEB)
++            || defined(NPY_CPU_MIPSEB)  \
++            || defined(NPY_CPU_M68K)
+         #define NPY_BYTE_ORDER NPY_BIG_ENDIAN
+     #else
+         #error Unknown CPU: can not set endianness
+Index: python-numpy-1.5.1/numpy/core/scons_support.py
+===================================================================
+--- python-numpy-1.5.1.orig/numpy/core/scons_support.py	2012-01-11 21:08:06.000000000 +0000
++++ python-numpy-1.5.1/numpy/core/scons_support.py	2012-01-11 21:09:57.000000000 +0000
+@@ -241,6 +241,7 @@
+     msg = {
+         'INTEL_EXTENDED_12_BYTES_LE': "Intel extended, little endian",
+         'INTEL_EXTENDED_16_BYTES_LE': "Intel extended, little endian",
++        'MOTOROLA_EXTENDED_12_BYTES_BE': "Motorola extended, big endian",
+         'IEEE_QUAD_BE': "IEEE Quad precision, big endian",
+         'IEEE_QUAD_LE': "IEEE Quad precision, little endian",
+         'IEEE_DOUBLE_LE': "IEEE Double precision, little endian",
+Index: python-numpy-1.5.1/numpy/core/setup.py
+===================================================================
+--- python-numpy-1.5.1.orig/numpy/core/setup.py	2012-01-11 21:08:06.000000000 +0000
++++ python-numpy-1.5.1/numpy/core/setup.py	2012-01-11 21:09:57.000000000 +0000
+@@ -434,6 +434,7 @@
+                 rep = check_long_double_representation(config_cmd)
+                 if rep in ['INTEL_EXTENDED_12_BYTES_LE',
+                            'INTEL_EXTENDED_16_BYTES_LE',
++                           'MOTOROLA_EXTENDED_12_BYTES_BE',
+                            'IEEE_QUAD_LE', 'IEEE_QUAD_BE',
+                            'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE',
+                            'DOUBLE_DOUBLE_BE']:
+Index: python-numpy-1.5.1/numpy/core/setup_common.py
+===================================================================
+--- python-numpy-1.5.1.orig/numpy/core/setup_common.py	2012-01-11 21:08:06.000000000 +0000
++++ python-numpy-1.5.1/numpy/core/setup_common.py	2012-01-11 21:09:57.000000000 +0000
+@@ -216,6 +216,8 @@
+                        '031', '300', '000', '000']
+ _INTEL_EXTENDED_16B = ['000', '000', '000', '000', '240', '242', '171', '353',
+                        '031', '300', '000', '000', '000', '000', '000', '000']
++_MOTOROLA_EXTENDED_12B = ['300', '031', '000', '000', '353', '171',
++                          '242', '240', '000', '000', '000', '000']
+ _IEEE_QUAD_PREC_BE = ['300', '031', '326', '363', '105', '100', '000', '000',
+                       '000', '000', '000', '000', '000', '000', '000', '000']
+ _IEEE_QUAD_PREC_LE = _IEEE_QUAD_PREC_BE[::-1]
+@@ -249,6 +251,8 @@
+                 if read[:12] == _BEFORE_SEQ[4:]:
+                     if read[12:-8] == _INTEL_EXTENDED_12B:
+                         return 'INTEL_EXTENDED_12_BYTES_LE'
++                    if read[12:-8] == _MOTOROLA_EXTENDED_12B:
++                        return 'MOTOROLA_EXTENDED_12_BYTES_BE'
+                 elif read[:8] == _BEFORE_SEQ[8:]:
+                     if read[8:-8] == _INTEL_EXTENDED_16B:
+                         return 'INTEL_EXTENDED_16_BYTES_LE'
+Index: python-numpy-1.5.1/numpy/core/src/npymath/npy_math_private.h
+===================================================================
+--- python-numpy-1.5.1.orig/numpy/core/src/npymath/npy_math_private.h	2012-01-11 21:08:05.000000000 +0000
++++ python-numpy-1.5.1/numpy/core/src/npymath/npy_math_private.h	2012-01-11 21:09:57.000000000 +0000
+@@ -250,6 +250,45 @@
+     typedef npy_uint32 ldouble_man_t;
+     typedef npy_uint32 ldouble_exp_t;
+     typedef npy_uint32 ldouble_sign_t;
++#elif defined(HAVE_LDOUBLE_MOTOROLA_EXTENDED_12_BYTES_BE)
++    /*
++     * Motorola extended 80 bits precision. Bit representation is
++     *          |     s  |eeeeeeeeeeeeeee|  junk  |mmmmmmmm................mmmmmmm|
++     *          |  1 bit |    15 bits    | 16 bits|            64 bits            |
++     *          |             a[0]                |     a[1]     |    a[2]        |
++     *
++     * 16 low bits of a[0] are junk
++     */
++    typedef npy_uint32 IEEEl2bitsrep_part;
++
++/* my machine */
++
++    union IEEEl2bitsrep {
++        npy_longdouble     e;
++        IEEEl2bitsrep_part a[3];
++    };
++
++    #define LDBL_MANL_INDEX     2
++    #define LDBL_MANL_MASK      0xFFFFFFFF
++    #define LDBL_MANL_SHIFT     0
++
++    #define LDBL_MANH_INDEX     1
++    #define LDBL_MANH_MASK      0xFFFFFFFF
++    #define LDBL_MANH_SHIFT     0
++
++    #define LDBL_EXP_INDEX      0
++    #define LDBL_EXP_MASK       0x7FFF0000
++    #define LDBL_EXP_SHIFT      16
++
++    #define LDBL_SIGN_INDEX     0
++    #define LDBL_SIGN_MASK      0x80000000
++    #define LDBL_SIGN_SHIFT     31
++
++    #define LDBL_NBIT           0x80000000
++
++    typedef npy_uint32 ldouble_man_t;
++    typedef npy_uint32 ldouble_exp_t;
++    typedef npy_uint32 ldouble_sign_t;
+ #elif defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \
+       defined(HAVE_LDOUBLE_IEEE_DOUBLE_BE)
+     /* 64 bits IEEE double precision aligned on 16 bytes: used by ppc arch on
+Index: python-numpy-1.5.1/numpy/core/src/private/npy_fpmath.h
+===================================================================
+--- python-numpy-1.5.1.orig/numpy/core/src/private/npy_fpmath.h	2012-01-11 21:08:05.000000000 +0000
++++ python-numpy-1.5.1/numpy/core/src/private/npy_fpmath.h	2012-01-11 21:09:57.000000000 +0000
+@@ -40,6 +40,7 @@
+       defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \
+       defined(HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE) || \
+       defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE) || \
++      defined(HAVE_LDOUBLE_MOTOROLA_EXTENDED_12_BYTES_BE) || \
+       defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE))
+     #error No long double representation defined
+ #endif
diff -Nru python-numpy-1.5.1/debian/patches/series python-numpy-1.5.1/debian/patches/series
--- python-numpy-1.5.1/debian/patches/series	2010-10-27 18:08:51.000000000 +0000
+++ python-numpy-1.5.1/debian/patches/series	2012-01-11 20:27:52.000000000 +0000
@@ -3,3 +3,4 @@
 03_force_f2py_version.patch
 #05_fix_endianness_detection.patch
 10_use_local_python.org_object.inv_sphinx.diff
+20_m68k_long_double_format.diff


More information about the Python-modules-team mailing list