package/python-scipy: fix sh4 build
Fix the following sh4 build failure raised since the addition of the
package in commit e10431db29e08c3ae56c145165bf110bd17f2a6c:
INFO: sh4aeb-linux-gcc: scipy/special/_test_round.c
scipy/special/_test_round.c: In function '__pyx_pf_5scipy_7special_11_test_round_have_fenv':
scipy/special/_test_round.c:2353:30: error: 'FE_UPWARD' undeclared (first use in this function)
2353 | __pyx_t_1 = ((fesetround(FE_UPWARD) != 0) != 0);
| ^~~~~~~~~
Retrieve debian patch as upstream doesn't want to fix this SH4 specific
issue: https://github.com/scipy/scipy/issues/15584
Fixes:
- http://autobuild.buildroot.org/results/b82d8ed02ba5d094a0d4054e0de28e95c9d3554d
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
diff --git a/package/python-scipy/0001-build-sh4-FE.patch b/package/python-scipy/0001-build-sh4-FE.patch
new file mode 100644
index 0000000..d50dd84
--- /dev/null
+++ b/package/python-scipy/0001-build-sh4-FE.patch
@@ -0,0 +1,36 @@
+From aae8b63ddffe014e9353c3e8d2604628433eb7d7 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sun, 4 Dec 2022 14:14:21 +0100
+Subject: [PATCH] build sh4 FE
+
+ensures FE_UPWARD and FE_DOWNWARD are defined for sh4 architecture.
+
+Closes: #1007769.
+
+[Retrieved from:
+https://salsa.debian.org/python-team/packages/scipy/-/blob/master/debian/patches/build_sh4_FE.patch]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ scipy/special/_round.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/scipy/special/_round.h b/scipy/special/_round.h
+index 013a25620..c321a1939 100644
+--- a/scipy/special/_round.h
++++ b/scipy/special/_round.h
+@@ -69,5 +69,12 @@ int fegetround()
+
+ #endif
+
++/* SH4 is not C99 compliant, see https://github.com/scipy/scipy/issues/15584 */
++#ifndef FE_UPWARD
++#define FE_UPWARD -1
++#endif
++#ifndef FE_DOWNWARD
++#define FE_DOWNWARD -1
++#endif
+
+ #endif /* _round.h */
+--
+2.38.1
+