1+ # Maintainer: Dee.H.Y <dongfengweixiao at hotmail dot com>
2+ # Contributor: Mark Wagie <mark dot wagie at proton dot me>
3+ # This repository is a fork of musicpod-git.
4+ # Before executing makepkg, you can set FVM_CACHE_PATH to $HOME/fvm or the path specified by the cachePath field in the $HOME/.config/fvm/.fvmrc file.
5+
6+ pkgname=flclash
7+ pkgver=0.8.92
8+ pkgrel=1
9+ pkgdesc=" A multi-platform proxy client based on ClashMeta,simple and easy to use, open-source and ad-free."
10+ url=" https://github.com/chen08209/FlClash"
11+ license=(' GPL-3.0-or-later' )
12+ arch=(' x86_64' ' aarch64' )
13+ depends=(
14+ ' gtk3'
15+ ' libayatana-appindicator'
16+ ' libkeybinder3'
17+ )
18+ makedepends=(
19+ ' clang'
20+ ' cmake'
21+ ' fvm'
22+ ' git'
23+ ' lld'
24+ ' llvm'
25+ ' ninja'
26+ ' patchelf'
27+ ' rustup'
28+ ' go'
29+ ' libayatana-appindicator'
30+ ' libkeybinder3'
31+ )
32+
33+ options=(' !lto' )
34+
35+ _pkgsrc=" $pkgname -$pkgver "
36+ _pkgext=" tar.gz"
37+ source=(
38+ " ${pkgname} " ::" git+https://github.com/chen08209/FlClash.git#tag=v$pkgver "
39+ " 0001-fix-build-error.patch"
40+ " com.follow.clash.desktop"
41+ )
42+ sha256sums=(' aaf8c535929ecc642637334799f8396301fbc39a3ea25b2c9a8afdabf4a7e34d'
43+ ' b551c46a1577758c13bdd07868d41e4de817c6184114e1b10d39e04ae572a76a'
44+ ' 0601176d0b5df7aafb3c949417b7f0d98ab17d21b6fcc89c6f83a7e031bbe45d' )
45+
46+ prepare () {
47+ cd " $srcdir /$pkgname "
48+ git submodule update --init --recursive
49+ patch -p1 -i " ${srcdir} /0001-fix-build-error.patch"
50+ }
51+
52+ build () {
53+ export FVM_CACHE_PATH=" $SRCDEST /fvm-cache"
54+
55+ # build core
56+ cd " ${srcdir} /flclash/core"
57+ if [ " $CARCH " == " aarch64" ]; then
58+ export GOARCH=arm64
59+ else
60+ export GOARCH=amd64
61+ fi
62+ export GOOS=linux
63+ export CGO_ENABLED=0
64+ export TAGS=" with_gvisor"
65+ go build -ldflags=" -w -s" -tags=" $TAGS " -o " ../libclash/linux/FlClashCore"
66+
67+ cd " ${srcdir} /flclash"
68+ fvm install 3.35.7
69+ fvm use 3.35.7
70+
71+ fvm flutter --disable-analytics
72+ # fvm flutter pub upgrade --major-versions
73+ fvm flutter --no-version-check pub get
74+ fvm flutter clean && fvm flutter build linux --release --dart-define=APP_ENV=stable
75+ }
76+
77+ package () {
78+ if [ $CARCH == " aarch64" ]; then
79+ FLUTTER_ARCH=arm64
80+ else
81+ FLUTTER_ARCH=x64
82+ fi
83+
84+ cd " ${srcdir} /flclash/build/linux/$FLUTTER_ARCH /release/bundle"
85+
86+ install -Dm755 " FlClash" " $pkgdir /usr/lib/$pkgname /FlClash"
87+ install -Dm755 " FlClashCore" " $pkgdir /usr/lib/$pkgname /FlClashCore"
88+ cp --reflink=auto -r lib/ " $pkgdir /usr/lib/$pkgname /"
89+ cp --reflink=auto -r data/ " $pkgdir /usr/lib/$pkgname /"
90+ # copy libquickjs_c_bridge_plugin.so
91+ cp --reflink=auto " ../plugins/flutter_js/bundle/lib/libquickjs_c_bridge_plugin.so" " $pkgdir /usr/lib/$pkgname /lib/libquickjs_c_bridge_plugin.so"
92+
93+ # runpath
94+ patchelf --set-rpath ' $ORIGIN/lib' " $pkgdir /usr/lib/$pkgname /FlClash"
95+ for i in " $pkgdir /usr/lib/$pkgname /lib" /* .so; do
96+ [ -z " $( patchelf --print-rpath " $i " ) " ] && continue
97+ patchelf --set-rpath ' $ORIGIN' " $i "
98+ done
99+
100+ # symlink
101+ install -dm755 " ${pkgdir} /usr/bin"
102+ ln -sfr " $pkgdir /usr/lib/$pkgname /FlClash" " $pkgdir /usr/bin/${pkgname} "
103+
104+ # icon
105+ install -Dm644 " $srcdir /flclash/assets/images/icon.png" \
106+ " $pkgdir /usr/share/pixmaps/$pkgname .png"
107+
108+ # .desktop file
109+ install -Dm644 " $srcdir /com.follow.clash.desktop" " ${pkgdir} /usr/share/applications/com.follow.clash.desktop"
110+
111+ # license
112+ install -Dm644 " ${srcdir} /flclash/LICENSE" -t " $pkgdir /usr/share/licenses/$pkgname /"
113+ }
0 commit comments