forked from archlinuxcn/repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPKGBUILD
More file actions
140 lines (121 loc) · 4 KB
/
Copy pathPKGBUILD
File metadata and controls
140 lines (121 loc) · 4 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Maintainer: Dee.H.Y <dongfengweixiao at hotmail dot com>
# Contributor: Mark Wagie <mark dot wagie at proton dot me>
# This repository is a fork of musicpod-git.
# 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.
pkgname=flclash
pkgver=0.8.92
pkgrel=1
pkgdesc="A multi-platform proxy client based on ClashMeta,simple and easy to use, open-source and ad-free."
url="https://github.com/chen08209/FlClash"
license=('GPL-3.0-or-later')
arch=('x86_64' 'aarch64')
depends=(
'at-spi2-core'
'cairo'
'fontconfig'
'glib2'
'glibc'
'gtk3'
'libayatana-appindicator'
'libepoxy'
'libgcc'
'libkeybinder3'
'libstdc++'
'pango'
)
makedepends=(
'clang'
'cmake'
'fvm'
'git'
'lld'
'llvm'
'ninja'
'patchelf'
'rustup'
'go'
'libayatana-appindicator'
'libkeybinder3'
)
options=('!lto')
_pkgsrc="$pkgname-$pkgver"
_pkgext="tar.gz"
source=(
"${pkgname}"::"git+https://github.com/chen08209/FlClash.git#tag=v$pkgver"
"0001-fix-build-error.patch"
"com.follow.clash.desktop"
"Clash.Meta::git+https://github.com/chen08209/Clash.Meta.git"
"flutter_distributor::git+https://github.com/chen08209/flutter_distributor.git"
"tray_manager::git+https://github.com/chen08209/tray_manager.git"
)
sha256sums=('aaf8c535929ecc642637334799f8396301fbc39a3ea25b2c9a8afdabf4a7e34d'
'b551c46a1577758c13bdd07868d41e4de817c6184114e1b10d39e04ae572a76a'
'0601176d0b5df7aafb3c949417b7f0d98ab17d21b6fcc89c6f83a7e031bbe45d'
'SKIP'
'SKIP'
'SKIP')
prepare() {
cd "$srcdir/$pkgname"
git submodule init
git config submodule.core.Clash.Meta.url "$srcdir/Clash.Meta"
git config submodule.plugins.flutter_distributor.url "$srcdir/flutter_distributor"
git config submodule.plugins.tray_manager.url "$srcdir/tray_manager"
git -c protocol.file.allow=always submodule update
patch -p1 -i "${srcdir}/0001-fix-build-error.patch"
# go mod download
cd "$srcdir/$pkgname/core"
export GOPATH="${srcdir}"
go mod download -modcacherw
}
build() {
export FVM_CACHE_PATH="$SRCDEST/fvm-cache"
# build core
cd "$srcdir/$pkgname/core"
if [ "$CARCH" == "aarch64" ]; then
export GOARCH=arm64
else
export GOARCH=amd64
fi
export GOOS=linux
export CGO_ENABLED=0
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
export TAGS="with_gvisor"
go build -tags="$TAGS" -o "../libclash/linux/FlClashCore"
cd "${srcdir}/$pkgname"
fvm install 3.35.7
fvm use 3.35.7
fvm flutter --disable-analytics
#fvm flutter pub upgrade --major-versions
fvm flutter --no-version-check pub get
fvm flutter clean && fvm flutter build linux --release --dart-define=APP_ENV=stable
}
package() {
if [ $CARCH == "aarch64" ]; then
FLUTTER_ARCH=arm64
else
FLUTTER_ARCH=x64
fi
cd "${srcdir}/$pkgname/build/linux/$FLUTTER_ARCH/release/bundle"
install -Dm755 "FlClash" "$pkgdir/usr/lib/$pkgname/FlClash"
install -Dm755 "FlClashCore" "$pkgdir/usr/lib/$pkgname/FlClashCore"
cp --reflink=auto -r lib/ "$pkgdir/usr/lib/$pkgname/"
cp --reflink=auto -r data/ "$pkgdir/usr/lib/$pkgname/"
# copy libquickjs_c_bridge_plugin.so
cp --reflink=auto "../plugins/flutter_js/bundle/lib/libquickjs_c_bridge_plugin.so" "$pkgdir/usr/lib/$pkgname/lib/libquickjs_c_bridge_plugin.so"
# runpath
patchelf --set-rpath '$ORIGIN/lib' "$pkgdir/usr/lib/$pkgname/FlClash"
for i in "$pkgdir/usr/lib/$pkgname/lib"/*.so; do
[ -z "$(patchelf --print-rpath "$i")" ] && continue
patchelf --set-rpath '$ORIGIN' "$i"
done
# symlink
install -dm755 "${pkgdir}/usr/bin"
ln -sfr "$pkgdir/usr/lib/$pkgname/FlClash" "$pkgdir/usr/bin/${pkgname}"
# icon
install -Dm644 "$srcdir/$pkgname/assets/images/icon.png" \
"$pkgdir/usr/share/pixmaps/$pkgname.png"
# .desktop file
install -Dm644 "$srcdir/com.follow.clash.desktop" "${pkgdir}/usr/share/applications/com.follow.clash.desktop"
# license
install -Dm644 "${srcdir}/$pkgname/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
}