# Maintainer: Ben Westover <me@benthetechguy.net>
pkgname=mtkclient
pkgver=1.63
pkgrel=3
pkgdesc="Unofficial MTK reverse engineering and flash tool"
url="https://github.com/bkerler/mtkclient"
# riscv64 blocked by pyside6
# armhf blocked by qt6-qtdeclarative -> pyside6
arch="noarch !riscv64 !armhf"
license="GPL-3.0-only"
depends="
	android-udev-rules
	libusb
	py3-colorama
	py3-mock
	py3-pycryptodome
	py3-pycryptodomex
	py3-pyserial
	py3-pyside6
	py3-shiboken6
	py3-usb
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
options="!check" # No tests available
subpackages="$pkgname-pyc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/bkerler/mtkclient/archive/refs/tags/$pkgver.tar.gz
	data.patch
"

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

package() {
	python3 -m installer -d "$pkgdir" dist/*.whl
	install -Dm755 mtk_gui -t "$pkgdir"/usr/bin/
	install -Dm644 Setup/Linux/51-edl.rules "$pkgdir"/usr/lib/udev/rules.d/52-edl.rules
}

sha512sums="
1ed427a9e3f84643ef684fa3efe63bc815c8ec568610bb7158d7c7439ffb8463d63ed79b35f223e1cfff68148b5d4138fe932d7ced6bf7fa86194107792804c0  mtkclient-1.63.tar.gz
f1a0059b9e48ca73cda1e3b327912f71b6fca1bc78f9f0252ac170ae81f82017fa7f64b58455fc8d5273ae68e4ccebde19550518b0ce9bed26b14486ac68cf09  data.patch
"
