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: Thu, 31 Dec 2020 02:22:11 +0100	[thread overview]
Message-ID: <20201231012211.Tp804fu4lvVotT1ejHvKNmHWJnYoQRwgUTRdlHMx1Cg@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: 789 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.
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.

python-numpy uses the same patch from python3-numpy.

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: 8479 bytes --]

From c3e78f8692e4a8c9410b2e22e16b56a2f7b40cd3 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                   | 11 ++++++++++-
 3 files changed, 31 insertions(+), 1 deletion(-)
 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 e54a96772e0..5ae5b16986e 100644
--- a/srcpkgs/python3-numpy/template
+++ b/srcpkgs/python3-numpy/template
@@ -16,8 +16,17 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=6082884371a5998fa8b006b506f4827c0617d789d7b3ee78549bb044139a9a8e
 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
+	./runtests.py -v || : # tests currently broken
 }
 
 post_install() {

From dd4c4c9054e22cf5c895ceb1afe1ecef251ff5a7 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/m4/files/no-info.patch                | 69 +++++++++++++++++++
 srcpkgs/python-numpy/files/fenv-constants.h   | 10 +++
 .../python-numpy/files/fenv-constants.patch   | 11 +++
 srcpkgs/python-numpy/template                 | 10 ++-
 4 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/m4/files/no-info.patch
 create mode 100644 srcpkgs/python-numpy/files/fenv-constants.h
 create mode 100644 srcpkgs/python-numpy/files/fenv-constants.patch

diff --git a/srcpkgs/m4/files/no-info.patch b/srcpkgs/m4/files/no-info.patch
new file mode 100644
index 00000000000..29a7790f7fb
--- /dev/null
+++ b/srcpkgs/m4/files/no-info.patch
@@ -0,0 +1,69 @@
+diff --color -ru m4-1.4.18.bak/doc/Makefile.in m4-1.4.18/doc/Makefile.in
+--- m4-1.4.18.bak/doc/Makefile.in	2020-10-19 18:24:44.463675435 +1100
++++ m4-1.4.18/doc/Makefile.in	2020-10-19 18:27:53.400673200 +1100
+@@ -251,7 +251,7 @@
+ am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@)
+ am__v_texidevnull_0 = > /dev/null
+ am__v_texidevnull_1 = 
+-INFO_DEPS = $(srcdir)/m4.info
++INFO_DEPS =
+ TEXINFO_TEX = $(top_srcdir)/build-aux/texinfo.tex
+ am__TEXINFO_TEX_DIR = $(top_srcdir)/build-aux
+ DVIS = m4.dvi
+@@ -1500,7 +1500,7 @@
+ all: all-am
+ 
+ .SUFFIXES:
+-.SUFFIXES: .1 .dvi .html .info .pdf .ps .texi
++.SUFFIXES: .1 .dvi .html .pdf .ps .texi
+ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+ 	@for dep in $?; do \
+ 	  case '$(am__configure_deps)' in \
+@@ -1531,28 +1531,6 @@
+ 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ $(am__aclocal_m4_deps):
+ 
+-.texi.info:
+-	$(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \
+-	am__cwd=`pwd` && $(am__cd) $(srcdir) && \
+-	rm -rf $$backupdir && mkdir $$backupdir && \
+-	if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
+-	  for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+-	    if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
+-	  done; \
+-	else :; fi && \
+-	cd "$$am__cwd"; \
+-	if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+-	 -o $@ $<; \
+-	then \
+-	  rc=0; \
+-	  $(am__cd) $(srcdir); \
+-	else \
+-	  rc=$$?; \
+-	  $(am__cd) $(srcdir) && \
+-	  $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
+-	fi; \
+-	rm -rf $$backupdir; exit $$rc
+-
+ .texi.dvi:
+ 	$(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ 	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+@@ -1574,7 +1552,6 @@
+ 	else \
+ 	  rm -rf $(@:.html=.htp); exit 1; \
+ 	fi
+-$(srcdir)/m4.info: m4.texi $(srcdir)/version.texi $(m4_TEXINFOS)
+ m4.dvi: m4.texi $(srcdir)/version.texi $(m4_TEXINFOS)
+ m4.pdf: m4.texi $(srcdir)/version.texi $(m4_TEXINFOS)
+ m4.html: m4.texi $(srcdir)/version.texi $(m4_TEXINFOS)
+diff --color -ru m4-1.4.18.bak/Makefile m4-1.4.18/Makefile
+--- m4-1.4.18.bak/Makefile	2020-10-19 18:24:44.412675166 +1100
++++ m4-1.4.18/Makefile	2020-10-19 18:25:28.598908512 +1100
+@@ -1126,7 +1126,6 @@
+ M4tests_LIBOBJS = 
+ M4tests_LTLIBOBJS = 
+ M4tests_WITNESS = IN_M4_GNULIB_TESTS
+-MAKEINFO = ${SHELL} /builddir/m4-1.4.18/build-aux/missing makeinfo
+ MKDIR_P = /usr/bin/mkdir -p
+ NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = <ctype.h>
+ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = <dirent.h>
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..d0bc473d65a 100644
--- a/srcpkgs/python-numpy/template
+++ b/srcpkgs/python-numpy/template
@@ -4,7 +4,6 @@ version=1.16.5
 revision=1
 wrksrc="numpy-${version}"
 build_style=python2-module
-pycompile_module="numpy"
 hostmakedepends="python-setuptools python-Cython gcc-fortran"
 makedepends="python-devel lapack-devel cblas-devel"
 short_desc="Fast and sophisticated array facility to Python2"
@@ -15,6 +14,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}

  parent reply	other threads:[~2020-12-31  1:22 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 ` [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 [this message]
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=20201231012211.Tp804fu4lvVotT1ejHvKNmHWJnYoQRwgUTRdlHMx1Cg@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).