From ccfe9f657dbef5ec20154f02d2ba69bc94d62ea7 Mon Sep 17 00:00:00 2001 From: fosslinux 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 e54a96772e0..38722f29b4f 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=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 } From 920f2ff8f707368dff033a110af3011d88285e60 Mon Sep 17 00:00:00 2001 From: fosslinux 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 = + NEXT_AS_FIRST_DIRECTIVE_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}