1 # Copyright 2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit go-module systemd
9 _PV
="${_PV/alpha/alpha.}"
10 _PV
="${_PV/beta/beta.}"
13 DESCRIPTION
="The universal proxy platform."
14 HOMEPAGE
="https://sing-box.sagernet.org/ https://github.com/SagerNet/sing-box"
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}"
25 KEYWORDS
="~amd64 ~riscv"
27 IUSE
="+quic grpc +dhcp +wireguard +ech +utls +reality +acme +clash-api v2ray-api +gvisor tor"
31 quic? ( >=dev-lang/go-1.20 )
32 utls? ( >=dev-lang/go-1.20 )
33 ech? ( >=dev-lang/go-1.21 )
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
51 ego build
-o sing-box
-trimpath -tags "${_TAGS}" \
52 -ldflags "-s -w -X 'github.com/sagernet/sing-box/constant.Version=${PV}'" \
59 newins release
/config
/config.json config.json.example
60 systemd_dounit release
/config
/sing-box
{,@
}.service