Subject: [bug#61865] [PATCH 1/8] gnu: xcb-util-wm: fix riscv64 cross-compile.

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

* gnu/packages/xorg.scm (xcb-util-wm): fix riscv64 cross-compile.
[arguments]: add update-config-scripts phases when target is riscv64.
[native-inputs]: add CONFIG when target is riscv64.
---
 gnu/packages/xorg.scm | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index a43809e3cb..32be732eef 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -5792,11 +5792,27 @@ (define-public xcb-util-wm
                "0gra7hfyxajic4mjd63cpqvd20si53j1q3rbdlkqkahfciwq3gr8"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:configure-flags '("--disable-static")))
+     `(#:configure-flags '("--disable-static")
+       ,@(if (target-riscv64?)
+             `(#:phases
+               (modify-phases %standard-phases
+                 (add-after 'unpack 'update-config-scripts
+                   (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                     ;; Replace outdated config.guess and config.sub.
+                     (for-each (lambda (file)
+                                 (install-file
+                                  (search-input-file
+                                   (or native-inputs inputs)
+                                   (string-append "/bin/" file)) "."))
+                               '("config.guess" "config.sub"))))))
+             '())))
     (propagated-inputs
      (list libxcb))
     (native-inputs
-     (list m4 pkg-config))
+     (append (if (target-riscv64?)
+                 (list config)
+                 '())
+             (list m4 pkg-config)))
     (home-page "https://cgit.freedesktop.org/xcb/util-wm/")
     (synopsis "Client and window-manager helpers for ICCCM and EWMH")
     (description
-- 
2.39.1