All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] Misc Python fixes and updates
@ 2014-07-23 18:33 Thomas Petazzoni
  2014-07-23 18:33 ` [Buildroot] [PATCH 1/4] mpdecimal: new package Thomas Petazzoni
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-23 18:33 UTC (permalink / raw)
  To: buildroot

Hello,

Here are four patches doing misc Python fixes and updates. Patch 1 and
2 combined solve one autobuilder issues (decimal module does not build
on configurations where fenv is not available), and patch 4 solves
another autobuilder issue (python-numpy does not build on
configurations where fenv is not available).

Thanks,

Thomas

Thomas Petazzoni (4):
  mpdecimal: new package
  python3: optional decimal module support
  python3: define license and license files
  python-numpy: add patch to fix build on uClibc

 package/Config.in                                  |  1 +
 package/mpdecimal/Config.in                        | 10 +++
 package/mpdecimal/mpdecimal.mk                     | 24 +++++++
 .../python-numpy-0001-no-fenv-on-uclibc.patch      | 79 ++++++++++++++++++++++
 package/python3/Config.in                          |  6 ++
 package/python3/python3-111-optional-decimal.patch | 53 +++++++++++++++
 package/python3/python3.mk                         |  9 +++
 7 files changed, 182 insertions(+)
 create mode 100644 package/mpdecimal/Config.in
 create mode 100644 package/mpdecimal/mpdecimal.mk
 create mode 100644 package/python-numpy/python-numpy-0001-no-fenv-on-uclibc.patch
 create mode 100644 package/python3/python3-111-optional-decimal.patch

-- 
2.0.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/4] mpdecimal: new package
  2014-07-23 18:33 [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
@ 2014-07-23 18:33 ` Thomas Petazzoni
  2014-07-23 18:33 ` [Buildroot] [PATCH 2/4] python3: optional decimal module support Thomas Petazzoni
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-23 18:33 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/Config.in              |  1 +
 package/mpdecimal/Config.in    | 10 ++++++++++
 package/mpdecimal/mpdecimal.mk | 24 ++++++++++++++++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 package/mpdecimal/Config.in
 create mode 100644 package/mpdecimal/mpdecimal.mk

diff --git a/package/Config.in b/package/Config.in
index 703fd3d..f921b0a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -856,6 +856,7 @@ menu "Other"
 	source "package/linux-pam/Config.in"
 	source "package/lttng-libust/Config.in"
 	source "package/mpc/Config.in"
+	source "package/mpdecimal/Config.in"
 	source "package/mpfr/Config.in"
 	source "package/msgpack/Config.in"
 	source "package/mtdev2tuio/Config.in"
diff --git a/package/mpdecimal/Config.in b/package/mpdecimal/Config.in
new file mode 100644
index 0000000..929d415
--- /dev/null
+++ b/package/mpdecimal/Config.in
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_MPDECIMAL
+	bool "mpdecimal"
+	help
+	  mpdecimal is a package for correctly-rounded arbitrary
+	  precision decimal floating point arithmetic. Starting from
+	  version 2.4, mpdecimal includes only the libmpdec
+	  library. Further mpdecimal development will focus
+	  exclusively on libmpdec.
+
+	  http://www.bytereef.org/mpdecimal/
diff --git a/package/mpdecimal/mpdecimal.mk b/package/mpdecimal/mpdecimal.mk
new file mode 100644
index 0000000..cb028a5
--- /dev/null
+++ b/package/mpdecimal/mpdecimal.mk
@@ -0,0 +1,24 @@
+################################################################################
+#
+# mpdecimal
+#
+################################################################################
+
+MPDECIMAL_SITE = http://www.bytereef.org/software/mpdecimal/releases/
+MPDECIMAL_VERSION = 2.4.0
+MPDECIMAL_INSTALL_STAGING = YES
+MPDECIMAL_LICENSE = BSD-2c
+MPDECIMAL_LICENSE_FILES = LICENSE.txt
+MPDECIMAL_CONF_OPT = LD="$(TARGET_CC)"
+
+# On i386, by default, mpdecimal tries to uses <fenv.h> which is not
+# available in musl/glibc. So in this case, we tell mpdecimal to use
+# the generic 32 bits code, which is anyway the one used on ARM,
+# PowerPC, etc.
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
+ifeq ($(BR2_i386),y)
+MPDECIMAL_CONF_ENV += MACHINE=ansi32
+endif
+endif
+
+$(eval $(autotools-package))
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/4] python3: optional decimal module support
  2014-07-23 18:33 [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
  2014-07-23 18:33 ` [Buildroot] [PATCH 1/4] mpdecimal: new package Thomas Petazzoni
@ 2014-07-23 18:33 ` Thomas Petazzoni
  2014-07-23 18:33 ` [Buildroot] [PATCH 3/4] python3: define license and license files Thomas Petazzoni
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-23 18:33 UTC (permalink / raw)
  To: buildroot

This commit makes the decimal module support optional: since Python
3.3 it relies on an external library. The source code of this library
is available built-in as part of the Python sources, but in Buildroot
we generally prefer to use the external library when possible.

To achieve this, this commit adds a patch to Python that is similar to
the one we use for expat support, but this time for the
libmpdec/mpdecimal library.

As a consequence, since mpdecimal now builds properly even when
<fenv.h> is not available (on i386), this commit fixes:

  http://autobuild.buildroot.org/results/b64/b64d5c941a7cac00619da3a0696939f86a8eafc2/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/python3/Config.in                          |  6 +++
 package/python3/python3-111-optional-decimal.patch | 53 ++++++++++++++++++++++
 package/python3/python3.mk                         |  7 +++
 3 files changed, 66 insertions(+)
 create mode 100644 package/python3/python3-111-optional-decimal.patch

diff --git a/package/python3/Config.in b/package/python3/Config.in
index 12928f6..3e193c8 100644
--- a/package/python3/Config.in
+++ b/package/python3/Config.in
@@ -54,6 +54,12 @@ config BR2_PACKAGE_PYTHON3_CURSES
 	help
 	  curses module for Python3.
 
+config BR2_PACKAGE_PYTHON3_DECIMAL
+	select BR2_PACKAGE_MPDECIMAL
+	bool "decimal module"
+	help
+	  decimal module for Python3.
+
 config BR2_PACKAGE_PYTHON3_PYEXPAT
 	select BR2_PACKAGE_EXPAT
 	bool "pyexpat"
diff --git a/package/python3/python3-111-optional-decimal.patch b/package/python3/python3-111-optional-decimal.patch
new file mode 100644
index 0000000..d895ee5
--- /dev/null
+++ b/package/python3/python3-111-optional-decimal.patch
@@ -0,0 +1,53 @@
+Add an option to disable decimal
+
+This patch replaces the existing --with-system-libmpdec option with a
+--with-libmpdec={system,builtin,none} option, which allows to tell
+Python whether we want to use the system libmpdec (already installed),
+the libmpdec builtin the Python sources, or no libmpdec at all.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -2385,13 +2385,20 @@
+ AC_MSG_RESULT($with_system_ffi)
+ 
+ # Check for use of the system libmpdec library
+-AC_MSG_CHECKING(for --with-system-libmpdec)
+-AC_ARG_WITH(system_libmpdec,
+-            AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]),
++AC_MSG_CHECKING(for --with-libmpdec)
++AC_ARG_WITH(libmpdec,
++            AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
+             [],
+-            [with_system_libmpdec="no"])
++            [with_libmpdec="builtin"])
+ 
+-AC_MSG_RESULT($with_system_libmpdec)
++AC_MSG_RESULT($with_libmpdec)
++if test "$with_libmpdec" != "none"; then
++   MPDEC=yes
++else
++   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
++   MPDEC=no
++fi
++AC_SUBST(MPDEC)
+ 
+ # Check for support for loadable sqlite extensions
+ AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -1972,7 +1972,7 @@
+     def _decimal_ext(self):
+         extra_compile_args = []
+         undef_macros = []
+-        if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
++        if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"):
+             include_dirs = []
+             libraries = [':libmpdec.so.2']
+             sources = ['_decimal/_decimal.c']
diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index 1591ac9..3aa22b2 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -51,6 +51,13 @@ else
 PYTHON3_CONF_OPT += --disable-curses
 endif
 
+ifeq ($(BR2_PACKAGE_PYTHON3_DECIMAL),y)
+PYTHON3_DEPENDENCIES += mpdecimal
+PYTHON3_CONF_OPT += --with-libmpdec=system
+else
+PYTHON3_CONF_OPT += --with-libmpdec=none
+endif
+
 ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y)
 PYTHON3_DEPENDENCIES += expat
 PYTHON3_CONF_OPT += --with-expat=system
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 3/4] python3: define license and license files
  2014-07-23 18:33 [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
  2014-07-23 18:33 ` [Buildroot] [PATCH 1/4] mpdecimal: new package Thomas Petazzoni
  2014-07-23 18:33 ` [Buildroot] [PATCH 2/4] python3: optional decimal module support Thomas Petazzoni
@ 2014-07-23 18:33 ` Thomas Petazzoni
  2014-07-23 18:33 ` [Buildroot] [PATCH 4/4] python-numpy: add patch to fix build on uClibc Thomas Petazzoni
  2014-07-27 13:15 ` [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-23 18:33 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/python3/python3.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index 3aa22b2..4941316 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -8,6 +8,8 @@ PYTHON3_VERSION_MAJOR = 3.4
 PYTHON3_VERSION = $(PYTHON3_VERSION_MAJOR).1
 PYTHON3_SOURCE = Python-$(PYTHON3_VERSION).tar.xz
 PYTHON3_SITE = http://python.org/ftp/python/$(PYTHON3_VERSION)
+PYTHON3_LICENSE = Python software foundation license v2, others
+PYTHON3_LICENSE_FILES = LICENSE
 
 # Python needs itself and a "pgen" program to build itself, both being
 # provided in the Python sources. So in order to cross-compile Python,
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 4/4] python-numpy: add patch to fix build on uClibc
  2014-07-23 18:33 [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2014-07-23 18:33 ` [Buildroot] [PATCH 3/4] python3: define license and license files Thomas Petazzoni
@ 2014-07-23 18:33 ` Thomas Petazzoni
  2014-07-27 13:15 ` [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-23 18:33 UTC (permalink / raw)
  To: buildroot

Fixes:

  http://autobuild.buildroot.org/results/01d/01da44bc4b644a46326d8fbd87708b7a98971487/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 .../python-numpy-0001-no-fenv-on-uclibc.patch      | 79 ++++++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 package/python-numpy/python-numpy-0001-no-fenv-on-uclibc.patch

diff --git a/package/python-numpy/python-numpy-0001-no-fenv-on-uclibc.patch b/package/python-numpy/python-numpy-0001-no-fenv-on-uclibc.patch
new file mode 100644
index 0000000..633dbcd
--- /dev/null
+++ b/package/python-numpy/python-numpy-0001-no-fenv-on-uclibc.patch
@@ -0,0 +1,79 @@
+Don't use <fenv.h> on uClibc
+
+The python-numpy code already has provisions to not use <fenv.h> when
+not available. However, it uses __GLIBC__ to know whether fenv.h is
+available or not, but uClibc defines __GLIBC__, so python-numpy thinks
+fenv.h is available.
+
+This patch fixes that by changing all defined(__GLIBC__) occurences by
+(defined(__GLIBC__) && !defined(__UCLIBC__)).
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/numpy/core/include/numpy/ufuncobject.h
+===================================================================
+--- a/numpy/core/include/numpy/ufuncobject.h
++++ b/numpy/core/include/numpy/ufuncobject.h
+@@ -413,11 +413,11 @@
+         (void) fpsetsticky(0); \
+         }
+ 
+-#elif defined(__GLIBC__) || defined(__APPLE__) || \
++#elif (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
+       defined(__CYGWIN__) || defined(__MINGW32__) || \
+       (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
+ 
+-#if defined(__GLIBC__) || defined(__APPLE__) || \
++#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
+     defined(__MINGW32__) || defined(__FreeBSD__)
+ #include <fenv.h>
+ #elif defined(__CYGWIN__)
+Index: b/numpy/core/src/npymath/ieee754.c.src
+===================================================================
+--- a/numpy/core/src/npymath/ieee754.c.src
++++ b/numpy/core/src/npymath/ieee754.c.src
+@@ -586,11 +586,11 @@
+ }
+ 
+ 
+-#elif defined(__GLIBC__) || defined(__APPLE__) || \
++#elif (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
+       defined(__CYGWIN__) || defined(__MINGW32__) || \
+       (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
+ 
+-# if defined(__GLIBC__) || defined(__APPLE__) || \
++# if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || \
+      defined(__MINGW32__) || defined(__FreeBSD__)
+ #  include <fenv.h>
+ # elif defined(__CYGWIN__)
+Index: b/numpy/numarray/_capi.c
+===================================================================
+--- a/numpy/numarray/_capi.c
++++ b/numpy/numarray/_capi.c
+@@ -10,7 +10,7 @@
+ #include <sys/param.h>
+ #endif
+ 
+-#if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
++#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
+ #include <fenv.h>
+ #elif defined(__CYGWIN__)
+ #include "numpy/fenv/fenv.h"
+@@ -258,7 +258,7 @@
+ }
+ 
+ /* Likewise for Integer overflows */
+-#if defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
++#if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
+ static int int_overflow_error(Float64 value) { /* For x86_64 */
+     feraiseexcept(FE_OVERFLOW);
+     return (int) value;
+@@ -3007,7 +3007,7 @@
+     return retstatus;
+ }
+ 
+-#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
++#elif (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
+ 
+ static int
+ NA_checkFPErrors(void)
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 0/4] Misc Python fixes and updates
  2014-07-23 18:33 [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2014-07-23 18:33 ` [Buildroot] [PATCH 4/4] python-numpy: add patch to fix build on uClibc Thomas Petazzoni
@ 2014-07-27 13:15 ` Thomas Petazzoni
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-27 13:15 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 23 Jul 2014 20:33:17 +0200, Thomas Petazzoni wrote:

> Thomas Petazzoni (4):
>   mpdecimal: new package
>   python3: optional decimal module support
>   python3: define license and license files
>   python-numpy: add patch to fix build on uClibc

Since there was no review, and those patches are fixing build issues,
I applied them. Don't hesitate to let me know if there's anything you
don't agree with in those patches.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-27 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 18:33 [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni
2014-07-23 18:33 ` [Buildroot] [PATCH 1/4] mpdecimal: new package Thomas Petazzoni
2014-07-23 18:33 ` [Buildroot] [PATCH 2/4] python3: optional decimal module support Thomas Petazzoni
2014-07-23 18:33 ` [Buildroot] [PATCH 3/4] python3: define license and license files Thomas Petazzoni
2014-07-23 18:33 ` [Buildroot] [PATCH 4/4] python-numpy: add patch to fix build on uClibc Thomas Petazzoni
2014-07-27 13:15 ` [Buildroot] [PATCH 0/4] Misc Python fixes and updates Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.