about summary refs log tree commit diff
path: root/pkgs/development/libraries/librsvg
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-02-18 07:33:24 +0200
committerArtturin <Artturin@artturin.com>2023-02-18 07:35:56 +0200
commitd5b6b6232c368279a48e8b6907a637b652d378ba (patch)
tree2eb8a1664c26689d906a7561ad91d35c75d379d3 /pkgs/development/libraries/librsvg
parent7637168dd21b4ab0c64499ea20065b532ba11858 (diff)
librsvg: create loaders.cache even when cross-compiling
Diffstat (limited to 'pkgs/development/libraries/librsvg')
-rw-r--r--pkgs/development/libraries/librsvg/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix
index 36bd6ef90a93b..57ed620fbf8d6 100644
--- a/pkgs/development/libraries/librsvg/default.nix
+++ b/pkgs/development/libraries/librsvg/default.nix
@@ -20,6 +20,7 @@
 , python3Packages
 , gnome
 , vala
+, writeScript
 , withIntrospection ? stdenv.hostPlatform.emulatorAvailable buildPackages
 , buildPackages
 , gobject-introspection
@@ -95,6 +96,10 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # all tests fail on libtool-generated rsvg-convert not being able to find coreutils
 
+  GDK_PIXBUF_QUERYLOADERS = writeScript "gdk-pixbuf-loader-loaders-wrapped" ''
+    ${lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (stdenv.hostPlatform.emulator buildPackages)} ${lib.getDev gdk-pixbuf}/bin/gdk-pixbuf-query-loaders
+  '';
+
   preConfigure = ''
     PKG_CONFIG_VAPIGEN_VAPIGEN="$(type -p vapigen)"
     export PKG_CONFIG_VAPIGEN_VAPIGEN
@@ -121,10 +126,14 @@ stdenv.mkDerivation rec {
 
     # 'error: linker `cc` not found' when cross-compiling
     export RUSTFLAGS="-Clinker=$CC"
+  '' + lib.optionalString ((stdenv.buildPlatform != stdenv.hostPlatform) && (stdenv.hostPlatform.emulatorAvailable buildPackages)) ''
+    # the replacement is the native conditional
+    substituteInPlace gdk-pixbuf-loader/Makefile \
+      --replace 'RUN_QUERY_LOADER_TEST = false' 'RUN_QUERY_LOADER_TEST = test -z "$(DESTDIR)"' \
   '';
 
   # Not generated when cross compiling.
-  postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
+  postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
     # Merge gdkpixbuf and librsvg loaders
     cat ${lib.getLib gdk-pixbuf}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache $GDK_PIXBUF/loaders.cache > $GDK_PIXBUF/loaders.cache.tmp
     mv $GDK_PIXBUF/loaders.cache.tmp $GDK_PIXBUF/loaders.cache