blob: 307a405ea0684ee69de294e1872fba460991dd3a (
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
77
78
79
80
81
82
|
# Maintainer: everyx <lunt.luo@gmail.com>
# Contributor: BGME <i@bgme.me>
pkgname=sing-box-git
_pkgname=sing-box
pkgver=1.8.5.r6.gfd705d96
pkgrel=1
pkgdesc='The universal proxy platform (git version).'
arch=('x86_64' 'i686')
url='https://sing-box.sagernet.org/'
license=('GPL3 with name use or association addition')
provides=("$_pkgname")
conflicts=("sing-box" "sing-box-beta")
makedepends=('go')
optdepends=('sing-geosite: sing-geosite database'
'sing-geoip: sing-geoip database')
backup=("etc/$_pkgname/config.json")
source=("$_pkgname::git+https://github.com/SagerNet/sing-box.git#branch=dev-next"
'sing-box.rules')
sha256sums=(SKIP
'1365536e1875043b969e2e18d7313ab7c6f7f9f63387f25506bb04362b44f206')
pkgver() {
cd "$_pkgname"
git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-\([^-]*\)-\([^-]*\)$/.\1.\2/;s/-//'
}
_tags=with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api,with_ech,with_dhcp
build(){
cd "$_pkgname"
export CGO_CPPFLAGS="$CPPFLAGS"
export CGO_CFLAGS="$CFLAGS"
export CGO_CXXFLAGS="$CXXFLAGS"
export CGO_LDFLAGS="$LDFLAGS"
export VERSION=$(go run ./cmd/internal/read_tag)
go build \
-v \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-tags "$_tags" \
-ldflags "
-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\"
-s -w -buildid=
-linkmode=external" \
./cmd/sing-box
sed -i "/^\[Service\]$/a StateDirectory=$_pkgname" release/config/$_pkgname.service
sed -i "/^\[Service\]$/a StateDirectory=$_pkgname-%i" release/config/$_pkgname@.service
sed -i "/^\[Service\]$/a User=$_pkgname" release/config/$_pkgname*.service
echo 'u sing-box - "Sing-box Service" - -' > "release/config/$_pkgname.sysusers"
install -d completions
go run ./cmd/sing-box completion bash > completions/bash
go run ./cmd/sing-box completion fish > completions/fish
go run ./cmd/sing-box completion zsh > completions/zsh
}
package() {
cd "$_pkgname"
install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$_pkgname"
install -Dm755 "$_pkgname" -t "$pkgdir/usr/bin"
install -Dm644 "release/config/config.json" -t "$pkgdir/etc/$_pkgname"
install -Dm644 "release/config/$_pkgname.service" -t "$pkgdir/usr/lib/systemd/system"
install -Dm644 "release/config/$_pkgname@.service" -t "$pkgdir/usr/lib/systemd/system"
install -Dm644 "release/config/$_pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$_pkgname.conf"
install -Dm644 "${srcdir}/sing-box.rules" "$pkgdir/usr/share/polkit-1/rules.d/sing-box.rules"
install -Dm644 completions/bash "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}.bash"
install -Dm644 completions/fish "${pkgdir}/usr/share/fish/vendor_completions.d/${_pkgname}.fish"
install -Dm644 completions/zsh "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
}
|