pkgname=imv
pkgver=5.0.1
pkgdesc="Minimal image viewer designed for tiling window manager users"
homepage="https://sr.ht/~exec64/imv/"
license=("MIT")
depends=(
  glib
  inih
  libglvnd
  cairo
  libxkbcommon
  pango
  libnsgif
  icu
  libjpeg-turbo
  libpng
  librsvg
  tiff
  wayland
  libwebp
  wayland-protocols
)
bdepends=(asciidoc wayland-scanner)
_patches=("imv-5.0.0-nsgif-version.patch")
_patch_sums=("ae8f20077c0a75f33fb04f0c603df10dc2dcdd3e2be19e590d6ff92eee959910524bdb370b292124fd7c3333a82ff8c0db384488dbd8962d8e1dabd41a688160")
sources=("${pkgname}-${pkgver}.tar.gz"
  "${_patches[@]}"
)
urls=("https://git.sr.ht/~exec64/imv/archive/v${pkgver}.tar.gz"
  "${_patches[@]}"
)
sha512sums=("9a53119b4bdb2c4b848ac5d7138f98948973bfa52ef3da111ca3c9eff5e11daf90529cd8c4898643bc7bde712b9c0e62fee9770a55f4e220abd4587ce651bba7"
  "${_patch_sums[@]}"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  for _patch in ${_patches[@]}; do
    patch -p1 -i ${filedir}/${_patch}
  done
}

src_build() {
  local meson_args=(
    --prefix=/usr
    --buildtype=release
    --wrap-mode=nodownload
    -D python.bytecompile=1
    -D libnsbmp=disabled
    -D libnsgif=enabled
    -D libheif=disabled
    -D libjpeg=enabled
    -D libjxl=disabled
    -D libpng=enabled
    -D qoi=disabled
    -D librsvg=enabled
    -D test=disabled
    -D libtiff=enabled
    -D unicode=icu
    -D libwebp=enabled
    -D windows=wayland
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_install() {
  meson install -C build --destdir "$pkgdir"
}

# vim:ft=sh syn=sh et sw=2:
