Github messages for voidlinux
 help / color / mirror / Atom feed
From: fosslinux <fosslinux@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] python-numpy: fix for armv5tel-musl.
Date: Sun, 20 Sep 2020 10:40:24 +0200	[thread overview]
Message-ID: <20200920084024.X9Fun6YGP4zJpx-k4MNvzJDCXGv0xAu0UoNSdYUfznY@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-24988@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

There is an updated pull request by fosslinux against master on the void-packages repository

https://github.com/fosslinux/void-packages python-matplotlib-fix
https://github.com/void-linux/void-packages/pull/24988

python-numpy: fix for armv5tel-musl.
musl differs from glibc in that it dosen't provide fenv.h, on arm, when it
believes the architecture dosen't use hardware floating point in any
way. While this is mostly correct, numpy dosen't use them for floating
point reasons -- it just uses them as general, as per the code, "normal
GCC" constants. Hence, extract the constants from the file and provide
them to numpy all the time for armv5tel-musl, the only affected arch.

A patch file from https://github.com/void-linux/void-packages/pull/24988.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python-matplotlib-fix-24988.patch --]
[-- Type: text/x-diff, Size: 3865 bytes --]

From 8f1baaffbae125a450bfabe6173c7622c580f186 Mon Sep 17 00:00:00 2001
From: fosslinux <fosslinux@aussies.space>
Date: Sun, 20 Sep 2020 18:38:07 +1000
Subject: [PATCH 1/2] python3-numpy: fix armv5tel-musl.

in fenv.h, musl disables the normal set of constants that you would get
on arm with an arm device with an fpu (armv6 and up), but armv5tel on
void uses softfloat all the time. But python3-numpy dosen't use these to
interact with the fpu (the compiler would generate those instructions)
and rather just uses those constants for a generic GCC implementation.
So we give them out anyway.
---
 srcpkgs/python3-numpy/files/fenv-constants.h     | 10 ++++++++++
 srcpkgs/python3-numpy/files/fenv-constants.patch | 11 +++++++++++
 srcpkgs/python3-numpy/template                   |  9 +++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 srcpkgs/python3-numpy/files/fenv-constants.h
 create mode 100644 srcpkgs/python3-numpy/files/fenv-constants.patch

diff --git a/srcpkgs/python3-numpy/files/fenv-constants.h b/srcpkgs/python3-numpy/files/fenv-constants.h
new file mode 100644
index 00000000000..c2c21d2bb23
--- /dev/null
+++ b/srcpkgs/python3-numpy/files/fenv-constants.h
@@ -0,0 +1,10 @@
+#define FE_INVALID    1
+#define FE_DIVBYZERO  2
+#define FE_OVERFLOW   4
+#define FE_UNDERFLOW  8
+#define FE_INEXACT    16
+#define FE_ALL_EXCEPT 31
+#define FE_TONEAREST  0
+#define FE_DOWNWARD   0x800000
+#define FE_UPWARD     0x400000
+#define FE_TOWARDZERO 0xc00000
diff --git a/srcpkgs/python3-numpy/files/fenv-constants.patch b/srcpkgs/python3-numpy/files/fenv-constants.patch
new file mode 100644
index 00000000000..987ad4e346f
--- /dev/null
+++ b/srcpkgs/python3-numpy/files/fenv-constants.patch
@@ -0,0 +1,11 @@
+--- numpy/core/src/npymath/ieee754.c.src	2020-09-20 14:53:51.998825328 +1000
++++ numpy/core/src/npymath/ieee754.c.src	2020-09-20 14:54:03.611889518 +1000
+@@ -8,6 +8,8 @@
+ #include "npy_math_private.h"
+ #include "numpy/utils.h"
+ 
++#include "fenv-constants.h"
++
+ #ifndef HAVE_COPYSIGN
+ double npy_copysign(double x, double y)
+ {
diff --git a/srcpkgs/python3-numpy/template b/srcpkgs/python3-numpy/template
index 759899d8e7b..c14d7381e67 100644
--- a/srcpkgs/python3-numpy/template
+++ b/srcpkgs/python3-numpy/template
@@ -16,6 +16,15 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=5ee0d6d17fe01dde9824811516d94ba8adb9349d81ef78d0696e6b03097498b8
 alternatives="numpy:f2py:/usr/bin/f2py3"
 
+post_patch() {
+	case "${XBPS_TARGET_MACHINE}" in
+		armv5tel-musl)
+			cp "${FILESDIR}/fenv-constants.h" numpy/core/src/npymath/
+			patch -Np0 -i "${FILESDIR}/fenv-constants.patch"
+			;;
+	esac
+}
+
 do_check() {
 	./runtests.py -v
 }

From dfb16218c7452c1ea52ed719fa4d442f17600f8f Mon Sep 17 00:00:00 2001
From: fosslinux <fosslinux@aussies.space>
Date: Sun, 20 Sep 2020 18:39:51 +1000
Subject: [PATCH 2/2] python-numpy: fix armv5tel-musl.

Uses the same patch and file from python3-numpy so we just use that from
python3-numpy's files directory.
---
 srcpkgs/python-numpy/template | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/srcpkgs/python-numpy/template b/srcpkgs/python-numpy/template
index 52308fd2aa6..df6c2389add 100644
--- a/srcpkgs/python-numpy/template
+++ b/srcpkgs/python-numpy/template
@@ -15,6 +15,17 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=3c82a9b8616e3096a79a2af9c288d8ed4013a10fc7baf3eaf54655309734dadd
 alternatives="numpy:f2py:/usr/bin/f2py2"
 
+post_patch() {
+	case "${XBPS_TARGET_MACHINE}" in
+		armv5tel-musl)
+			cp "${XBPS_SRCPKGDIR}/python3-numpy/files/fenv-constants.h" \
+                numpy/core/src/npymath/
+			patch -Np0 -i \
+                "${XBPS_SRCPKGDIR}/python3-numpy/files/fenv-constants.patch"
+			;;
+	esac
+}
+
 post_install() {
 	# create compat symlinks for .h files
 	vmkdir ${py2_inc}

  reply	other threads:[~2020-09-20  8:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20  8:18 [PR PATCH] " fosslinux
2020-09-20  8:40 ` fosslinux [this message]
2020-09-20  8:40 ` fosslinux
2020-09-22  6:04 ` [PR PATCH] [Updated] " fosslinux
2020-09-25  0:31 ` [PR REVIEW] " sgn
2020-09-25  8:10 ` fosslinux
2020-09-29  4:39 ` [PR PATCH] [Updated] " fosslinux
2020-10-01 22:52 ` fosslinux
2020-10-09 20:21 ` [PR REVIEW] " ericonr
2020-10-10  2:41 ` fosslinux
2020-10-10  2:59 ` [PR PATCH] [Updated] " fosslinux
2020-10-10  4:21 ` [PR REVIEW] " ericonr
2020-10-10 10:20 ` fosslinux
2020-12-01  0:27 ` sgn
2020-12-01  0:43 ` sgn
2020-12-01  0:47 ` sgn
2020-12-01  1:10 ` ericonr
2020-12-09  5:08 ` [PR REVIEW] " ahesford
2020-12-09  7:17 ` fosslinux
2020-12-31  1:06 ` [PR PATCH] [Updated] " fosslinux
2020-12-31  1:22 ` fosslinux
2020-12-31  1:22 ` [PR REVIEW] " fosslinux
2020-12-31  1:22 ` fosslinux
2020-12-31 17:59 ` ahesford
2020-12-31 23:34 ` fosslinux
2020-12-31 23:37 ` [PR PATCH] [Updated] " fosslinux
2021-01-06 16:26 ` ahesford
2021-01-06 17:26 ` [PR PATCH] [Closed]: " ahesford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200920084024.X9Fun6YGP4zJpx-k4MNvzJDCXGv0xAu0UoNSdYUfznY@z \
    --to=fosslinux@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).