1 # Copyright 2022-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit systemd go-module desktop xdg git-r3
8 DESCRIPTION
="web GUI of Project V which supports V2Ray, Xray, SS, SSR, Trojan and Pingtunnel"
9 HOMEPAGE
="https://v2raya.org/"
11 EGIT_REPO_URI
="https://github.com/v2rayA/v2rayA.git"
12 EGIT_BRANCH
="main" # HEAD
21 >=net-proxy/v2ray-bin-5
23 xray? ( net-proxy/Xray )
26 >=dev-lang/go-1.21.0:*
36 #yarn config set registry https://registry.npmmirror.com || die
37 yarn
install --ignore-engines --check-files || die
"yarn install failed"
40 cd "${S}/service" || die
41 #ego env -w GOPROXY=https://goproxy.cn,direct
47 ## Fix node build error: https://github.com/webpack/webpack/issues/14532#issuecomment-947012063
48 if has_version
'>=dev-libs/openssl-3'; then
49 export NODE_OPTIONS
=--openssl-legacy-provider
51 OUTPUT_DIR
="${S}/service/server/router/web" yarn build || die
"yarn build failed"
53 cd "${S}/service" || die
54 ego build
-mod vendor
-tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=${PV} -s -w" -o v2raya
58 dobin
"${S}"/service
/v2raya
59 # directory for runtime use
62 .
/service
/v2raya
--report config |
sed '1,6d' |
fold -s -w 78 |
sed -E 's/^([^#].+)/# \1/'\
63 >> "${S}"/install
/universal
/v2raya.default || die
65 # config /etc/default/v2raya
66 insinto
"/etc/default"
67 newins
"${S}"/install
/universal
/v2raya.default v2raya
69 systemd_dounit
"${S}"/install
/universal
/v2raya.service
70 systemd_douserunit
"${S}"/install
/universal
/v2raya-lite.service
72 #thanks to @Universebenzene
73 newinitd
"${FILESDIR}/${PN}.initd" v2raya
74 newinitd
"${FILESDIR}/${PN}-user.initd" v2raya-user
75 newconfd
"${FILESDIR}/${PN}.confd" v2raya
76 newconfd
"${FILESDIR}/${PN}-user.confd" v2raya-user
78 doicon
-s 512 "${S}"/install
/universal
/v2raya.png
79 domenu
"${S}"/install
/universal
/v2raya.desktop
85 if has_version
'<net-proxy/v2rayA-2.0.0' ; then
86 elog
"Starting from net-proxy/v2rayA-2.0.0"
87 elog
"Support for v2ray-4 has been dropped"
88 elog
"A config migration may be required"