# Packager = Tuxcore <dev@tuxcore.org> 
pkgbase=gsettings-desktop-schemas
pkgname=(
  gsettings-desktop-schemas
  gsettings-system-schemas
)
pkgver=47.1
pkgrel=1
pkgdesc="GSettings schemas for GNOME"
url="https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas"
arch=(any)
license=(LGPL-2.1-or-later)
makedepends=(
  adobe-source-code-pro-fonts
  cantarell-fonts
  dconf
  git
  glib2-devel
  gobject-introspection
  meson
)
source=("git+$url.git#tag=${pkgver/[a-z]/.&}")
b2sums=('ff80d8cee04d1a498993632195242d24d3869225bdcc315fb680b7dce9f9fc9761cdf6f64d35af29707dbe29a3ce0f5c57c814a93d4cc95fc3586de260e83802')

prepare() {
  cd $pkgbase
}

build() {
  arch-meson $pkgbase build
  meson compile -C build
}

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

_pick() {
  local p="$1" f d; shift
  for f; do
    d="$srcdir/$p/${f#$pkgdir/}"
    mkdir -p "$(dirname "$d")"
    mv "$f" "$d"
    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  done
}

package_gsettings-desktop-schemas() {
  pkgdesc+=" desktop components"
  depends=(
    "gsettings-system-schemas=$pkgver-$pkgrel"
    adobe-source-code-pro-fonts
    cantarell-fonts
    dconf
  )

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

  cd "$pkgdir"
  _pick system usr/share/glib-2.0/schemas/org.gnome.desktop.enums.xml
  _pick system usr/share/glib-2.0/schemas/org.gnome.system.*.gschema.xml
}

package_gsettings-system-schemas() {
  pkgdesc+=" system components"
  depends=(dconf)

  mv system/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
