kivy/kivy-ios — pull request #108 by tito (2014-11-24 02:07:59+00:00)
Title: Numpy support / recipe

Numpy requires severals requirements:

- It absolutely requires unittest, that was deleted before
(`tools/reduce-python.sh`)
- It requires future_builtins (`src/ModuleSetup`)
- Deduplication of symbols now can merge multiple .a for easier
management in Xcode (`tools/environments.sh`)
- Avoid passing specific linker parameters to ar (`-Wl` ignored in
`tools/liblink`).

Numpy itself have few patch for:

- force endianess to be little, using directly `endian.h` leads to
detection error during the build process.
- force not BLAS to be built, Accelerate framework already have it
- rework the dependencies relation for lapack_lite and _umath_linalg,
to prevent duplicate symbols and force compilation of necessary module
/ missing symbols.

To use it:

1. Compile the toolchain with `tools/build-all.sh`
2. Compile Numpy with `tools/build-numpy.sh`
3. Create a project with `tools/xcode-create-project.sh`
4. In your Xcode project, click on your project, go to `Build Phases`, open the `Link Binary With Libraries`, click on the `+` at the end of the list and add the `kivy-ios/build/lib/libnumpy.a`.
5. Repeat the 4. operation and add the Accelerate Framework

Done !

---

Here is the test i runned on an iPad 3 / iOS 7.1 (i've lowered the Deployement Target to 7.1 in the project):

```
from numpy import *
a = arange(12)
print a
a = a.reshape(3,2,2)
print a

print "--> test linalg"
import numpy as np
a = np.array([[3,1], [1,2]])
b = np.array([9,8])
x = np.linalg.solve(a, b)
print "x is", x
print "is the solution is correct?", np.allclose(np.dot(a, x), b)
```