OLD | NEW |
(Empty) | |
| 1 diff --git a/numpy/core/code_generators/generate_numpy_api.py b/numpy/core/code_
generators/generate_numpy_api.py |
| 2 index ce270a6..4094a56 100644 |
| 3 --- a/numpy/core/code_generators/generate_numpy_api.py |
| 4 +++ b/numpy/core/code_generators/generate_numpy_api.py |
| 5 @@ -111,14 +111,18 @@ _import_array(void) |
| 6 } |
| 7 #if NPY_BYTE_ORDER == NPY_BIG_ENDIAN |
| 8 if (st != NPY_CPU_BIG) { |
| 9 - PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as "\ |
| 10 - "big endian, but detected different endianness at runtime"); |
| 11 + PyErr_Format(PyExc_RuntimeError, "FATAL: (for real) module compiled as "\ |
| 12 + "big endian, but detected different endianness at runtime. "\ |
| 13 + "(%%d %%d %%d) (%%d %%d)", st, (int) NPY_CPU_BIG, (int) NPY_CPU_LI
TTLE, |
| 14 + (int) NPY_BIG_ENDIAN, (int) NPY_LITTLE_ENDIAN); |
| 15 return -1; |
| 16 } |
| 17 #elif NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN |
| 18 if (st != NPY_CPU_LITTLE) { |
| 19 - PyErr_Format(PyExc_RuntimeError, "FATAL: module compiled as "\ |
| 20 - "little endian, but detected different endianness at runtime"); |
| 21 + PyErr_Format(PyExc_RuntimeError, "FATAL: (for real) module compiled as "\ |
| 22 + "little endian, but detected different endianness at runtime. " \ |
| 23 + "(%%d %%d %%d) (%%d %%d)", st, (int) NPY_CPU_BIG, (int) NPY_CPU_LI
TTLE, |
| 24 + (int) NPY_BIG_ENDIAN, (int) NPY_LITTLE_ENDIAN); |
| 25 return -1; |
| 26 } |
| 27 #endif |
| 28 diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_c
pu.h |
| 29 index ab14731..86c48ac 100644 |
| 30 --- a/numpy/core/include/numpy/npy_cpu.h |
| 31 +++ b/numpy/core/include/numpy/npy_cpu.h |
| 32 @@ -27,7 +27,10 @@ |
| 33 * i386 by Sun compilers on opensolaris at least |
| 34 */ |
| 35 #define NPY_CPU_X86 |
| 36 -#elif defined(__x86_64__) || defined(__amd64__) || defined(__x86_64) || defined
(_M_AMD64) |
| 37 +/* For [P]NaCl toolchain, we need to define a CPU manually in order to ensure |
| 38 + * it has been defined at all. This only comes into play in a handful of |
| 39 + * places, but is necessary to generate any code at all. */ |
| 40 +#elif defined(__x86_64__) || defined(__amd64__) || defined(__x86_64) || defined
(_M_AMD64) || defined (__native_client__) |
| 41 /* |
| 42 * both __x86_64__ and __amd64__ are defined by gcc |
| 43 * __x86_64 defined by sun compiler on opensolaris at least |
| 44 diff --git a/numpy/core/setup.py b/numpy/core/setup.py |
| 45 index 28b15aa..a6c8513 100644 |
| 46 --- a/numpy/core/setup.py |
| 47 +++ b/numpy/core/setup.py |
| 48 @@ -288,7 +288,7 @@ def check_types(config_cmd, ext, build_dir): |
| 49 "Cannot compile 'Python.h'. Perhaps you need to "\ |
| 50 "install python-dev|python-devel.") |
| 51 res = config_cmd.check_header("endian.h") |
| 52 - if res: |
| 53 + if res and os.environ.get("NACL_PORT_BUILD") not in ["host", "bootstrap"]: |
| 54 private_defines.append(('HAVE_ENDIAN_H', 1)) |
| 55 public_defines.append(('NPY_HAVE_ENDIAN_H', 1)) |
| 56 |
| 57 @@ -465,7 +465,7 @@ def configuration(parent_package='',top_path=None): |
| 58 'MOTOROLA_EXTENDED_12_BYTES_BE', |
| 59 'IEEE_QUAD_LE', 'IEEE_QUAD_BE', |
| 60 'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE', |
| 61 - 'DOUBLE_DOUBLE_BE']: |
| 62 + 'DOUBLE_DOUBLE_BE', "NO_LONG_DOUBLE"]: |
| 63 moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1)) |
| 64 else: |
| 65 raise ValueError("Unrecognized long double format: %s" % re
p) |
| 66 @@ -648,12 +648,13 @@ def configuration(parent_package='',top_path=None): |
| 67 # explicitly add an extension which has generate_config_h and |
| 68 # generate_numpyconfig_h as sources *before* adding npymath. |
| 69 |
| 70 - config.add_extension('_dummy', |
| 71 - sources = [join('src', 'dummymodule.c'), |
| 72 - generate_config_h, |
| 73 - generate_numpyconfig_h, |
| 74 - generate_numpy_api] |
| 75 - ) |
| 76 + if os.environ.get("NACL_PORT_BUILD") != "bootstrap": |
| 77 + config.add_extension('_dummy', |
| 78 + sources = [join('src', 'dummymodule.c'), |
| 79 + generate_config_h, |
| 80 + generate_numpyconfig_h, |
| 81 + generate_numpy_api] |
| 82 + ) |
| 83 |
| 84 ####################################################################### |
| 85 # npymath library # |
| 86 diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py |
| 87 index bad3607..1574d0d 100644 |
| 88 --- a/numpy/core/setup_common.py |
| 89 +++ b/numpy/core/setup_common.py |
| 90 @@ -3,6 +3,7 @@ from __future__ import division, absolute_import, print_function |
| 91 # Code common to build tools |
| 92 import sys |
| 93 from os.path import join |
| 94 +import os |
| 95 import warnings |
| 96 import copy |
| 97 import binascii |
| 98 @@ -304,5 +305,7 @@ def long_double_representation(lines): |
| 99 if saw is not None: |
| 100 raise ValueError("Unrecognized format (%s)" % saw) |
| 101 else: |
| 102 + if os.environ.get("NACL_PORT_BUILD") == "bootstrap": |
| 103 + return "NO_LONG_DOUBLE" |
| 104 # We never detected the after_sequence |
| 105 raise ValueError("Could not lock sequences (%s)" % saw) |
| 106 diff --git a/numpy/core/src/npymath/npy_math_private.h b/numpy/core/src/npymath/
npy_math_private.h |
| 107 index 2bca6bf..9d35356 100644 |
| 108 --- a/numpy/core/src/npymath/npy_math_private.h |
| 109 +++ b/numpy/core/src/npymath/npy_math_private.h |
| 110 @@ -51,29 +51,27 @@ |
| 111 * fix this at some point */ |
| 112 #define IEEE_WORD_ORDER NPY_BYTE_ORDER |
| 113 |
| 114 -#if IEEE_WORD_ORDER == NPY_BIG_ENDIAN |
| 115 +#if (IEEE_WORD_ORDER == NPY_LITTLE_ENDIAN) || defined(__native_client__) |
| 116 |
| 117 typedef union |
| 118 { |
| 119 double value; |
| 120 struct |
| 121 { |
| 122 - npy_uint32 msw; |
| 123 npy_uint32 lsw; |
| 124 + npy_uint32 msw; |
| 125 } parts; |
| 126 } ieee_double_shape_type; |
| 127 |
| 128 -#endif |
| 129 - |
| 130 -#if IEEE_WORD_ORDER == NPY_LITTLE_ENDIAN |
| 131 +#elif IEEE_WORD_ORDER == NPY_BIG_ENDIAN |
| 132 |
| 133 typedef union |
| 134 { |
| 135 double value; |
| 136 struct |
| 137 { |
| 138 - npy_uint32 lsw; |
| 139 npy_uint32 msw; |
| 140 + npy_uint32 lsw; |
| 141 } parts; |
| 142 } ieee_double_shape_type; |
| 143 |
| 144 diff --git a/numpy/core/src/private/npy_fpmath.h b/numpy/core/src/private/npy_fp
math.h |
| 145 index 8a120ca..984bd65 100644 |
| 146 --- a/numpy/core/src/private/npy_fpmath.h |
| 147 +++ b/numpy/core/src/private/npy_fpmath.h |
| 148 @@ -7,6 +7,10 @@ |
| 149 #include "numpy/npy_cpu.h" |
| 150 #include "numpy/npy_common.h" |
| 151 |
| 152 +#ifdef __native_client__ |
| 153 + #define HAVE_LDOUBLE_IEEE_DOUBLE_LE |
| 154 +#endif |
| 155 + |
| 156 #ifdef NPY_OS_DARWIN |
| 157 /* This hardcoded logic is fragile, but universal builds makes it |
| 158 * difficult to detect arch-specific features */ |
| 159 diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py |
| 160 index f77e525..7bdaee6 100644 |
| 161 --- a/numpy/distutils/misc_util.py |
| 162 +++ b/numpy/distutils/misc_util.py |
| 163 @@ -2036,6 +2036,11 @@ def get_cmd(cmdname, _cache={}): |
| 164 |
| 165 def get_numpy_include_dirs(): |
| 166 # numpy_include_dirs are set by numpy/core/setup.py, otherwise [] |
| 167 + if os.environ.get("NACL_PORT_BUILD") == "dest": |
| 168 + # We fake our numpy includes when building on the destination. |
| 169 + base_path = os.environ["NACL_BUILD_TREE"] |
| 170 + return [os.path.join(base_path, |
| 171 + "lib/python2.7/site-packages/numpy/core/include")] |
| 172 include_dirs = Configuration.numpy_include_dirs[:] |
| 173 if not include_dirs: |
| 174 import numpy |
OLD | NEW |