diff mbox series

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

Message ID 3eb75ad72ebabc39a567c0f9883c526fd13e2e79.1699716624.git.zhengjunjie@iscas.ac.cn
State New
Headers show
Series [bug#67108] gnu: librsvg-2.40: Fix cross-compiling. | expand

Commit Message

Z572 Nov. 11, 2023, 3:30 p.m. UTC
* 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 | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)


base-commit: af6105afc67a15a491a0a4fd18a28c9f801a0b94

Comments

Liliana Marie Prikler Nov. 11, 2023, 4:10 p.m. UTC | #1
Am Samstag, dem 11.11.2023 um 23:30 +0800 schrieb Zheng Junjie:
> * gnu/packages/gnome.scm (librsvg-2.40): Fix cross-compiling.
> [arguments]<#:configure-flags>: when cross-compiling, disable
> gobject-introspection.
When.
> [native-inputs]: when cross-compiling, add gdk-pixbuf.
When.

> (librsvg-for-system): Use the C version when cross-compiling.
You don't need a newline here afaik.

> Change-Id: Icb95763422269eed2e067a1d06166c3ed4bdeedc
> ---
>  gnu/packages/gnome.scm | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index ac3035e07d..c5006993c8 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -77,6 +77,7 @@
>  ;;; Copyright © 2023 Juliana Sims <juli@incana.org>
>  ;;; Copyright © 2023 Dominik Delgado Steuter <d@delgado.nrw>
>  ;;; Copyright © 2023 Zhu Zihao <all_but_last@163.com>
> +;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
>  ;;;
>  ;;; 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)
> +                                     '("--enable-introspection=no")
> +                                     '()))
Can we do --disable-introspection?
>         #:phases
>         (modify-phases %standard-phases
>           (add-before 'configure 'pre-configure
> @@ -3674,7 +3678,7 @@ (define-public librsvg-2.40
>                 (("gdk_pixbuf_moduledir = .*$")
>                  (string-append "gdk_pixbuf_moduledir = "
>                                 "$(prefix)/lib/gdk-pixbuf-
> 2.0/2.10.0/"
> -                                "loaders\n"))
> +                               "loaders\n"))
>                 ;; Drop the 'loaders.cache' file, it's in gdk-
> pixbuf+svg.
>                 (("gdk_pixbuf_cache_file = .*$")
>                  "gdk_pixbuf_cache_file =
> $(TMPDIR)/loaders.cache\n"))
> @@ -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.
> +     (append (if (%current-target-system)
> +                 (list gdk-pixbuf)
> +                 '())
> +             (list pkg-config
> +                   `(,glib "bin") ; glib-mkenums, etc.
> +                   gobject-introspection))) ; g-ir-compiler, etc.
Instead of doing append, you can quasiquote the list and use ,@ to
splice in gdk-pixbuf.
>      (inputs
>       (list pango libcroco libxml2))
>      (propagated-inputs
> @@ -3714,14 +3721,16 @@ (define-public librsvg-2.40
>      (properties '((hidden? . #t)))))
>  
>  (define* (librsvg-for-system #:optional
> -                             (system (or (%current-target-system)
> -                                         (%current-system))))
> +                             (system (%current-system)))
Why this change?
>    ;; 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))
This hunk LGTM.

Cheers
Efraim Flashner Dec. 21, 2023, 9:28 a.m. UTC | #2
On Sat, Nov 11, 2023 at 11:30:24PM +0800, Zheng Junjie wrote:
> * 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.

With the rust-team branch merged there's now support for cross-compiling
librsvg so this patch shouldn't be needed anymore.
diff mbox series

Patch

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index ac3035e07d..c5006993c8 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -77,6 +77,7 @@ 
 ;;; Copyright © 2023 Juliana Sims <juli@incana.org>
 ;;; Copyright © 2023 Dominik Delgado Steuter <d@delgado.nrw>
 ;;; Copyright © 2023 Zhu Zihao <all_but_last@163.com>
+;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
 ;;;
 ;;; 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)
+                                     '("--enable-introspection=no")
+                                     '()))
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'pre-configure
@@ -3674,7 +3678,7 @@  (define-public librsvg-2.40
                (("gdk_pixbuf_moduledir = .*$")
                 (string-append "gdk_pixbuf_moduledir = "
                                "$(prefix)/lib/gdk-pixbuf-2.0/2.10.0/"
-                                "loaders\n"))
+                               "loaders\n"))
                ;; Drop the 'loaders.cache' file, it's in gdk-pixbuf+svg.
                (("gdk_pixbuf_cache_file = .*$")
                 "gdk_pixbuf_cache_file = $(TMPDIR)/loaders.cache\n"))
@@ -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.
+     (append (if (%current-target-system)
+                 (list gdk-pixbuf)
+                 '())
+             (list pkg-config
+                   `(,glib "bin") ; glib-mkenums, etc.
+                   gobject-introspection))) ; g-ir-compiler, etc.
     (inputs
      (list pango libcroco libxml2))
     (propagated-inputs
@@ -3714,14 +3721,16 @@  (define-public librsvg-2.40
     (properties '((hidden? . #t)))))
 
 (define* (librsvg-for-system #:optional
-                             (system (or (%current-target-system)
-                                         (%current-system))))
+                             (system (%current-system)))
   ;; 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)