# Packager = Tuxcore <dev@tuxcore.org> 
pkgbase=gdk-pixbuf2
pkgname=(
  gdk-pixbuf2
  gdk-pixbuf2-docs
)
pkgver=2.42.12
pkgrel=2
pkgdesc="An image loading library"
url="https://wiki.gnome.org/Projects/GdkPixbuf"
arch=(x86_64)
license=(LGPL-2.0-or-later)
depends=(
  glib2
  glibc
  libjpeg-turbo
  libpng
  libtiff
  shared-mime-info
)
makedepends=(
  gi-docgen
  git
  glib2-devel
  gobject-introspection
  meson
  python-docutils
)
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"
  "libjxl: Load .jxl"
  "librsvg: Load .svg, .svgz, and .svg.gz"
  "webp-pixbuf-loader: Load .webp"
)
source=(
  "git+https://gitlab.gnome.org/GNOME/gdk-pixbuf.git#tag=$pkgver"
  gdk-pixbuf-query-loaders.hook
)
b2sums=('f44a114c98aba2a3ff0e7435dd85e8e3bde579e96cb059ead733ed2e8b28b857e8c66e72360b40ca07237c98fa9904948886bf78980c6deccf58b29e48988790'
        '5a00d34888e207d70d02369015d029f4c0450fc5a02b4b257de8e5df04380dc550723f351433859224c96c3c6390896f2166673af65e8a09eb57024f5a34301b')

prepare() {
  cd gdk-pixbuf
}

build() {
  local meson_options=(
    -D builtin_loaders=all
    -D gtk_doc=true
    -D installed_tests=false
    -D introspection=enabled
    -D man=true
    -D others=enabled
  )

  arch-meson gdk-pixbuf build "${meson_options[@]}"
  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 sts=-1 et:
