net-misc/hoppscotch-bin: bump version to 24.11.0.0
[gentoo-zh.git] / net-proxy / v2rayA / v2rayA-2.2.6.3.ebuild
blob7bffa040c5fb119db9387282520cefee789215b5
1 # Copyright 2022-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
5 NONFATAL_VERIFY=1
6 inherit systemd go-module desktop xdg
8 DESCRIPTION="web GUI of Project V which supports V2Ray, Xray, SS, SSR, Trojan and Pingtunnel"
9 HOMEPAGE="https://v2raya.org/"
11 SRC_URI="
12         https://github.com/v2rayA/v2rayA/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
13         https://github.com/v2rayA/v2rayA/releases/download/v${PV}/web.tar.gz -> ${P}-web.tar.gz
15 # maintainer generated deps pack
16 # generated with liuyujielol/gentoo-go-deps/.github/workflows/generator.yml
17 SRC_URI+="
18         https://github.com/liuyujielol/gentoo-go-deps/releases/download/${P}/${P}-deps.tar.xz
21 LICENSE="AGPL-3"
22 SLOT="0"
23 KEYWORDS="~amd64 ~loong"
24 IUSE="xray"
26 RDEPEND="
27         || (
28                 >=net-proxy/v2ray-5
29                 >=net-proxy/v2ray-bin-5
30         )
31         xray? ( net-proxy/Xray )
33 BDEPEND="
34         >=dev-lang/go-1.21:*
37 src_compile() {
38         mv -v "${WORKDIR}/web" "${S}/service/server/router/web" || die
40         cd "${S}/service" || die
41         ego build -tags "with_gvisor" \
42                 -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=${PV} -s -w" \
43                 -o v2raya -trimpath
46 src_install() {
47         dobin "${S}"/service/v2raya
48         # directory for runtime use
49         keepdir "/etc/v2raya"
51         ./service/v2raya --report config | sed '1,6d' | fold -s -w 78 | sed -E 's/^([^#].+)/# \1/'\
52                 >> "${S}"/install/universal/v2raya.default || die
54         # config /etc/default/v2raya
55         insinto "/etc/default"
56         newins "${S}"/install/universal/v2raya.default v2raya
58         systemd_dounit "${S}"/install/universal/v2raya.service
59         systemd_douserunit "${S}"/install/universal/v2raya-lite.service
61         #thanks to @Universebenzene
62         newinitd "${FILESDIR}/${PN}.initd-r1" v2raya
63         newinitd "${FILESDIR}/${PN}-user.initd" v2raya-user
64         newconfd "${FILESDIR}/${PN}.confd" v2raya
65         newconfd "${FILESDIR}/${PN}-user.confd" v2raya-user
67         doicon -s 512 "${S}"/install/universal/v2raya.png
68         domenu "${S}"/install/universal/v2raya.desktop
71 pkg_postinst() {
72         xdg_pkg_postinst
74         if has_version '<net-proxy/v2rayA-2.0.0' ; then
75                 elog "Starting from net-proxy/v2rayA-2.0.0"
76                 elog "Support for v2ray-4 has been dropped"
77                 elog "A config migration may be required"
78         fi