summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d37e77f8cf3b95747623db65e991fc09542559e6 (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
88
89
90
91
92
93
94
# Contributor: taotieren <admin@taotieren.com>

pkgname=bouffalolab-devcude-bin
pkgver=1.8.5
pkgrel=0
pkgdesc="Dev Cube 是博流提供的芯片集成开发工具,包含 IOT 程序下载、MCU 程序下载和RF性能测试三大功能。工具提供程序固件启动时的时钟,电源,Flash 参数等配置,并可根据用户需求对程序进行加密和签名,生成应用程序启动信息文件。工具还可烧写用户资源文件,分区表文件以及 EFUSE 配置文件等。工具可对 Flash 进行擦、改、写"
arch=('x86_64')
url="https://dev.bouffalolab.com/download"
license=('custom')
provides=(Bouffalo-Lab-Dev-Cube
        bflb-iot-tool)
conflicts=(python-bflb-iot-tool)
#replaces=(${pkgname})
depends=(libusb
        libftdi
        hidapi
        openocd)
makedepends=(libarchive)
optdepends=("jlink-software-and-documentation: Segger JLink software & documentation pack for Linux")
install=${pkgname}.install
source=("${pkgname%-bin}-${pkgver}.zip::https://dev.bouffalolab.com/media/upload/download/BouffaloLabDevCube-v${pkgver}.zip")
sha256sums=('bbaddd5382b42c9d4ebef7ff39b1e37b347ba695a34132fb9237c83b773027b4')
noextract=(${pkgname%-bin}-${pkgver}.zip)
options=('!strip')

package() {
#     export LC_CTYPE="zh_CN.UTF-8"
    install -dm0755 "${pkgdir}/opt/bouffalolab/${pkgname%-bin}/"

#     bsdtar xf "${srcdir}/${pkgname%-bin}-${pkgver}.zip" --strip-components=1 -C  "${pkgdir}/opt/bouffalolab/${pkgname%-bin}"
    bsdtar xf "${srcdir}/${pkgname%-bin}-${pkgver}.zip"  -C  "${pkgdir}/opt/bouffalolab/${pkgname%-bin}"
    rm -rf "${pkgdir}"/opt/bouffalolab/${pkgname%-bin}/*.exe
    rm -rf "${pkgdir}"/opt/bouffalolab/${pkgname%-bin}/*-macos*
    rm -rf "${pkgdir}"/opt/bouffalolab/${pkgname%-bin}/utils/*/*.exe
    rm -rf "${pkgdir}"/opt/bouffalolab/${pkgname%-bin}/utils/*/*.dll
    rm -rf "${pkgdir}"/opt/bouffalolab/${pkgname%-bin}/utils/*/*/*/*.dll
    rm -rf "${pkgdir}"/opt/bouffalolab/${pkgname%-bin}/utils/jlink

    ln -sf /opt/SEGGER/JLink/ "${pkgdir}"/opt/bouffalolab/${pkgname%-bin}/utils/jlink

    # desktop entry
    install -Dm0644 /dev/stdin ${pkgdir}/usr/share/applications/${pkgname%-bin}.desktop <<EOF
[Desktop Entry]
Name=${pkgname%-bin}
Name[zh_CN]=${pkgname%-bin}
Comment=${pkgdesc}
#MimeType=application/x-${pkgname%-bin};
Exec=${pkgname%-bin} %f
Type=Application
Categories=Development;Tool;
Terminal=false
Icon=${pkgname%-bin}.png
Version=1.0
EOF

    install -Dm0644 /dev/stdin ${pkgdir}/usr/share/applications/bflb-iot-tool.desktop <<EOF
[Desktop Entry]
Name=bflb-iot-tool
Name[zh_CN]=bflb-iot-tool
Comment=${pkgdesc}
#MimeType=application/x-bflb-iot-tool;
Exec=bflb-iot-tool %f
Type=Application
Categories=Development;Tool;
Terminal=false
Icon=bflb-iot-tool.png
Version=1.0
EOF

    _path=/opt/bouffalolab/
    install -Dm0755 /dev/stdin "${pkgdir}/usr/bin/${pkgname%-bin}" << EOF
#!/bin/bash
# export LC_CTYPE="zh_CN.UTF-8"

if [ ! -d "$HOME"/.local/share/${pkgname%-bin} ] ; then
    cp -a /${_path}/${pkgname%-bin}/ "$HOME"/.local/share/ || exit 1
    ln -sf  "$HOME"/.local/share/${pkgname%-bin}/BLDevCube-ubuntu "$HOME"/.local/share/${pkgname%-bin}/${pkgname%-bin} || exit 1
fi

/"$HOME"/.local/share/${pkgname%-bin}/${pkgname%-bin} "\$@"
EOF

    install -Dm0755 /dev/stdin "${pkgdir}/usr/bin/bflb-iot-tool" << EOF
#!/bin/bash
# export LC_CTYPE="zh_CN.UTF-8"

if [ ! -d "$HOME"/.local/share/${pkgname%-bin} ] ; then
    cp -a /${_path}/${pkgname%-bin}/ "$HOME"/.local/share/ || exit 1
    ln -sf  "$HOME"/.local/share/${pkgname%-bin}/bflb_iot_tool-ubuntu "$HOME"/.local/share/${pkgname%-bin}/bflb-iot-tool || exit 1
fi

/"$HOME"/.local/share/${pkgname%-bin}/bflb-iot-tool "\$@"
EOF
}