summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3600ded872b93cc386e29b8a8c600b8107e55c72 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Maintainer: taotieren <admin@taotieren.com>

pkgbase=wch-bleuart
pkgname=($pkgbase wch-bleuart-app wch-ble-lib wch-bleuart-guide)
pkgver=1.2
pkgrel=2
arch=('x86_64')
url='http://www.mounriver.com/'
license=('GPL2' 'GPL3' 'Custom')
provides=()
conflicts=()
depends=('bash')
makedepends=('libarchive' 'unarchiver')
optdepends=('mounriver-studio-toolchain-bin: This MRS Toolchain includes the tool chain for RISC-V kernel chip under Linux x64 and the debug download tool OpenOCD.')
source=("wch-bleuart-app-${pkgver}.zip::http://www.wch.cn/downloads/file/347.html"
        "wch-ble-lib-${pkgver}.zip::http://www.wch.cn/downloads/file/349.html"
        "CH9143DS1-${pkgver}.pdf::http://www.wch.cn/downloads/file/332.html"
        "CH9140DS1-${pkgver}.pdf::http://www.wch.cn/downloads/file/331.html"
        "CH9141DS1-${pkgver}.pdf::http://www.wch.cn/downloads/file/274.html")

sha256sums=('85cd9431265bb728d5f89bb72947b6deb62338689c8be647027b07314dbeed48'
            '709e90d4d2b7d4a315b332f7f5f8047e838e1304ebb8e54248b8d9bafece0456'
            '7d31eb1b4fede49c7f6786c072a6a4d61329dad797b1ad72e5060ac24f33456b'
            '4013a01ef7a7928e3232b0aed9a4622ad4a9c4ac3481900c6ff895250de690ef'
            '2b2140fed808922a9f7f84891bacd9d401fcc22ebcec0185b45b3254effc92a4')

noextract=(wch-bleuart-app-${pkgver}.zip wch-ble-lib-${pkgver}.zip)

package_wch-bleuart() {
    pkgdesc="Wch-bleuart contains all related software packages of BleUart."
    depends=(wch-bleuart-app wch-ble-lib wch-bleuart-guide)
}

package_wch-bleuart-app() {
    pkgdesc="The software is used for the CH914X chip module of CH914X low-power Bluetooth to serial port."

    install -dm0755 "${pkgdir}/opt/wch/${pkgname}"

    unar -e GBK "${srcdir}/${pkgname}-${pkgver}.zip" -o "${srcdir}"
    bsdtar xf "${srcdir}/BleUartApp/Linux/bleuart_1.0_amd64.deb"
    bsdtar xf "${srcdir}/data.tar.xz" --strip-components=3 -C "${pkgdir}/opt/wch/${pkgname}"
    cp -r "${srcdir}"/BleUartApp/*.pdf "${pkgdir}/opt/wch/${pkgname}"

    install -Dm0755 /dev/stdin "${pkgdir}/usr/bin/bleuart" << EOF
#!/bin/env bash

cd /opt/wch/${pkgname}
exec ./BleUart "\$@"

EOF
    install -Dm0644 /dev/stdin "${pkgdir}/usr/share/applications/bleuart.desktop" << EOF
[Desktop Entry]
Type=Application
Name=BleUart
Exec=bleuart
Icon=/opt/wch/${pkgname}/BleUart.ico
Comment=BleUart, V1.0 南京沁恒微电子股份有限公司 版权所有(C) WCH 2021
Terminal=false
Type=Application
Encoding=UTF-8

EOF
}

package_wch-ble-lib() {
    pkgdesc="WCH BleLib Multi-system platform low Power Bluetooth Development Interface Library."
    provides=('CH914X-lib' 'CH57X-lib' 'CH9140-lib' 'CH9141-lib' 'CH9143-lib' 'CH579-lib' 'CH578-lib' 'CH573-lib')
    install -dm0755 "${pkgdir}/opt/wch/${pkgname}"

    unar -e GBK "${srcdir}/${pkgname}-${pkgver}.zip"
    cp -r "${srcdir}"/WCHBleLib_MultiOS/* "${pkgdir}/opt/wch/${pkgname}"

    install -Dm0755 /dev/stdin "${pkgdir}/etc/profile.d/${pkgname}.sh" << EOF
#!/bin/sh
[ -d /opt/wch/${pkgname}/Linux/LIB ] && append_path '/opt/wch/${pkgname}/Linux/LIB'

export PATH
EOF
}

package_wch-bleuart-guide() {
    pkgdesc="Introduction to CH9140 CH9141 CH9143."
    install -dm0755 "${pkgdir}/opt/wch/${pkgname}"
    provides=('CH914X-guide' 'CH9140-guide' 'CH9141-guide' 'CH9143-guide')
    cp -r "${srcdir}"/*.pdf "${pkgdir}/opt/wch/${pkgname}"
}
# vim: ts=4 sw=4 et