app-shells/zfe: add nvchecker
[gentoo-zh.git] / net-proxy / sing-box / sing-box-1.9.7.ebuild
blobbd3c2f903536b883858bd6bb090e87432323d815
1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit go-module systemd
8 _PV="${PV/_/-}"
9 _PV="${_PV/alpha/alpha.}"
10 _PV="${_PV/beta/beta.}"
11 _PV="${_PV/rc/rc.}"
13 DESCRIPTION="The universal proxy platform."
14 HOMEPAGE="https://sing-box.sagernet.org/ https://github.com/SagerNet/sing-box"
15 SRC_URI="
16 https://github.com/SagerNet/sing-box/archive/refs/tags/v${_PV}.tar.gz -> ${P}.tar.gz
17 tor? ( https://github.com/Puqns67/gentoo-deps/releases/download/${P}/${P}-deps.tar.xz )
18 !tor? ( https://github.com/Puqns67/gentoo-deps/releases/download/${P}/${P}-vendor.tar.xz )
21 S="${WORKDIR}/${PN}-${_PV}"
23 LICENSE="GPL-3+"
24 SLOT="0"
25 KEYWORDS="~amd64 ~riscv"
27 IUSE="+quic grpc +dhcp +wireguard +ech +utls +reality +acme +clash-api v2ray-api +gvisor tor"
29 BDEPEND="
30 >=dev-lang/go-1.18
31 quic? ( >=dev-lang/go-1.20 )
32 utls? ( >=dev-lang/go-1.20 )
33 ech? ( >=dev-lang/go-1.21 )
36 src_compile() {
37 if use quic; then _TAGS+="with_quic,"; fi
38 if use grpc; then _TAGS+="with_grpc,"; fi
39 if use dhcp; then _TAGS+="with_dhcp,"; fi
40 if use wireguard; then _TAGS+="with_wireguard,"; fi
41 if use ech; then _TAGS+="with_ech,"; fi
42 if use utls; then _TAGS+="with_utls,"; fi
43 if use reality; then _TAGS+="with_reality_server,"; fi
44 if use acme; then _TAGS+="with_acme,"; fi
45 if use clash-api; then _TAGS+="with_clash_api,"; fi
46 if use v2ray-api; then _TAGS+="with_v2ray_api,"; fi
47 if use gvisor; then _TAGS+="with_gvisor,"; fi
48 if use tor; then _TAGS+="with_embedded_tor,"; fi
49 _TAGS="${_TAGS%,}"
51 ego build -o sing-box -trimpath -tags "${_TAGS}" \
52 -ldflags "-s -w -X 'github.com/sagernet/sing-box/constant.Version=${PV}'" \
53 ./cmd/sing-box
56 src_install() {
57 dobin sing-box
58 insinto /etc/sing-box
59 newins release/config/config.json config.json.example
60 systemd_dounit release/config/sing-box{,@}.service