summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9ab6ad9073e72d38c9ddb3a6d561b54acf40b4b6 (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: irmluity <45vw4yz8g@mozmail.com>

_pkgname=singland
pkgname=$_pkgname-git
pkgver=pre_alpha_4
pkgrel=1
pkgdesc="A GUI for sing-box. The universal proxy platform"
arch=(x86_64)
url='https://github.com/net-breaker/sing-land'
license=('MIT')
depends=('hicolor-icon-theme' 'glib2' 'glibc' 'gcc-libs' 'expat' 'dbus')
makedepends=('git' 'nodejs' 'npm' 'openssl-1.1' 'libxcrypt' 'cryptsetup' 'libxcrypt-compat')
optdepends=(
    'gnome-shell-extension-appindicator: for system tray icon if you are using Gnome'
)
provides=(${_pkgname})
conflicts=(${_pkgname}-bin ${_pkgname})
source=(
    "git+https://github.com/net-breaker/sing-land"
    "https://github.com/SagerNet/sing-box/releases/download/v1.6.0/sing-box-1.6.0-linux-amd64.tar.gz"
    "singland.desktop"
)
sha256sums=(
    "SKIP"
    "ffa107294e7a6b29805e32cc1fa0147a50b0ba8d0722582d457e5e60ac34a052"
    "bedcc8193fcadf9e33c4117bf47fa9e479abd2fc88548571323b26d9b4cbf77a"
)
_install_path="/opt/$_pkgname"

pkgver() {
    cd "$srcdir/sing-land"
    printf "%s" "$(git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/^v//')"
}

prepare() {
    cd "${srcdir}"
    mv sing-box-1.6.0-linux-amd64/sing-box sing-land/controller/resources/sing-box
    cd "${srcdir}/sing-land"
    cd controller
    npm ci
    cd ../editor
    npm ci
    cd ../singland
    sed -i 's/"deb",\|"rpm",//g' electron-builder.json
    npm ci
}

build() {
    cd "${srcdir}/sing-land/singland"
    npm run init-unix
    npm run build
    mv ${srcdir}/sing-land/singland/release/singland-*.tar.gz ${srcdir}/singland.tar.gz
    mkdir ${srcdir}/singland
    tar -xvzf ${srcdir}/singland.tar.gz -C ${srcdir}/singland
}


package() {
    cd "${srcdir}/singland"
    cd $(find . -type d -name 'singland-*' -print -quit)
    find . -type f -exec install -Dm755 {} "$pkgdir/opt/$_pkgname"/{} \;
    install -Dm644 "${srcdir}/singland.desktop" "$pkgdir/usr/share/applications/${_pkgname}.desktop"
    for _icons in 32 256 512;do
        install -Dm644 "${srcdir}/sing-land/singland/icons/logo-${_icons}.png" "${pkgdir}/usr/share/icons/hicolor/${_icons}x${_icons}/apps/${_pkgname}.png"
    done
    install -dm755 "${pkgdir}/usr/bin"
    ln -s "/opt/${_pkgname}/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
    install -Dm644 "$srcdir/sing-land/LICENSE" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}