# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgbase=gdk-pixbuf2
pkgname=(gdk-pixbuf2 gdk-pixbuf2-docs)
pkgver=2.42.6
pkgrel=2
pkgdesc="An image loading library"
url="https://wiki.gnome.org/Projects/GdkPixbuf"
arch=(x86_64)
license=(LGPL)
depends=(glib2 libpng libtiff libjpeg shared-mime-info)
makedepends=(gobject-introspection git meson gi-docgen docbook-xsl)
optdepends=(
  "libwmf: Load .wmf and .apm"
  "libopenraw: Load .dng, .cr2, .crw, .nef, .orf, .pef, .arw, .erf, .mrw, and .raf"
  "libavif: Load .avif"
  "libheif: Load .heif, .heic, and .avif"
  "librsvg: Load .svg, .svgz, and .svg.gz"
  "webp-pixbuf-loader: Load .webp"
)
_commit=3afa395cd47fdde70216a8a8e4d71ac753e26ade  # tags/2.42.6^0
source=(
  "git+https://gitlab.gnome.org/GNOME/gdk-pixbuf.git#commit=$_commit"
  gdk-pixbuf-query-loaders.hook
)
sha256sums=('SKIP'
            '9fb71d95e6a212779eb0f88dde5a3cee0df7f4d9183f8f9ce286f8cdc14428f0')

pkgver() {
  cd gdk-pixbuf
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd gdk-pixbuf
}

build() {
  arch-meson gdk-pixbuf build \
    -D builtin_loaders=all \
    -D gtk_doc=true \
    -D installed_tests=false
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_gdk-pixbuf2() {
  provides=(libgdk_pixbuf-2.0.so)
  install=gdk-pixbuf2.install

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc

  install -Dt "$pkgdir/usr/share/libalpm/hooks" -m644 *.hook
}

package_gdk-pixbuf2-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 et:
