# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=rime-stroke
pkgver=0.0.0.20250923
_commit=3a4b0f4013e2b4c14b1e80c92b1d4723eb65f39c
pkgrel=1
pkgdesc="Stroke input for rime"
arch=('x86_64')
url="https://github.com/rime/rime-stroke"
license=('LGPL')
# dependency for reverse lookup
depends=('rime-luna-pinyin')
makedepends=('git' 'librime' 'rime-prelude' 'rime-essay')
source=("git+https://github.com/rime/rime-stroke.git#commit=$_commit")
sha512sums=('b19b1dfce0d4eda47eb680f7e0d8e542029ef9ae7c813dec5041ab5f05a98beca2aea06ce3c12fa6041f30e3295b8f4897e9c2cc0378667cb91666a674ebbcaa')

prepare() {
  cd $pkgname
  # Link essentials
  for _f in $(pacman -Qql rime-prelude rime-essay | grep -v "/$"); do ln -sf $_f; done
}

build(){
  cd $pkgname
  for _s in $(ls *.schema.yaml); do rime_deployer --compile $_s; done
}

package() {
  cd $pkgname
  find . -type l -delete
  rm build/*.txt
  install -Dm644 *.yaml -t "$pkgdir"/usr/share/rime-data/
  install -Dm644 build/* -t "$pkgdir"/usr/share/rime-data/build/
}
