Subject: [bug#61865] [PATCH 7/8] gnu: libotf: fix cross-compile.

From: Z572 <[email-masked]>
Date: Tue, 28 Feb 2023 16:33:39 +0800

* gnu/packages/fontutils.scm(libotf): fix cross-compile.
[native-inputs]:
add freetype, when cross-compile, add libtool, autoconf automake.
[arguments]: when cross-compile, add phase to fix rpl_malloc undefined reference
---
 gnu/packages/fontutils.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm
index 72621cc006..d451f5e504 100644
--- a/gnu/packages/fontutils.scm
+++ b/gnu/packages/fontutils.scm
@@ -1392,7 +1392,22 @@ (define-public libotf
                (base32 "0sq6g3xaxw388akws6qrllp3kp2sxgk2dv4j79k6mm52rnihrnv8"))))
     (build-system gnu-build-system)
     (native-inputs
-     (list pkg-config))
+     (append (if (%current-target-system)
+                 (list libtool
+                       autoconf automake)
+                 '())
+             (list pkg-config freetype)))
+    (arguments (if (%current-target-system)
+                   (list
+                    #:phases
+                    #~(modify-phases %standard-phases
+                        (add-after 'unpack 'fix-rpl_malloc
+                          (lambda _
+                            (substitute* "configure.ac"
+                              (("AC_FUNC_MALLOC")
+                               ""))
+                            (invoke "sh" "autogen.sh")))))
+                   '()))
     (propagated-inputs
      (list freetype))
     (home-page "https://www.nongnu.org/m17n/")
-- 
2.39.1