From a1e9a94785cf885487d823790aa82dc82fe5924c Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sun, 3 Jan 2021 12:52:03 +0100 Subject: [PATCH 1/3] imv: 4.1.0 -> 4.2.0 * switch build system to wayland * enable all backends by adding the following to buildInputs as meson autodetects which backends are available. * libtiff * libheif * libpng Open questions: * imv prints a warning from the tiff backend everytime a non tiff file is opened: Is this normal? Seems harmless enough though. * Should we make backends configurable / optional? I readded some backends which apparently were removed, but still given as an argument to the derivation. Resolves #108185. --- pkgs/applications/graphics/imv/default.nix | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/graphics/imv/default.nix b/pkgs/applications/graphics/imv/default.nix index faf74873058..9b69aa9ec0f 100644 --- a/pkgs/applications/graphics/imv/default.nix +++ b/pkgs/applications/graphics/imv/default.nix @@ -18,20 +18,30 @@ , pkgconfig , stdenv , wayland +, meson +, ninja +, inih }: stdenv.mkDerivation rec { pname = "imv"; - version = "4.1.0"; + version = "4.2.0"; src = fetchFromGitHub { owner = "eXeC64"; repo = "imv"; rev = "v${version}"; - sha256 = "0gk8g178i961nn3bls75a8qpv6wvfvav6hd9lxca1skaikd33zdx"; + sha256 = "07pcpppmfvvj0czfvp1cyq03ha0jdj4whl13lzvw37q3vpxs5qqh"; }; - nativeBuildInputs = [ asciidoc cmocka docbook_xsl libxslt ]; + nativeBuildInputs = [ + asciidoc + cmocka + docbook_xsl + libxslt + meson + ninja + ]; buildInputs = [ freeimage @@ -44,12 +54,12 @@ stdenv.mkDerivation rec { pango pkgconfig wayland + inih + libtiff + libheif + libpng ]; - installFlags = [ "PREFIX=$(out)" "CONFIGPREFIX=$(out)/etc" ]; - - makeFlags = [ "BACKEND_LIBJPEG=yes" "BACKEND_LIBNSGIF=yes" ]; - postFixup = '' # 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 From c391b303caee60cd80104d6fa99ef7bd7a0e6d2d Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 4 Jan 2021 14:41:45 +0100 Subject: [PATCH 2/3] imv: use substituteInPlace --- pkgs/applications/graphics/imv/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/graphics/imv/default.nix b/pkgs/applications/graphics/imv/default.nix index 9b69aa9ec0f..f133dde6e4b 100644 --- a/pkgs/applications/graphics/imv/default.nix +++ b/pkgs/applications/graphics/imv/default.nix @@ -64,8 +64,9 @@ stdenv.mkDerivation rec { # 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 - sed -i "s|\bimv-wayland\b|$out/bin/imv-wayland|" $out/bin/imv - sed -i "s|\bimv-x11\b|$out/bin/imv-x11|" $out/bin/imv + substituteInPlace "$out/bin/imv" \ + --replace "imv-wayland" "$out/bin/imv-wayland" \ + --replace "imv-x11" "$out/bin/imv-x11" ''; doCheck = true; From 4f927ee34182154535e24cb7b8ed75a849609638 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 4 Jan 2021 15:07:52 +0100 Subject: [PATCH 3/3] 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. --- pkgs/applications/graphics/imv/default.nix | 82 +++++++++++++++------- 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/pkgs/applications/graphics/imv/default.nix b/pkgs/applications/graphics/imv/default.nix index f133dde6e4b..71e156881c4 100644 --- a/pkgs/applications/graphics/imv/default.nix +++ b/pkgs/applications/graphics/imv/default.nix @@ -1,28 +1,60 @@ -{ asciidoc +{ stdenv +, lib +, fetchFromGitHub +, asciidoc , cmocka , docbook_xsl -, fetchFromGitHub +, libxslt , fontconfig -, freeimage +, meson +, ninja +, pkgconfig , icu +, pango +, inih +, withWindowSystem ? "all" +, xorg +, libxkbcommon , libGLU -, libheif +, wayland +, withBackends ? [ "freeimage" "libtiff" "libjpeg" "libpng" "librsvg" "libnsgif" "libheif" ] +, freeimage +, libtiff , libjpeg_turbo , libpng , librsvg -, libtiff -, libxkbcommon -, libxslt , netsurf -, pango -, pkgconfig -, stdenv -, wayland -, meson -, ninja -, inih +, libheif }: +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 { pname = "imv"; version = "4.2.0"; @@ -34,6 +66,12 @@ stdenv.mkDerivation rec { sha256 = "07pcpppmfvvj0czfvp1cyq03ha0jdj4whl13lzvw37q3vpxs5qqh"; }; + mesonFlags = [ + "-Dwindows=${withWindowSystem}" + "-Dtest=enabled" + "-Dman=enabled" + ] ++ backendFlags; + nativeBuildInputs = [ asciidoc cmocka @@ -41,26 +79,18 @@ stdenv.mkDerivation rec { libxslt meson ninja + pkgconfig ]; buildInputs = [ - freeimage icu - libGLU - libjpeg_turbo - librsvg libxkbcommon - netsurf.libnsgif pango - pkgconfig - wayland inih - libtiff - libheif - libpng - ]; + ] ++ windowSystems."${withWindowSystem}" + ++ builtins.map (b: backends."${b}") withBackends; - postFixup = '' + postFixup = lib.optionalString (withWindowSystem == "all") '' # 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