~ruther/guix-local

5bb84e0b9793b5ce0ff682ae60b692e9d893e6ab — Dariqq 7 months ago bef09e9
gnu: python-scipy: Fix build on i686-linux.

* gnu/packages/patches/python-scipy-i686.patch: Add patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/python-science.scm (python-scipy): Add phase to apply the patch.

Fixes guix/guix#2989
Change-Id: I6c5d807bd2ed23fca6e94b28cb6927c154bde0e8
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
3 files changed, 59 insertions(+), 0 deletions(-)

M gnu/local.mk
A gnu/packages/patches/python-scipy-i686.patch
M gnu/packages/python-science.scm
M gnu/local.mk => gnu/local.mk +1 -0
@@ 2185,6 2185,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/python-pytorch-system-libraries.patch	\
  %D%/packages/patches/python-pytorch-without-kineto.patch	\
  %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
  %D%/packages/patches/python-scipy-i686.patch 			\
  %D%/packages/patches/python-vaex-core-fix-tsl-use.patch	\
  %D%/packages/patches/python-vega-datasets-remove-la-riots-code.patch	\
  %D%/packages/patches/python-versioneer-guix-support.patch	\

A gnu/packages/patches/python-scipy-i686.patch => gnu/packages/patches/python-scipy-i686.patch +49 -0
@@ 0,0 1,49 @@
From https://github.com/scipy/scipy/pull/20135

From 53796772ed735c1564863fc7ca8d902acb628167 Mon Sep 17 00:00:00 2001
From: Ralf Gommers <ralf.gommers@gmail.com>
Date: Thu, 22 Feb 2024 09:10:46 +0100
Subject: [PATCH] MAINT: interpolate: define `F_INT` as `int` rather than
 `npy_int32`

This fixes an incompatible pointer issue that shows up as a warning in
Windows CI jobs, and is reported to break the build with GCC 14 on
Fedora 40 in gh-19993.

Using `#define F_INT int` is done in several other submodules; this
was the only instance of using `npy_int32`.

Closes gh-19993
---
 scipy/interpolate/src/_fitpackmodule.c | 4 ++--
 scipy/interpolate/src/fitpack.pyf      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scipy/interpolate/src/_fitpackmodule.c b/scipy/interpolate/src/_fitpackmodule.c
index 0e913d1c7e43..dc79b2b28833 100644
--- a/scipy/interpolate/src/_fitpackmodule.c
+++ b/scipy/interpolate/src/_fitpackmodule.c
@@ -28,8 +28,8 @@ static PyObject *fitpack_error;
 
 #else
 
-#define F_INT npy_int32
-#define F_INT_NPY NPY_INT32
+#define F_INT int
+#define F_INT_NPY NPY_INT
 #define F_INT_MAX NPY_MAX_INT32
 #if NPY_BITSOF_SHORT == 32
 #define F_INT_PYFMT   "h"
diff --git a/scipy/interpolate/src/fitpack.pyf b/scipy/interpolate/src/fitpack.pyf
index 08cb0c141c98..a9535a83f479 100644
--- a/scipy/interpolate/src/fitpack.pyf
+++ b/scipy/interpolate/src/fitpack.pyf
@@ -16,7 +16,7 @@ python module dfitpack ! in
 #ifdef HAVE_ILP64
 typedef npy_int64 F_INT;
 #else
-typedef npy_int32 F_INT;
+typedef int F_INT;
 #endif
 
 static double dmax(double* seq, F_INT len) {

M gnu/packages/python-science.scm => gnu/packages/python-science.scm +9 -0
@@ 3108,6 3108,15 @@ cross-validation.")
     (list
      #:phases
      #~(modify-phases %standard-phases
          #$@(if (target-x86-32?)
                 #~((add-after 'unpack 'apply-i686-patch
                      (lambda _
                        (let ((patch-file
                               #$(local-file
                                  (search-patch "python-scipy-i686.patch"))))
                          (invoke "patch" "--force" "-p1" "-i"
                                  patch-file)))))
                 #~())
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?