summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-11-20 11:42:29 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-11-28 07:59:42 +0200
commita90043cfe8db47b916913f9fa2a8e768587ac9a2 (patch)
tree41fd177d72808aa479fb6c81744e77a578f3c024 /gnu/packages
parentfc5677a018d0c075dce8e566bf50cc0f084ff5e9 (diff)
downloadguix-a90043cfe8db47b916913f9fa2a8e768587ac9a2.tar.gz
gnu: librsvg: Enable cross compiling.
* gnu/packages/gnome.scm (librsvg)[arguments]: Use this-package-input to
find gdk-pixbuf in 'patch-gdk-pixbuf-thumbnailer phase.  Adjust
'prepare-for-build phase to set PKG_CONFIG and RUST_TARGET when needed.
Adjust configure-flags when cross-compiling.
[native-inputs]: Add gdk-pixbuf.
[inputs]: Add gobject-introspection.

Change-Id: I977c48957a6f50a777b52ea59c0d1f8bd6edcc1b
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/gnome.scm27
1 files changed, 23 insertions, 4 deletions
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 1a746b066a..bd37b43901 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -3583,11 +3583,19 @@ for dealing with different structured file formats.")
               ;; https://gitlab.gnome.org/GNOME/librsvg/-/issues/955).
               (substitute* "gdk-pixbuf-loader/librsvg.thumbnailer.in"
                 (("@bindir@/gdk-pixbuf-thumbnailer")
-                 (search-input-file inputs "bin/gdk-pixbuf-thumbnailer")))))
+                 (string-append #$(this-package-input "gdk-pixbuf")
+                                "/bin/gdk-pixbuf-thumbnailer")))))
           (add-after 'unpack 'prepare-for-build
             (lambda _
               ;; In lieu of #:make-flags
               (setenv "CC" #$(cc-for-target))
+              (setenv "PKG_CONFIG" #$(pkg-config-for-target))
+              (when #$(%current-target-system)
+                (setenv "RUST_TARGET"
+                        (string-replace
+                          #$(%current-target-system)
+                          "-unknown-linux-gnu"
+                          (string-index #$(%current-target-system) #\-))))
               ;; Something about the build environment resists building
               ;; successfully with the '--locked' flag.
               (substitute* '("Makefile.am" "Makefile.in")
@@ -3620,7 +3628,18 @@ for dealing with different structured file formats.")
               (apply (assoc-ref gnu:%standard-phases 'configure)
                      #:configure-flags
                      (list "--disable-static"
-                           "--enable-vala")
+                           #$@(if (%current-target-system)
+                                #~(;; g-ir-scanner can't import its modules
+                                   ;; and vala currently can't be cross-compiled.
+                                   "--enable-introspection=no"
+                                   "--enable-vala=no"
+                                   ;; These two are necessary for cross-compiling.
+                                   (string-append
+                                     "--build=" #$(nix-system->gnu-triplet
+                                                    (%current-system)))
+                                   (string-append
+                                     "--host=" #$(%current-target-system)))
+                                #~("--enable-vala")))
                      args)))
           (add-after 'configure 'dont-vendor-self
             (lambda* (#:key vendor-dir #:allow-other-keys)
@@ -3636,8 +3655,8 @@ for dealing with different structured file formats.")
                  #:test-target "check"))))
           (replace 'install
             (assoc-ref gnu:%standard-phases 'install)))))
-    (native-inputs (list `(,glib "bin") gobject-introspection pkg-config vala))
-    (inputs (list freetype harfbuzz libxml2 pango))
+    (native-inputs (list gdk-pixbuf `(,glib "bin") gobject-introspection pkg-config vala))
+    (inputs (list freetype gobject-introspection harfbuzz libxml2 pango))
     (propagated-inputs (list cairo gdk-pixbuf glib))
     (synopsis "SVG rendering library")
     (description "Librsvg is a library to render SVG images to Cairo surfaces.