dev-python/conda-libmamba-solver: bump version to 24.11.1
[gentoo-zh.git] / net-proxy / v2rayA / v2rayA-9999.ebuild
blob9044399fb1b1237c5565030c70b80453f787ea2b
1 # Copyright 2022-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
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
14 LICENSE="AGPL-3"
15 SLOT="0"
16 IUSE="xray"
18 RDEPEND="
19 || (
20 >=net-proxy/v2ray-5
21 >=net-proxy/v2ray-bin-5
23 xray? ( net-proxy/Xray )
25 BDEPEND="
26 >=dev-lang/go-1.21.0:*
27 >=net-libs/nodejs-16
28 sys-apps/yarn
31 src_unpack() {
32 git-r3_src_unpack
34 # requires network
35 cd "${S}/gui" || die
36 #yarn config set registry https://registry.npmmirror.com || die
37 yarn install --ignore-engines --check-files || die "yarn install failed"
39 # requires network
40 cd "${S}/service" || die
41 #ego env -w GOPROXY=https://goproxy.cn,direct
42 ego mod vendor
45 src_compile() {
46 cd "${S}/gui" || die
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
57 src_install() {
58 dobin "${S}"/service/v2raya
59 # directory for runtime use
60 keepdir "/etc/v2raya"
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
82 pkg_postinst() {
83 xdg_pkg_postinst
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"