webp-pixbuf-loader: Adopt by GNOME
GNOME uses this for backgrounds so let’s add GNOME team to maintainers and adopt GNOME coding style aimed at cleaner git diffs: - Format with `nixpkgs-fmt` - Inherit `moduleDir` variable since it has the same name - Avoid re-using `pname` for `src` in case it is overwritten - Use conventional attribute ordering - Have one dependency per line in inputs - Move comments closer to what they describe - Wrap long substitute line - Quote bash values
This commit is contained in:
parent
db25c4da28
commit
f19bcee376
1 changed files with 39 additions and 21 deletions
|
@ -1,9 +1,16 @@
|
|||
{ lib, stdenv, fetchFromGitHub
|
||||
, meson, ninja, pkg-config, makeWrapper
|
||||
, gdk-pixbuf, libwebp
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, meson
|
||||
, ninja
|
||||
, pkg-config
|
||||
, makeWrapper
|
||||
, gdk-pixbuf
|
||||
, libwebp
|
||||
}:
|
||||
|
||||
let
|
||||
moduleDir = gdk-pixbuf.moduleDir;
|
||||
inherit (gdk-pixbuf) moduleDir;
|
||||
|
||||
# turning lib/gdk-pixbuf-#.#/#.#.#/loaders into lib/gdk-pixbuf-#.#/#.#.#/loaders.cache
|
||||
# removeSuffix is just in case moduleDir gets a trailing slash
|
||||
|
@ -15,36 +22,47 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = fetchFromGitHub {
|
||||
owner = "aruiz";
|
||||
repo = pname;
|
||||
repo = "webp-pixbuf-loader";
|
||||
rev = version;
|
||||
sha256 = "sha256-dcdydWYrXZJjo4FxJtvzGzrQLOs87/BmxshFZwsT2ws=";
|
||||
};
|
||||
|
||||
# It looks for gdk-pixbuf-thumbnailer in this package's bin rather than the gdk-pixbuf bin. We need to patch that.
|
||||
postPatch = ''
|
||||
substituteInPlace webp-pixbuf.thumbnailer.in --replace @bindir@/gdk-pixbuf-thumbnailer $out/bin/webp-thumbnailer
|
||||
'';
|
||||
nativeBuildInputs = [
|
||||
gdk-pixbuf
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ gdk-pixbuf meson ninja pkg-config makeWrapper ];
|
||||
buildInputs = [ gdk-pixbuf libwebp ];
|
||||
buildInputs = [
|
||||
gdk-pixbuf
|
||||
libwebp
|
||||
];
|
||||
|
||||
mesonFlags = [
|
||||
"-Dgdk_pixbuf_query_loaders_path=${gdk-pixbuf.dev}/bin/gdk-pixbuf-query-loaders"
|
||||
"-Dgdk_pixbuf_moduledir=${placeholder "out"}/${moduleDir}"
|
||||
];
|
||||
|
||||
# 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.
|
||||
postInstall = ''
|
||||
mkdir -p $out/bin
|
||||
makeWrapper ${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer $out/bin/webp-thumbnailer \
|
||||
--set GDK_PIXBUF_MODULE_FILE $out/${loadersPath}
|
||||
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/bin/webp-thumbnailer"
|
||||
'';
|
||||
|
||||
# environment variables controlling loaders.cache generation by gdk-pixbuf-query-loaders
|
||||
preInstall = ''
|
||||
export GDK_PIXBUF_MODULE_FILE=$out/${loadersPath}
|
||||
export GDK_PIXBUF_MODULEDIR=$out/${moduleDir}
|
||||
# environment variables controlling loaders.cache generation by gdk-pixbuf-query-loaders
|
||||
export GDK_PIXBUF_MODULE_FILE="$out/${loadersPath}"
|
||||
export GDK_PIXBUF_MODULEDIR="$out/${moduleDir}"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# 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/bin/webp-thumbnailer" \
|
||||
--set GDK_PIXBUF_MODULE_FILE "$out/${loadersPath}"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
|
@ -52,7 +70,7 @@ stdenv.mkDerivation rec {
|
|||
homepage = "https://github.com/aruiz/webp-pixbuf-loader";
|
||||
license = licenses.lgpl2Plus;
|
||||
platforms = platforms.unix;
|
||||
maintainers = [ maintainers.cwyc ];
|
||||
maintainers = teams.gnome.members ++ [ maintainers.cwyc ];
|
||||
# meson.build:16:0: ERROR: Program or command 'gcc' not found or not executable
|
||||
broken = stdenv.isDarwin;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue