summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 67a1b35e5dd1a9acc115c5cc210ad19701c97641 (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
# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
pkgname=tiny-rdm
_pkgname="Tiny RDM"
pkgver=1.2.2
_nodeversion=18
pkgrel=1
pkgdesc="A modern lightweight cross-platform Redis desktop manager"
arch=('any')
url="https://redis.tinycraft.cc/"
_ghurl="https://github.com/tiny-craft/tiny-rdm"
license=('GPL-3.0-only')
conflicts=("${pkgname}")
depends=(
    'gtk3'
    'webkit2gtk'
)
makedepends=(
    'nvm'
    'npm>=9'
    'git'
    'go>=1.22'
    'gcc'
    'cmake'
    'wails'
    'curl'
)
options=(
    '!strip'
)
source=(
    "${pkgname}.git::git+${_ghurl}.git#tag=v${pkgver}"
)
sha256sums=('8378584b6535d3a7d05004fda8e6cd3c55c831ed1b6ffa50771b2ec1ad7283a2')
_ensure_local_nvm() {
    local NVM_DIR="${srcdir}/.nvm"
    source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
    nvm install "${_nodeversion}"
    nvm use "${_nodeversion}"
}
build() {
    _ensure_local_nvm
    cd "${srcdir}/${pkgname}.git"
    HOME="${srcdir}/.electron-gyp"
    export CGO_ENABLED=1
    export GO111MODULE=on
    export GOOS=linux
    export GOCACHE="${srcdir}/go-build"
    export GOMODCACHE="${srcdir}/go/pkg/mod"
    {
        echo -e '\n'  
        #echo 'build_from_source=true'
        echo "cache=${srcdir}/.npm_cache"
    } >> frontend/.npmrc
    if [[ "$(curl -s ipinfo.io/country)" == *"CN"* ]]; then
        {
            echo 'registry=https://registry.npmmirror.com'
            echo 'disturl=https://registry.npmmirror.com/-/binary/node/'
        } >> frontend/.npmrc
        go env -w GOPROXY=https://goproxy.cn,direct
    fi
    export NODE_ENV=development
    wails build -platform linux -o "${pkgname%-git}"
    sed -e "
        s/{{.Info.ProductName}}/${_pkgname}/g
        s/\/usr\/local\/bin\/${pkgname%-git}/${pkgname%-git}/g
        s/{{.Info.Comments}}/${pkgdesc}/g
    " -i "build/linux/${pkgname%-git}_"*/usr/share/applications/"${pkgname%-git}.desktop"
}
package() {
    install -Dm755 "${srcdir}/${pkgname}.git/build/bin/${pkgname}" -t "${pkgdir}/usr/bin"
    install -Dm644 "${srcdir}/${pkgname}.git/build/linux/${pkgname}_"*/usr/share/applications/"${pkgname}.desktop" -t "${pkgdir}/usr/share/applications"
    install -Dm644 "${srcdir}/${pkgname}.git/build/appicon.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
    install -Dm644 "${srcdir}/${pkgname}.git/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}