# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=emacs-pyim
pkgver=5.3.3
pkgrel=0
_pkgreal=pyim
pkgdesc="Chinese input method derived from Emacs-eim"
url="https://github.com/tumashu/pyim"
arch="noarch"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	emacs-async
	emacs-posframe
	emacs-xr
	"
makedepends="emacs-nox"
checkdepends="emacs-pyim-basedict"
options="!check" # circular dep with emacs-pyim-basedict
source="https://github.com/tumashu/pyim/archive/v$pkgver/emacs-pyim-$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	emacs -batch -q -no-site-file -L . \
		-eval '(setq byte-compile-error-on-warn t)' \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . \
		-l tests/pyim-tests.el
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/pyim/

	cd "$pkgdir"/usr/share/emacs/site-lisp/pyim
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
e66b2b11c53a0ee196b69760318f5bfb630a1cebd0cabc3a2c865db2aec484aa4e909e7b14f98e563f51ab3dbf2b7458bfea6790a170544503af80b90744d7b6  emacs-pyim-5.3.3.tar.gz
"
