summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 114b9257dbf495606b021ca6c6d8bb24f1c4df93 (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
pkgname="rt-pyocd-git"
pkgver=0.2.2.0.g3f8626e
pkgrel=1
pkgdesc="RT_Thread DAP-Link 调试实例!"
arch=("x86_64")
license=("")
depends=('git' 'python')
url="https://github.com/RT-Thread-Studio/sdk-debugger-pyocd"

pkggitname="sdk-debugger-pyocd"

source=(${pkggitname}::git+https://github.com/RT-Thread-Studio/${pkggitname}.git)
sha512sums=('SKIP')

_root="/opt/rt-thread"
_tools_root="${_root}/tools"
_pyocd_root="${_tools_root}/pyocd"

pkgver() {
    _ver=`cd ${pkggitname} && git describe --long --tags | sed 's/-/\./g; s/^v//; s/g*$//'`
    echo $_ver
}

build() {
    mkdir -p ${srcdir}${_root}
    mkdir -p ${srcdir}${_pyocd_root}/bin
    cp -r ${srcdir}/${pkggitname}/packs ${srcdir}${_pyocd_root}/bin
    cd ${srcdir}${_pyocd_root}/bin/packs && python ./update_yaml.py
}

package() {
    install -d -m755 "${pkgdir}${_pyocd_root}"
    cp -rf ${srcdir}${_pyocd_root}/* "${pkgdir}${_pyocd_root}"
}

(
    echo "pre_install() {"
    echo "    python -m venv ${_pyocd_root}"
    echo "    ${_pyocd_root}/bin/pip install pyocd"
    echo "}"
    echo "post_install() {"
    echo '    echo "SUBSYSTEMS==\"usb\", GROUP=\"users\", MODE=\"0666\"" > /etc/udev/rules.d/99-rt-usb.rules'
    echo "    udevadm control --reload-rules && udevadm trigger"
    echo "}"
    echo "post_remove() {"
    echo "    rm -rf ${_pyocd_root}"
    echo "}"
) > "${startdir}/${pkgname}.install"
true && install="${pkgname}.install"