summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6842924bfd7d5d440b099aca195c0e45b9225573 (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
# Maintainer: Caleb Maclennan <caleb@alerque.com>

pkgname=ezra-project-git
pkgver=0.11.1.r93.g93f5777
pkgrel=5
pkgdesc='Bible study tool focussing on topical study based on keywords/tags'
arch=('x86_64')
url="https://github.com/tobias-klein/${pkgname%-git}"
license=('GPL3')
depends=('electron'
         'icu'
         'nodejs'
         'nodejs-addon-api'
         'nodejs-sword-interface')
makedepends=('gendesk'
             'git'
             'jq'
             'moreutils'
             'node-gyp'
             'node-prune'
             'nodejs-pug-cli'
             'npm')
provides=("${pkgname%-git}")
conflicts=(${provides[@]})
source=("git+$url.git"
        'ezra-project.sh')
sha256sums=('SKIP'
            '0a36167bce248b6082045163cf60b143d02ca1e447a791cf0c88e960a7fdc618')

pkgver() {
    cd "${pkgname%-git}"
    git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    # TODO: use of gendesk will probably be obsolete in the next release, see:
    # https://github.com/tobias-klein/ezra-project/pull/25
    gendesk -f -n \
        --name "Ezra Project" \
        --categories="Education;Spirituality;DataVisualization;Literature" \
        --genericname="Bible Study Tool"
    cd "${pkgname%-git}"
    jq 'del(.dependencies["node-addon-api", "node-sword-interface"], .devDependencies["electron", "electron-osx-sign", "node-abi", "node-gyp", "pug-cli", "sequelize-cli"])' package.json |
        sponge package.json
}

build() {
    cd "${pkgname%-git}"
    local _electron="$(electron --version | sed 's/^v//')"
    npm install --cache "$srcdir/npm-cache" --no-audit --no-fund
    npx electron-rebuild --version="$_electron"
    node-prune node_modules
    npx electron-packager ./ ${pkgname%-git} --electron-version="$_electron"
    ./build_scripts/purge_build_artifacts.sh
    npx electron-packager ./ "${pkgname%-git}" \
        --electron-version="$_electron" \
        --overwrite \
        --asar \
        --platform=linux \
        --arch=x64
}

package() {
    cd "${pkgname%-git}"
    install -Dm755 "../${pkgname%-git}.sh" "$pkgdir/usr/bin/${pkgname%-git}"
    install -Dm644 -t "$pkgdir/usr/share/applications/" "$srcdir/${pkgname%-git}.desktop"
    install -Dm644 -t "$pkgdir/usr/lib/${pkgname%-git}/resources/" "${pkgname%-git}-linux-x64/resources/app.asar"
    install -Dm644 -t "$pkgdir/usr/share/licences/${pkgname%-git}/" LICENSE
}