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

_pkgname=hiddify.next
pkgname=$_pkgname-git
pkgver=0.10.9.dev
pkgrel=1
pkgdesc="A multi-platform proxy app. Auto, SSH, VLESS, Vmess, Trojan, Reality, Sing-Box, Clash, Xray, Shadowsocks"
arch=(x86_64)
url='https://github.com/hiddify/hiddify-next'
license=('CCPL')
depends=('hicolor-icon-theme' 'zlib' 'glibc' 'fuse2')
makedepends=('git' 'mesa' 'cmake' 'clang' 'locate' 'ninja' 'pkg-config' 'gtk3' 'glib2' 'libayatana-appindicator' 'libayatana-indicator' 'libayatana-common' 'libappindicator-gtk3' 'libappindicator-gtk2' 'fuse3' 'appstream' 'appstream-glib' 'appstream-generator' 'archlinux-appstream-data' 'zsync' 'appimagetool')
optdepends=(
    'gnome-shell-extension-appindicator: for system tray icon if you are using Gnome'
)
provides=(${_pkgname})
conflicts=(${_pkgname} ${_pkgname}-bin)
options=(!strip)
source=(
    "git+https://github.com/hiddify/hiddify-next.git"
    "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.13.9-stable.tar.xz"
)
sha256sums=(
    "SKIP"
    "b6bc6f93423488c67110e0fe56523cd2260f3a4c379ed015cd1c7fab66362739"
)
_install_path="/opt/$_pkgname"

pkgver() {
    cd "$srcdir/hiddify-next"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    export PATH="$PATH:${srcdir}/flutter/bin"
    cd "${srcdir}/hiddify-next"
    flutter precache
    dart pub global activate flutter_distributor
    export PATH="$PATH":"$HOME/.pub-cache/bin"
    export CHANNEL=prod
    flutter config --no-analytics
    flutter config --enable-linux-desktop
    flutter pub get
    sed -i 's/-Werror/-Wno-error -Wno-deprecated-declarations/g' linux/CMakeLists.txt
}

build() {
    cd "${srcdir}/hiddify-next"
    make get-geo-assets
    make get
    make translate
    make gen
    make linux-libs
    unset SOURCE_DATE_EPOCH
    make linux-release
    ls -R dist/
    mkdir tmp_out
    EXT="AppImage"
    mv dist/*/*.$EXT tmp_out/hiddify-linux-x64.$EXT
    chmod a+x tmp_out/hiddify-linux-x64.$EXT
    cd tmp_out
    ./hiddify-linux-x64.AppImage --appimage-extract > /dev/null
    sed -i 's/Exec=/Exec=env /' "./squashfs-root/hiddify.desktop"
    sed -i 's/hiddify/hiddify.next/g' "./squashfs-root/hiddify.desktop"
}


package() {
    install -Dm755 "${srcdir}/hiddify-next/tmp_out/hiddify-linux-x64.AppImage" "${pkgdir}/${_install_path}/${_pkgname}.AppImage"
    install -Dm644 "${srcdir}/hiddify-next/tmp_out/squashfs-root/hiddify.desktop" "$pkgdir/usr/share/applications/${_pkgname}.desktop"
    for _icons in 128x128 256x256;do
        install -Dm644 "${srcdir}/hiddify-next/tmp_out/squashfs-root/usr/share/icons/hicolor/${_icons}/apps/hiddify.png" "${pkgdir}/usr/share/icons/hicolor/${_icons}/apps/${_pkgname}.png"
    done
    install -dm755 "${pkgdir}/usr/bin"
    ln -s "/opt/${_pkgname}/${_pkgname}.AppImage" "${pkgdir}/usr/bin/${_pkgname}"
}