about summary refs log tree commit diff
path: root/pkgs/development/python-modules/scipy
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2024-04-15 12:37:26 +0300
committerDoron Behar <doron.behar@gmail.com>2024-04-15 12:37:26 +0300
commit44d081fc6f51522638d1804752cbac3b60026378 (patch)
tree75aee3401718a73ec20777c944c6ff753639605f /pkgs/development/python-modules/scipy
parent79ff3830dbed3d2b414d8d54d654013bbbc2a424 (diff)
python311Packages.scipy: fix darwin build
Diffstat (limited to 'pkgs/development/python-modules/scipy')
-rw-r--r--pkgs/development/python-modules/scipy/default.nix5
-rw-r--r--pkgs/development/python-modules/scipy/pocketfft-aligned_alloc.patch30
2 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/scipy/default.nix b/pkgs/development/python-modules/scipy/default.nix
index b4be27dcd531b..bed0449d587bd 100644
--- a/pkgs/development/python-modules/scipy/default.nix
+++ b/pkgs/development/python-modules/scipy/default.nix
@@ -76,6 +76,11 @@ in buildPythonPackage {
         "doc/source/dev/contributor/meson_advanced.rst"
       ];
     })
+    # Fix for https://github.com/scipy/scipy/issues/20300 until 1.13.1, based
+    # on: https://github.com/scipy/scipy/issues/20300 linked from there,
+    # couldn't use fetchpatch because it is a submodule of scipy, and
+    # extraPrefix doesn't fit this purpose.
+    ./pocketfft-aligned_alloc.patch
   ];
 
   # Upstream says in a comment in their pyproject.toml that building against
diff --git a/pkgs/development/python-modules/scipy/pocketfft-aligned_alloc.patch b/pkgs/development/python-modules/scipy/pocketfft-aligned_alloc.patch
new file mode 100644
index 0000000000000..80b047c7061c5
--- /dev/null
+++ b/pkgs/development/python-modules/scipy/pocketfft-aligned_alloc.patch
@@ -0,0 +1,30 @@
+From fbe3c10d117de98d80a86a10f76d4cd74efc55a8 Mon Sep 17 00:00:00 2001
+From: Martin Reinecke <martin@mpa-garching.mpg.de>
+Date: Fri, 22 Mar 2024 10:53:05 +0100
+Subject: [PATCH] unconditionaly disable use of aligned_alloc
+
+---
+ pocketfft_hdronly.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/scipy/_lib/pocketfft/pocketfft_hdronly.h b/scipy/_lib/pocketfft/pocketfft_hdronly.h
+index 6c98f2d..66eea06 100644
+--- a/scipy/_lib/pocketfft/pocketfft_hdronly.h
++++ b/scipy/_lib/pocketfft/pocketfft_hdronly.h
+@@ -152,11 +152,11 @@ template<> struct VLEN<double> { static constexpr size_t val=2; };
+ #endif
+ #endif
+ 
+-// the __MINGW32__ part in the conditional below works around the problem that
+-// the standard C++ library on Windows does not provide aligned_alloc() even
+-// though the MinGW compiler and MSVC may advertise C++17 compliance.
+-// aligned_alloc is only supported from MacOS 10.15.
+-#if (__cplusplus >= 201703L) && (!defined(__MINGW32__)) && (!defined(_MSC_VER)) && (__MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15)
++// std::aligned_alloc is a bit cursed ... it doesn't exist on MacOS < 10.15
++// and in musl, and other OSes seem to have even more peculiarities.
++// Let's unconditionally work around it for now.
++# if 0
++//#if (__cplusplus >= 201703L) && (!defined(__MINGW32__)) && (!defined(_MSC_VER)) && (__MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15)
+ inline void *aligned_alloc(size_t align, size_t size)
+   {
+   // aligned_alloc() requires that the requested size is a multiple of "align"