Subject: [PATCH 3/8] gnu: libxtst: fix riscv64 cross-compile.

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

* gnu/packages/xorg.scm(libxtst): fix riscv64 cross-compile
[arguments]: when target is riscv64, add phase to update config.{guess,sub}
[native-inputs]: when target is riscv64, add config.
---
 gnu/packages/xorg.scm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 2b6f9fa369..2cc1523e3e 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -4658,13 +4658,28 @@ (define-public libxtst
             "012jpyj7xfm653a9jcfqbzxyywdmwb2b5wr1dwylx14f3f54jma6"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:configure-flags '("--disable-static")))
+     `(#:configure-flags '("--disable-static")
+       ,@(if (and (%current-target-system)
+                  (target-riscv64?))
+             `(#:phases
+               (modify-phases %standard-phases
+                 (add-after 'unpack 'update-config
+                   (lambda* (#:key native-inputs #:allow-other-keys)
+                     (install-file
+                      (search-input-file native-inputs "/bin/config.sub") ".")
+                     (install-file
+                      (search-input-file native-inputs "/bin/config.guess") ".")))))
+             '())))
     (propagated-inputs
      (list libxi xorgproto))
     (inputs
       (list libx11))
     (native-inputs
-      (list pkg-config))
+     `(,@(if (and (%current-target-system)
+                  (target-riscv64?))
+             (list config)
+             '())
+       ,pkg-config))
     (home-page "https://www.x.org/wiki/")
     (synopsis "Xorg library for Xtest and Record extensions")
     (description
-- 
2.39.1