a38770bd69
https://github.com/AOMediaCodec/libavif/pull/182 https://github.com/AOMediaCodec/libavif/pull/977 Mostly mirrors webp-pixbuf-loader. Also use prefixed names for `loaders.cache` so that users can install multiple loaders in a profile without collisions, and move `bin/webp-thumbnailer` to `libexec/gdk-pixbuf-thumbnailer-webp` (and similarly for avif).
69 lines
1.8 KiB
Nix
69 lines
1.8 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, meson
|
|
, ninja
|
|
, pkg-config
|
|
, makeWrapper
|
|
, gdk-pixbuf
|
|
, libwebp
|
|
}:
|
|
|
|
let
|
|
inherit (gdk-pixbuf) moduleDir;
|
|
loadersPath = "${gdk-pixbuf.binaryDir}/webp-loaders.cache";
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "webp-pixbuf-loader";
|
|
version = "0.2.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "aruiz";
|
|
repo = "webp-pixbuf-loader";
|
|
rev = version;
|
|
sha256 = "sha256-TdZK2OTwetLVmmhN7RZlq2NV6EukH1Wk5Iwer2W/aHc=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
gdk-pixbuf.dev
|
|
meson
|
|
ninja
|
|
pkg-config
|
|
makeWrapper
|
|
];
|
|
|
|
buildInputs = [
|
|
gdk-pixbuf
|
|
libwebp
|
|
];
|
|
|
|
mesonFlags = [
|
|
"-Dgdk_pixbuf_moduledir=${placeholder "out"}/${moduleDir}"
|
|
];
|
|
|
|
postPatch = ''
|
|
# It looks for gdk-pixbuf-thumbnailer in this package's bin rather than the gdk-pixbuf bin. We need to patch that.
|
|
substituteInPlace webp-pixbuf.thumbnailer.in \
|
|
--replace "@bindir@/gdk-pixbuf-thumbnailer" "$out/libexec/gdk-pixbuf-thumbnailer-webp"
|
|
'';
|
|
|
|
postInstall = ''
|
|
GDK_PIXBUF_MODULE_FILE="$out/${loadersPath}" \
|
|
GDK_PIXBUF_MODULEDIR="$out/${moduleDir}" \
|
|
gdk-pixbuf-query-loaders --update-cache
|
|
|
|
# It assumes gdk-pixbuf-thumbnailer can find the webp loader in the loaders.cache referenced by environment variable, breaking containment.
|
|
# So we replace it with a wrapped executable.
|
|
mkdir -p "$out/bin"
|
|
makeWrapper "${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer" "$out/libexec/gdk-pixbuf-thumbnailer-webp" \
|
|
--set GDK_PIXBUF_MODULE_FILE "$out/${loadersPath}"
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "WebP GDK Pixbuf Loader library";
|
|
homepage = "https://github.com/aruiz/webp-pixbuf-loader";
|
|
license = licenses.lgpl2Plus;
|
|
platforms = platforms.unix;
|
|
maintainers = teams.gnome.members ++ [ maintainers.cwyc ];
|
|
};
|
|
}
|