imv: make every backend and window system configurable
The following new derivation inputs are added: * withBackends: a list of all backends to enable. The valid names are the same as specified in imv's meson_options.txt. Default is to enable all 7 backends: freeimage, libtiff, libjpeg(_turbo), libpng, librsvg, libnsgif and libheif * withWindowSystem: either all, x11 or wayland to describe window system support.
This commit is contained in:
parent
c391b303ca
commit
4f927ee341
|
@ -1,28 +1,60 @@
|
||||||
{ asciidoc
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, fetchFromGitHub
|
||||||
|
, asciidoc
|
||||||
, cmocka
|
, cmocka
|
||||||
, docbook_xsl
|
, docbook_xsl
|
||||||
, fetchFromGitHub
|
, libxslt
|
||||||
, fontconfig
|
, fontconfig
|
||||||
, freeimage
|
, meson
|
||||||
|
, ninja
|
||||||
|
, pkgconfig
|
||||||
, icu
|
, icu
|
||||||
|
, pango
|
||||||
|
, inih
|
||||||
|
, withWindowSystem ? "all"
|
||||||
|
, xorg
|
||||||
|
, libxkbcommon
|
||||||
, libGLU
|
, libGLU
|
||||||
, libheif
|
, wayland
|
||||||
|
, withBackends ? [ "freeimage" "libtiff" "libjpeg" "libpng" "librsvg" "libnsgif" "libheif" ]
|
||||||
|
, freeimage
|
||||||
|
, libtiff
|
||||||
, libjpeg_turbo
|
, libjpeg_turbo
|
||||||
, libpng
|
, libpng
|
||||||
, librsvg
|
, librsvg
|
||||||
, libtiff
|
|
||||||
, libxkbcommon
|
|
||||||
, libxslt
|
|
||||||
, netsurf
|
, netsurf
|
||||||
, pango
|
, libheif
|
||||||
, pkgconfig
|
|
||||||
, stdenv
|
|
||||||
, wayland
|
|
||||||
, meson
|
|
||||||
, ninja
|
|
||||||
, inih
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
windowSystems = {
|
||||||
|
all = windowSystems.x11 ++ windowSystems.wayland;
|
||||||
|
x11 = [ libGLU xorg.libxcb xorg.libX11 ];
|
||||||
|
wayland = [ wayland ];
|
||||||
|
};
|
||||||
|
|
||||||
|
backends = {
|
||||||
|
inherit freeimage libtiff libpng librsvg libheif;
|
||||||
|
libjpeg = libjpeg_turbo;
|
||||||
|
inherit (netsurf) libnsgif;
|
||||||
|
};
|
||||||
|
|
||||||
|
backendFlags = builtins.map
|
||||||
|
(b: if builtins.elem b withBackends
|
||||||
|
then "-D${b}=enabled"
|
||||||
|
else "-D${b}=disabled")
|
||||||
|
(builtins.attrNames backends);
|
||||||
|
in
|
||||||
|
|
||||||
|
# check that given window system is valid
|
||||||
|
assert lib.assertOneOf "withWindowSystem" withWindowSystem
|
||||||
|
(builtins.attrNames windowSystems);
|
||||||
|
# check that every given backend is valid
|
||||||
|
assert builtins.all
|
||||||
|
(b: lib.assertOneOf "each backend" b (builtins.attrNames backends))
|
||||||
|
withBackends;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "imv";
|
pname = "imv";
|
||||||
version = "4.2.0";
|
version = "4.2.0";
|
||||||
|
@ -34,6 +66,12 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "07pcpppmfvvj0czfvp1cyq03ha0jdj4whl13lzvw37q3vpxs5qqh";
|
sha256 = "07pcpppmfvvj0czfvp1cyq03ha0jdj4whl13lzvw37q3vpxs5qqh";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mesonFlags = [
|
||||||
|
"-Dwindows=${withWindowSystem}"
|
||||||
|
"-Dtest=enabled"
|
||||||
|
"-Dman=enabled"
|
||||||
|
] ++ backendFlags;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
asciidoc
|
asciidoc
|
||||||
cmocka
|
cmocka
|
||||||
|
@ -41,26 +79,18 @@ stdenv.mkDerivation rec {
|
||||||
libxslt
|
libxslt
|
||||||
meson
|
meson
|
||||||
ninja
|
ninja
|
||||||
|
pkgconfig
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
freeimage
|
|
||||||
icu
|
icu
|
||||||
libGLU
|
|
||||||
libjpeg_turbo
|
|
||||||
librsvg
|
|
||||||
libxkbcommon
|
libxkbcommon
|
||||||
netsurf.libnsgif
|
|
||||||
pango
|
pango
|
||||||
pkgconfig
|
|
||||||
wayland
|
|
||||||
inih
|
inih
|
||||||
libtiff
|
] ++ windowSystems."${withWindowSystem}"
|
||||||
libheif
|
++ builtins.map (b: backends."${b}") withBackends;
|
||||||
libpng
|
|
||||||
];
|
|
||||||
|
|
||||||
postFixup = ''
|
postFixup = lib.optionalString (withWindowSystem == "all") ''
|
||||||
# The `bin/imv` script assumes imv-wayland or imv-x11 in PATH,
|
# The `bin/imv` script assumes imv-wayland or imv-x11 in PATH,
|
||||||
# so we have to fix those to the binaries we installed into the /nix/store
|
# so we have to fix those to the binaries we installed into the /nix/store
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue