librsvg: 2.58.3 → 2.59.2

https://gitlab.gnome.org/GNOME/librsvg/-/compare/2.58.3...2.59.2

- Ported to Meson.
- Switched from gdk-pixbuf to Rust image loaders for external images.
- Added Avif support.

We also enable tests.
This commit is contained in:
Jan Tojnar
2025-02-07 22:10:09 +01:00
parent 1a1dbb7191
commit c202e21f64
2 changed files with 50 additions and 65 deletions
+49 -63
View File
@@ -3,25 +3,29 @@
stdenv,
fetchurl,
pkg-config,
meson,
ninja,
glib,
gdk-pixbuf,
installShellFiles,
pango,
freetype,
harfbuzz,
cairo,
libxml2,
bzip2,
libintl,
ApplicationServices,
dav1d,
Foundation,
libobjc,
rustPlatform,
rustc,
cargo-c,
cargo-auditable-cargo-wrapper,
gi-docgen,
python3Packages,
gnome,
vala,
writeScript,
writeShellScript,
shared-mime-info,
withIntrospection ?
lib.meta.availableOn stdenv.hostPlatform gobject-introspection
&& stdenv.hostPlatform.emulatorAvailable buildPackages,
@@ -45,7 +49,7 @@
stdenv.mkDerivation (finalAttrs: {
pname = "librsvg";
version = "2.58.3";
version = "2.59.2";
outputs =
[
@@ -58,13 +62,13 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchurl {
url = "mirror://gnome/sources/librsvg/${lib.versions.majorMinor finalAttrs.version}/librsvg-${finalAttrs.version}.tar.xz";
hash = "sha256-SfKaCpL0wtGaLLQelqsvzn61veQYUMipFPz2VeMRCUQ=";
hash = "sha256-7NKT+wzDOMFwFxu8e8++pnJdBByV8xOF3JNUCZM+RZc=";
};
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) src;
name = "librsvg-deps-${finalAttrs.version}";
hash = "sha256-cO79X3M0B6WN4w0JeBh00EyaIdHcthOkeKhaYdTn2BQ=";
hash = "sha256-M8iNNWpYgLIm0X3sTjAaRIFYLIHnMyrkcsayFrLg25Y=";
dontConfigure = true;
};
@@ -79,7 +83,10 @@ stdenv.mkDerivation (finalAttrs: {
gdk-pixbuf
installShellFiles
pkg-config
meson
ninja
rustc
cargo-c
cargo-auditable-cargo-wrapper
python3Packages.docutils
vala
@@ -94,14 +101,13 @@ stdenv.mkDerivation (finalAttrs: {
[
libxml2
bzip2
dav1d
pango
libintl
vala # for share/vala/Makefile.vapigen
freetype
vala
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
ApplicationServices
Foundation
libobjc
];
propagatedBuildInputs = [
@@ -110,65 +116,44 @@ stdenv.mkDerivation (finalAttrs: {
cairo
];
configureFlags =
[
(lib.enableFeature withIntrospection "introspection")
(lib.enableFeature withIntrospection "vala")
mesonFlags = [
(lib.mesonEnable "introspection" withIntrospection)
(lib.mesonEnable "vala" withIntrospection)
(lib.mesonBool "tests" finalAttrs.finalPackage.doCheck)
];
"--enable-always-build-tests"
]
++ lib.optional stdenv.hostPlatform.isDarwin "--disable-Bsymbolic"
++ lib.optional (
stdenv.buildPlatform != stdenv.hostPlatform
) "RUST_TARGET=${stdenv.hostPlatform.rust.rustcTarget}";
# Probably broken MIME type detection.
doCheck = !stdenv.isDarwin;
doCheck = false; # all tests fail on libtool-generated rsvg-convert not being able to find coreutils
env = {
PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_QUERY_LOADERS = writeShellScript "gdk-pixbuf-loader-loaders-wrapped" ''
${lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (stdenv.hostPlatform.emulator buildPackages)} ${lib.getDev gdk-pixbuf}/bin/gdk-pixbuf-query-loaders
'';
};
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
postPatch = ''
patchShebangs \
meson/cargo_wrapper.py \
meson/makedef.py \
# Fix thumbnailer path
substituteInPlace gdk-pixbuf-loader/librsvg.thumbnailer.in \
--replace-fail '@bindir@/gdk-pixbuf-thumbnailer' '${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer'
# Fix pkg-config file Requires section.
# https://gitlab.gnome.org/GNOME/librsvg/-/issues/1150
substituteInPlace rsvg/meson.build \
--replace-fail 'requires: library_dependencies_sole,' 'requires: [cairo_dep, gio_dep, glib_dep, pixbuf_dep],'
'';
# librsvg only links Foundation, but it also requiers libobjc.
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { NIX_LDFLAGS = "-lobjc"; };
preCheck = ''
# Tests complain: Fontconfig error: No writable cache directories
export HOME=$TMPDIR
preConfigure = ''
PKG_CONFIG_VAPIGEN_VAPIGEN="$(type -p vapigen)"
export PKG_CONFIG_VAPIGEN_VAPIGEN
# https://gitlab.gnome.org/GNOME/librsvg/-/issues/258#note_251789
export XDG_DATA_DIRS=${shared-mime-info}/share:$XDG_DATA_DIRS
'';
# It wants to add loaders and update the loaders.cache in gdk-pixbuf
# Patching the Makefiles to it creates rsvg specific loaders and the
# relevant loader.cache here.
# The loaders.cache can be used by setting GDK_PIXBUF_MODULE_FILE to
# point to this file in a wrapper.
postConfigure =
''
GDK_PIXBUF=$out/lib/gdk-pixbuf-2.0/2.10.0
mkdir -p $GDK_PIXBUF/loaders
sed -i gdk-pixbuf-loader/Makefile \
-e "s#gdk_pixbuf_moduledir = .*#gdk_pixbuf_moduledir = $GDK_PIXBUF/loaders#" \
-e "s#gdk_pixbuf_cache_file = .*#gdk_pixbuf_cache_file = $GDK_PIXBUF/loaders.cache#" \
-e "s#\$(GDK_PIXBUF_QUERYLOADERS)#GDK_PIXBUF_MODULEDIR=$GDK_PIXBUF/loaders \$(GDK_PIXBUF_QUERYLOADERS)#"
# Fix thumbnailer path
sed -e "s#@bindir@\(/gdk-pixbuf-thumbnailer\)#${gdk-pixbuf}/bin\1#g" \
-i gdk-pixbuf-loader/librsvg.thumbnailer.in
# '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 =
let
@@ -176,7 +161,8 @@ stdenv.mkDerivation (finalAttrs: {
in
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
GDK_PIXBUF=$out/${gdk-pixbuf.binaryDir}
cat ${lib.getLib gdk-pixbuf}/${gdk-pixbuf.binaryDir}/loaders.cache $GDK_PIXBUF/loaders.cache > $GDK_PIXBUF/loaders.cache.tmp
mv $GDK_PIXBUF/loaders.cache.tmp $GDK_PIXBUF/loaders.cache
installShellCompletion --cmd rsvg-convert \
+1 -2
View File
@@ -9724,8 +9724,7 @@ with pkgs;
};
librsvg = callPackage ../development/libraries/librsvg {
inherit (darwin) libobjc;
inherit (darwin.apple_sdk.frameworks) ApplicationServices Foundation;
inherit (darwin.apple_sdk.frameworks) Foundation;
};
libsigcxx = callPackage ../development/libraries/libsigcxx { };