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

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

There is a new 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: 2770 bytes --]

From 1bc2fac92b12e03bff7e85aa106aa28fd34ee13f Mon Sep 17 00:00:00 2001
From: fosslinux <fosslinux@aussies.space>
Date: Sun, 20 Sep 2020 18:15:29 +1000
Subject: [PATCH] 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.
---
 srcpkgs/python-numpy/files/fenv-constants.h     | 10 ++++++++++
 srcpkgs/python-numpy/files/fenv-constants.patch | 11 +++++++++++
 srcpkgs/python-numpy/template                   |  9 +++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 srcpkgs/python-numpy/files/fenv-constants.h
 create mode 100644 srcpkgs/python-numpy/files/fenv-constants.patch

diff --git a/srcpkgs/python-numpy/files/fenv-constants.h b/srcpkgs/python-numpy/files/fenv-constants.h
new file mode 100644
index 00000000000..c2c21d2bb23
--- /dev/null
+++ b/srcpkgs/python-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/python-numpy/files/fenv-constants.patch b/srcpkgs/python-numpy/files/fenv-constants.patch
new file mode 100644
index 00000000000..987ad4e346f
--- /dev/null
+++ b/srcpkgs/python-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/python-numpy/template b/srcpkgs/python-numpy/template
index 52308fd2aa6..d7d64d8124c 100644
--- a/srcpkgs/python-numpy/template
+++ b/srcpkgs/python-numpy/template
@@ -15,6 +15,15 @@ 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 "${FILESDIR}/fenv-constants.h" numpy/core/src/npymath/
+			patch -Np0 -i "${FILESDIR}/fenv-constants.patch"
+			;;
+	esac
+}
+
 post_install() {
 	# create compat symlinks for .h files
 	vmkdir ${py2_inc}

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

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20  8:18 fosslinux [this message]
2020-09-20  8:40 ` [PR PATCH] [Updated] " fosslinux
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=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-24988@inbox.vuxu.org \
    --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).