summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bd2ef51637c41e3450ab092c8413db72aefa0ab8 (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
# Maintainer: Chris Sculley <cs.sculley at gmail dot com>
pkgname=idena-desktop-git
pkgver=v0.0.10.r452.gc294f6c9
pkgrel=1
pkgdesc="The idena-desktop application for the Idena network"
arch=("x86_64")
url="https://github.com/idena-network/idena-desktop"
# license=("")
makedepends=("git" "npm")
depends=("electron" "libappindicator-gtk3" "libnotify")
provides=("idena-desktop")
conflicts=("idena-desktop")
source=("$pkgname::git+https://github.com/idena-network/idena-desktop.git"
        "idena-desktop.desktop")
md5sums=("SKIP"
        "cdabc45c6384a61d81b76a6f2d9bdeb2")

pkgver() {
    cd "$srcdir/$pkgname"
    ( set -o pipefail
        git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
        printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
    )
}

build() {
    cd "$srcdir/$pkgname"
    
    # use system electron version
    # see: https://wiki.archlinux.org/index.php/Electron_package_guidelines
    _electronDist=$(dirname $(realpath $(which electron)))
    _electronVer=$(electron --version | tail -c +2)
    _version=`git describe --abbrev=0 --tags | sed -e "s/v//g"`
    echo Building Version: $_version
    sed -i.bak -E "s/\"version\":\ \"[0-9]+\.[0-9]+\.[0-9]+/\"version\":\ \"$_version/g" ./package.json
    HOME="$srcdir/$pkgname/.electron-gyp" npm install --cache "$srcdir/$pkgname/npm-cache"
    npm upgrade
    npm run build && ./node_modules/.bin/electron-builder --linux --publish onTag --x64 --dir -c.electronDist=$_electronDist -c.electronVersion=$_electronVer
}

package() {
    cd "$srcdir/$pkgname"
    
    install -Dm644 main/static/icon-512.png "$pkgdir/usr/share/pixmaps/idena-desktop.png"
   
    mkdir -m755 "$pkgdir"/{opt,usr/bin} 
    cp -a dist/linux-unpacked "$pkgdir/opt/idena-desktop"
    ln -s /opt/idena-desktop/idena-desktop "$pkgdir/usr/bin/idena-desktop"
    
    install -Dm644 "$srcdir/idena-desktop.desktop" -t "$pkgdir/usr/share/applications"
    # install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"
}