summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4b89868cf4bb5e36684f21617e0e0e8e14c8e2fe (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
# Maintainer: pragerabez

pkgname=mbed-studio-bin
_archivename=MbedStudio
_binname=${pkgname%%-bin}
DOMAIN="https://studio.mbed.com"
ARCHIVE_PATH="/installers/release-1.4.1/1.4.1.5e7b50c6/linux/MbedStudio.tar.gz"
pkgver=1.4.1
pkgrel=11
pkgdesc="free IDE and toolchain for Mbed OS 5 application and library development"
arch=('x86_64')
url="https://os.mbed.com/studio/"
license=('COMMERCIAL')
depends=('ncurses5-compat-libs' 'gnome-keyring')
provides=('mbed-studio')
options=(!strip)
source=("$DOMAIN$ARCHIVE_PATH"
"$pkgname.sh"
"$pkgname.install")

package() {
	cd "$srcdir"
	msg2 "Extracting..."
	
	INSTALL_PATH="$pkgdir/usr/share/$pkgname"
    TOOLS_PATH="$INSTALL_PATH/mbed-studio-tools"
    LAUNCHER_PATH="$pkgdir/usr/share/applications"
    ICON_PATH_PREFIX="$pkgdir/usr/share/icons/hicolor"
    BIN_PATH="$INSTALL_PATH/bin"
    #EXEC_PATH contain a modified bash file checks if mbed-studio-tools exist in user .config before running mbed-studio else symlink
    EXEC_PATH="$pkgdir/usr/bin/$pkgname"
    
    # move the tools where needed
    mkdir -p "$INSTALL_PATH"
    cp -r "$_archivename/$_binname-tools" "$INSTALL_PATH"
    chmod -R 755 "$TOOLS_PATH/ac6"
    
    # copy tools.json where needed
    install -D "$_archivename/tools.json" "$TOOLS_PATH/tools.json"
    
    # move the application where needed
    install -D "$_archivename/$_binname" "$INSTALL_PATH/$_binname"
    
    # move bash runfile (custom) where needed
    install -D "$pkgname.sh" "$pkgdir/usr/bin/$pkgname"

    # add icons
    ICO_SIZES=(16 24 32 48 64 96 128 256 512 1024)
    for SIZE in "${ICO_SIZES[@]}"
    do
        ICON_PATH="$ICON_PATH_PREFIX/${SIZE}x${SIZE}/apps"
        mkdir -p "$ICON_PATH"
        FILENAME1="icons/icon_${SIZE}x${SIZE}.png"
        if [ -f $_archivename/$FILENAME1 ]; then
            install -D "$_archivename/$FILENAME1" "$ICON_PATH/$_binname.png"
        else
            FILENAME2="icons/icon_${SIZE}.png"
            if [ -f $_archivename/$FILENAME2 ]; then
            install -D "$_archivename/$FILENAME2" "$ICON_PATH/$_binname.png"
            fi
        fi
    done

    # create a launcher
    ICON_PATH_PREFIX="/usr/share/icons/hicolor"
    ICON_PATH="$ICON_PATH_PREFIX/256x256/apps/$_binname.png"
    install -d "$LAUNCHER_PATH"
    sed -e "s,\\\$bin_path\\\$,/usr/bin/$pkgname,g" -e "s,\\\$icon_path\\\$,${ICON_PATH},g" $_archivename/$_binname.desktop.template > "$LAUNCHER_PATH/$_binname.desktop"

    # udev rules (https://github.com/mbedmicro/pyOCD/tree/master/udev)
    # copy udev rules
    mkdir -p "$pkgdir/etc/udev/rules.d/"
    cp $_archivename/pyocd-udev-rules/*.rules "$pkgdir/etc/udev/rules.d/"
	chmod +x "$INSTALL_PATH/$_binname"
	chmod +x "$EXEC_PATH"
}

md5sums=('72490f27c95ba023f969114bd80be5af'
         'ba5f16b0d7eeef5b124cd68078a38672'
         '7cf4ae1f6777f0c610125a59b0fefca6')