Subject: [bug#62432] [PATCH] gnu: libicns: fix riscv64 cross-build.

From: Z572 <[email-masked]>
Date: Sat, 25 Mar 2023 12:50:59 +0800

* gnu/packages/image.scm (libicns): fix riscv64 cross-build.
[arguments]: when target-riscv64, add phase to update-config-scripts
[native-inputs]: when target-riscv64, add config.
---
 gnu/packages/image.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 0da990e63a..81cdcd778e 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -549,6 +549,22 @@ (define-public libicns
                (base32
                 "1hjm8lwap7bjyyxsyi94fh5817xzqhk4kb5y0b7mb6675xw10prk"))))
     (build-system gnu-build-system)
+    (arguments (if (target-riscv64?)
+                   (list #:phases
+                         #~(modify-phases %standard-phases
+                             (add-after 'unpack 'update-config-scripts
+                               (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                                 (for-each (lambda (file)
+                                             (install-file
+                                              (search-input-file
+                                               (or native-inputs inputs)
+                                               (string-append "/bin/" file)) "."))
+                                           '("config.guess" "config.sub"))))) )
+                   '()))
+    (native-inputs
+     (if (target-riscv64?)
+         (list config)
+         '()))
     (inputs
      (list libpng jasper))
     (home-page "https://icns.sourceforge.io/")
-- 
2.39.2