# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgbase=adwaita-icon-theme
pkgname=(
  adwaita-icon-theme
  adwaita-cursors
)
pkgver=%version%
pkgrel=%release%
pkgdesc="GNOME standard icons"
url="https://gitlab.gnome.org/GNOME/adwaita-icon-theme"
arch=(any)
license=(
  CC-BY-SA-3.0
  LGPL-3.0-only
)
depends=(
  hicolor-icon-theme
  gtk-update-icon-cache
  librsvg
)
makedepends=(
  git
  gtk3
  meson
)
_commit=7d2510820199ff7f233511a00895043f3843dbcd  # tags/46.0^0
source=("git+https://gitlab.gnome.org/GNOME/adwaita-icon-theme.git#commit=$_commit")
b2sums=('83aa51edbe09cf021c33411687ddaae421b96f3356960947d29491f52147a94d9a8b3976a9a020e8de0eda536cc40b32d1912a17adbf2949d6abb234299673d3')

pkgver() {
  cd $pkgbase
  git describe --tags | sed -r 's/\.([a-z])/\1/;s/([a-z])\./\1/;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgbase
}

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

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

package_adwaita-icon-theme() {
  depends+=(adwaita-cursors)

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

  mkdir -p cursors/usr/share/icons/Adwaita
  mv {"$pkgdir",cursors}/usr/share/icons/Adwaita/cursors
}

package_adwaita-cursors() {
  pkgdesc="GNOME standard cursors"
  depends=()

  mv cursors/* "$pkgdir"

  # deduplicate cursors
  hardlink -c "$pkgdir/usr"
}

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