Subject: [bug#67108] [PATCH v2] gnu: librsvg-2.40: Fix cross-compiling.

From: Zheng Junjie <[email-masked]>
Date: Sun, 12 Nov 2023 16:19:36 +0800

* gnu/packages/gnome.scm (librsvg-2.40): Fix cross-compiling.
[arguments]<#:configure-flags>: When cross-compiling, disable
gobject-introspection.
[native-inputs]: When cross-compiling, add gdk-pixbuf.
(librsvg-for-system): Use the C version when cross-compiling.

Change-Id: Icb95763422269eed2e067a1d06166c3ed4bdeedc
---
 gnu/packages/gnome.scm | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index ac3035e07d..b832ff1099 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -77,6 +77,7 @@
 ;;; Copyright © 2023 Juliana Sims <[email-masked]>
 ;;; Copyright © 2023 Dominik Delgado Steuter <[email-masked]>
 ;;; Copyright © 2023 Zhu Zihao <[email-masked]>
+;;; Copyright © 2023 Zheng Junjie <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3663,7 +3664,10 @@ (define-public librsvg-2.40
                 "1fljkag2gr7c4k5mn798lgf9903xslz8h51bgvl89nnay42qjqpp"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags (list "--disable-static")
+     `(#:configure-flags (list "--disable-static"
+                               ,@(if (%current-target-system)
+                                     '("--disable-introspection")
+                                     '()))
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'pre-configure
@@ -3702,9 +3706,12 @@ (define-public librsvg-2.40
                            "bugs/340047.svg"
                            "bugs/749415.svg"))))))))
     (native-inputs
-     (list pkg-config
-           `(,glib "bin") ; glib-mkenums, etc.
-           gobject-introspection)) ; g-ir-compiler, etc.
+     `(,pkg-config
+       ,@(if (%current-target-system)
+             (list gdk-pixbuf)
+             '())
+       (,glib "bin") ; glib-mkenums, etc.
+       ,gobject-introspection)) ; g-ir-compiler, etc.
     (inputs
      (list pango libcroco libxml2))
     (propagated-inputs
@@ -3719,9 +3726,12 @@ (define* (librsvg-for-system #:optional
   ;; Since librsvg 2.50 depends on Rust, and Rust is only correctly supported
   ;; on x86_64, aarch64 and riscv64 so far, use the ancient C version on other
   ;; platforms (FIXME).
-  (if (supported-package? librsvg)
-      librsvg
-      librsvg-2.40))
+  ;; and for now cargo-build-system is no support cross-compiling, so when
+  ;; cross-compiling we just use C version.
+  (if (or (%current-target-system)
+          (not (supported-package? librsvg system)))
+      librsvg-2.40
+      librsvg))
 
 (export librsvg-for-system)

base-commit: af6105afc67a15a491a0a4fd18a28c9f801a0b94
-- 
2.41.0