summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 92f3bb152b2e9be1b8fce7da0a3feb5eba9f2c80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Maintainer:
# Contributor: Ben Westover <kwestover.kw@gmail.com>

: ${_commit:=5a863eece86fcaa97cb8325cf747e0aae3c307e4}

_pkgname="mtkclient"
pkgname="$_pkgname"
pkgver=2.1.4.1
pkgrel=2
pkgdesc="Unofficial MTK reverse engineering and flash tool"
url="https://github.com/bkerler/mtkclient"
license=('GPL-3.0-only')
arch=('any')

depends=(
  'pyside6'
  'python'
  'python-capstone'
  'python-colorama'
  'python-fusepy' # AUR
  'python-keystone'
  'python-pycryptodomex'
  'python-pyserial'
  'python-pyusb'
)
makedepends=(
  'git'
  'python-build'
  'python-hatchling'
  'python-installer'
  'python-wheel'
)
optdepends=(
  'android-udev: ADB/Fastboot support'
)

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git#commit=$_commit")
sha256sums=('SKIP')

prepare() {
  cd "$_pkgsrc"

  # fix udev permissions
  local _plugdev_regex=''
  _plugdev_regex+='s&MODE=\S+&MODE="0660",&g;'
  _plugdev_regex+='s&GROUP="plugdev"&TAG+="uaccess"&g;'

  sed -E -e "$_plugdev_regex" -i Setup/Linux/51-edl.rules
  sed -E -e "$_plugdev_regex" -i Setup/Linux/52-mtk.rules
}

build() {
  cd "$_pkgsrc"
  python -m build --wheel --no-isolation
}

package() {
  cd "$_pkgsrc"
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 Setup/Linux/51-edl.rules "$pkgdir"/usr/lib/udev/rules.d/51-mtkclient-edl.rules

  install -Dm644 Setup/Linux/52-mtk.rules "$pkgdir"/usr/lib/udev/rules.d/52-mtkclient-mtk.rules
}