_pkgname=meikiocr
pkgname=python-${_pkgname}
pkgver=0.1.2
pkgrel=1
pkgdesc="High-speed, high-accuracy, local OCR for Japanese video games"
arch=('any')
url="https://github.com/rtr46/${_pkgname}"
license=('Apache-2.0')
depends=(
    'python-numpy'
    'python-opencv'
    'python-huggingface-hub'
    'onnxruntime'
)
makedepends=(
    'python-build'
    'python-installer'
    'python-wheel'
    'python-setuptools'
)
optdepends=(
    'onnxruntime-cuda: GPU acceleration'
)
source=("${_pkgname}-${pkgver}.tar.gz::https://files.pythonhosted.org/packages/source/m/${_pkgname}/${_pkgname}-${pkgver}.tar.gz")
sha256sums=('612ab61ac7a741cd4ca96c961c5917cf21f393dc0d71d7ab2dbd677ae9b18f39')

build() {
    cd "${srcdir}/${_pkgname}-${pkgver}"
    python -m build --wheel --no-isolation
}

package() {
    cd "${srcdir}/${_pkgname}-${pkgver}"
    python -m installer --destdir="${pkgdir}" dist/*.whl
    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
