2022-10-21 06:32:31 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, makeWrapper
|
|
|
|
, gdk-pixbuf
|
|
|
|
, libwebp
|
2021-12-27 04:15:26 +00:00
|
|
|
}:
|
2022-10-21 06:32:31 +00:00
|
|
|
|
2021-12-27 04:15:26 +00:00
|
|
|
let
|
2022-10-21 06:32:31 +00:00
|
|
|
inherit (gdk-pixbuf) moduleDir;
|
2020-10-30 21:40:53 +00:00
|
|
|
loadersPath = "${gdk-pixbuf.binaryDir}/webp-loaders.cache";
|
2021-12-27 04:15:26 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "webp-pixbuf-loader";
|
2023-03-19 00:22:34 +00:00
|
|
|
version = "0.2.2";
|
2021-12-27 04:15:26 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aruiz";
|
2022-10-21 06:32:31 +00:00
|
|
|
repo = "webp-pixbuf-loader";
|
2021-12-27 04:15:26 +00:00
|
|
|
rev = version;
|
2023-03-19 00:22:34 +00:00
|
|
|
sha256 = "sha256-TdZK2OTwetLVmmhN7RZlq2NV6EukH1Wk5Iwer2W/aHc=";
|
2021-12-27 04:15:26 +00:00
|
|
|
};
|
|
|
|
|
2022-10-21 06:32:31 +00:00
|
|
|
nativeBuildInputs = [
|
2022-11-08 01:17:26 +00:00
|
|
|
gdk-pixbuf.dev
|
2022-10-21 06:32:31 +00:00
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
makeWrapper
|
|
|
|
];
|
2021-12-27 04:15:26 +00:00
|
|
|
|
2022-10-21 06:32:31 +00:00
|
|
|
buildInputs = [
|
|
|
|
gdk-pixbuf
|
|
|
|
libwebp
|
|
|
|
];
|
2021-12-27 04:15:26 +00:00
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Dgdk_pixbuf_moduledir=${placeholder "out"}/${moduleDir}"
|
|
|
|
];
|
|
|
|
|
2022-10-21 06:32:31 +00:00
|
|
|
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 \
|
2020-10-30 21:40:53 +00:00
|
|
|
--replace "@bindir@/gdk-pixbuf-thumbnailer" "$out/libexec/gdk-pixbuf-thumbnailer-webp"
|
2021-12-27 04:15:26 +00:00
|
|
|
'';
|
|
|
|
|
2022-10-21 06:32:31 +00:00
|
|
|
postInstall = ''
|
2022-11-08 01:17:26 +00:00
|
|
|
GDK_PIXBUF_MODULE_FILE="$out/${loadersPath}" \
|
|
|
|
GDK_PIXBUF_MODULEDIR="$out/${moduleDir}" \
|
|
|
|
gdk-pixbuf-query-loaders --update-cache
|
|
|
|
|
2022-10-21 06:32:31 +00:00
|
|
|
# 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"
|
2020-10-30 21:40:53 +00:00
|
|
|
makeWrapper "${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer" "$out/libexec/gdk-pixbuf-thumbnailer-webp" \
|
2022-10-21 06:32:31 +00:00
|
|
|
--set GDK_PIXBUF_MODULE_FILE "$out/${loadersPath}"
|
2021-12-27 04:15:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "WebP GDK Pixbuf Loader library";
|
|
|
|
homepage = "https://github.com/aruiz/webp-pixbuf-loader";
|
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
platforms = platforms.unix;
|
2022-10-21 06:32:31 +00:00
|
|
|
maintainers = teams.gnome.members ++ [ maintainers.cwyc ];
|
2021-12-27 04:15:26 +00:00
|
|
|
};
|
|
|
|
}
|