Unverified Commit 02f6b314 authored by Michele Guerini Rocco's avatar Michele Guerini Rocco Committed by GitHub
Browse files

imv: 4.5.0 -> 5.0.0, modernize (#461037)

parents 57492205 a4103873
Loading
Loading
Loading
Loading
+30 −28
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
  stdenv,
  lib,
  fetchFromSourcehut,
  fetchpatch,
  asciidoc,
  cmocka,
  docbook_xsl,
@@ -10,7 +9,7 @@
  meson,
  ninja,
  pkg-config,
  icu75,
  icu,
  pango,
  inih,
  withWindowSystem ? if stdenv.hostPlatform.isLinux then "all" else "x11",
@@ -18,7 +17,9 @@
  libxkbcommon,
  libGLU,
  wayland,
  wayland-protocols,
  withBackends ? [
    "farbfeld"
    "libjxl"
    "libtiff"
    "libjpeg"
@@ -26,6 +27,9 @@
    "librsvg"
    "libheif"
    "libnsgif"
    "libnsbmp"
    "libwebp"
    "qoi"
  ],
  libtiff,
  libjpeg_turbo,
@@ -34,6 +38,10 @@
  librsvg,
  libnsgif,
  libheif,
  libnsbmp,
  libwebp,
  qoi,
  wayland-scanner,
}:

let
@@ -44,7 +52,11 @@ let
      xorg.libxcb
      xorg.libX11
    ];
    wayland = [ wayland ];
    wayland = [
      wayland
      wayland-scanner
      wayland-protocols
    ];
  };

  backends = {
@@ -55,9 +67,12 @@ let
      libheif
      libjxl
      libnsgif
      libnsbmp
      libwebp
      qoi
      ;
    farbfeld = null; # builtin
    libjpeg = libjpeg_turbo;
    freeimage = throw "freeimage backend not supported";
  };

  backendFlags = map (
@@ -72,9 +87,9 @@ assert builtins.all (
  b: lib.assertOneOf "each backend" b (builtins.attrNames backends)
) withBackends;

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "imv";
  version = "4.5.0";
  version = "5.0.0";
  outputs = [
    "out"
    "man"
@@ -83,8 +98,8 @@ stdenv.mkDerivation rec {
  src = fetchFromSourcehut {
    owner = "~exec64";
    repo = "imv";
    rev = "v${version}";
    sha256 = "sha256-aJ2EXgsS0WUTxMqC1Q+uOWLG8BeuwAyXPmJB/9/NCCU=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-sOlWSv1GqdYzooTvcJjXxJI3pwWWJnlUpbGZgUAFYm0=";
  };

  mesonFlags = [
@@ -107,7 +122,7 @@ stdenv.mkDerivation rec {

  buildInputs = [
    cmocka
    icu75
    icu
    libxkbcommon
    pango
    inih
@@ -115,19 +130,6 @@ stdenv.mkDerivation rec {
  ++ windowSystems."${withWindowSystem}"
  ++ map (b: backends."${b}") withBackends;

  patches = [
    (fetchpatch {
      # https://lists.sr.ht/~exec64/imv-devel/patches/55937
      name = "update libnsgif backend";
      url = "https://lists.sr.ht/~exec64/imv-devel/%3C20241113012702.30521-2-reallyjohnreed@gmail.com%3E/raw";
      hash = "sha256-/OQeDfIkPtJIIZwL8jYVRy0B7LSBi9/NvAdPoDm851k=";
    })
  ];

  postInstall = ''
    install -Dm644 ../files/imv.desktop $out/share/applications/
  '';

  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
@@ -139,16 +141,16 @@ stdenv.mkDerivation rec {

  doCheck = true;

  meta = with lib; {
  meta = {
    description = "Command line image viewer for tiling window managers";
    homepage = "https://sr.ht/~exec64/imv/";
    license = licenses.mit;
    maintainers = with maintainers; [
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      rnhmjoj
      markus1189
    ];
    platforms = platforms.all;
    badPlatforms = platforms.darwin;
    platforms = lib.platforms.all;
    badPlatforms = lib.platforms.darwin;
    mainProgram = "imv";
  };
}
})