python-numpy: new package
authorSamuel Martin <s.martin49@gmail.com>
Tue, 22 Apr 2014 23:15:37 +0000 (01:15 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 16 Jul 2014 20:27:34 +0000 (22:27 +0200)
This patch add NumPy package for python.

Since Fortran support has been deprecated in Buildroot since the 2013.11
release, and because most of the external toolchains do not provide a
Fortran compiler, it is necessary to explicity disable Fortran compiler
to avoid catching the one from the host system if any.

We also need to fill a site.cfg file to tell NumPy build-system where
it should looking for BLAS and LAPACK libraries.

Some packages may include headers provided by python-numpy package, so
python-numpy is installed to the staging directory.

[Thomas:
 - add dependency in Config.in to take into account fenv.h
   requirement, suggested by Yann E. Morin.
 - modified to use the staging installation logic in the python
   package infrastructure.]

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/Config.in
package/python-numpy/Config.in [new file with mode: 0644]
package/python-numpy/python-numpy.mk [new file with mode: 0644]

index 2196783fe231230dcfc1915193650b167ecc8b72..4b7ccd9795f861a3b004d24ae958babc8ebff3b7 100644 (file)
@@ -472,6 +472,7 @@ menu "external python modules"
        source "package/python-msgpack/Config.in"
        source "package/python-netifaces/Config.in"
        source "package/python-nfc/Config.in"
+       source "package/python-numpy/Config.in"
        source "package/python-posix-ipc/Config.in"
        source "package/python-protobuf/Config.in"
        source "package/python-pyasn/Config.in"
diff --git a/package/python-numpy/Config.in b/package/python-numpy/Config.in
new file mode 100644 (file)
index 0000000..169b91f
--- /dev/null
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_PYTHON_NUMPY
+       bool "python-numpy"
+       # numpy needs fenv.h. Available for all architectures in
+       # glibc, but only for x86 and x86-64 in uClibc.
+       depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_i386 || BR2_x86_64
+       help
+         NumPy is the fundamental package for scientific computing
+         with Python.
+
+         Note that NumPy needs fenv.h fully supported by the
+         C library.
+
+         http://www.numpy.org/
diff --git a/package/python-numpy/python-numpy.mk b/package/python-numpy/python-numpy.mk
new file mode 100644 (file)
index 0000000..e309ef6
--- /dev/null
@@ -0,0 +1,28 @@
+################################################################################
+#
+# python-numpy
+#
+################################################################################
+
+PYTHON_NUMPY_VERSION = 1.8.0
+PYTHON_NUMPY_SOURCE = numpy-$(PYTHON_NUMPY_VERSION).tar.gz
+PYTHON_NUMPY_SITE = http://downloads.sourceforge.net/numpy
+PYTHON_NUMPY_LICENSE = BSD-3c
+PYTHON_NUMPY_LICENSE_FILES = LICENSE.txt
+PYTHON_NUMPY_SETUP_TYPE = distutils
+
+PYTHON_NUMPY_BUILD_OPT = --fcompiler=None
+
+define PYTHON_NUMPY_CONFIGURE_CMDS
+       -rm -f $(@D)/site.cfg
+       echo "[DEFAULT]" >> $(@D)/site.cfg
+       echo "library_dirs = $(STAGING_DIR)/usr/lib" >> $(@D)/site.cfg
+       echo "include_dirs = $(STAGING_DIR)/usr/include" >> $(@D)/site.cfg
+       echo "libraries =" >> $(@D)/site.cfg
+endef
+
+# Some package may include few headers from NumPy, so let's install it
+# in the staging area.
+PYTHON_NUMPY_INSTALL_STAGING = YES
+
+$(eval $(python-package))