From d5b6b6232c368279a48e8b6907a637b652d378ba Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 18 Feb 2023 07:33:24 +0200 Subject: [PATCH] librsvg: create loaders.cache even when cross-compiling --- pkgs/development/libraries/librsvg/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index 36bd6ef90a93..57ed620fbf8d 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