Subject: [PATCH 1/5] gnu: gsl: Force bootstrap when cross-compiling to riscv64-linux.

From: Arun Isaac <[email-masked]>
Date: Wed, 30 Mar 2022 14:53:09 +0530

* gnu/packages/maths.scm (gsl)[arguments]: Force autotools bootstrap when
cross-compiling to riscv64-linux.
[native-inputs]: Add autoconf, automake and libtool when cross-compiling to
riscv64-linux.
---
 gnu/packages/maths.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index ecb85642ec..f01bf51580 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -19,7 +19,7 @@
 ;;; Copyright © 2017 Nikita <[email-masked]>
 ;;; Copyright © 2017 Ben Woodcroft <[email-masked]>
 ;;; Copyright © 2017 Theodoros Foradis <[email-masked]>
-;;; Copyright © 2017, 2019 Arun Isaac <[email-masked]>
+;;; Copyright © 2017, 2019, 2022 Arun Isaac <[email-masked]>
 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2017 Dave Love <me@[email-masked]>
 ;;; Copyright © 2018, 2019, 2020, 2021 Jan (janneke) Nieuwenhuizen <[email-masked]>
@@ -533,6 +533,13 @@ (define-public gsl
          #:phases
          (modify-phases %standard-phases
            ,@(cond
+              ((target-riscv64?)
+               '((add-after 'unpack 'force-bootstrap
+                   (lambda _
+                     ;; gsl ships with an old configure script that does not
+                     ;; support riscv64. Regenerate it.
+                     (delete-file "configure")))))
+
               ((or (string-prefix? "aarch64" system)
                    (string-prefix? "powerpc" system))
                ;; Some sparse matrix tests are failing on AArch64 and PowerPC:
@@ -568,6 +575,12 @@ (define-public gsl
                         (string-append "exit (77);\n" all)))))))
 
               (else '()))))))
+    (native-inputs
+     (if (target-riscv64?)
+         `(("autoconf" ,autoconf)
+           ("automake" ,automake)
+           ("libtool" ,libtool))
+         '()))
     (home-page "https://www.gnu.org/software/gsl/")
     (synopsis "Numerical library for C and C++")
     (description
-- 
2.34.0