# Copyright 2022-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 NONFATAL_VERIFY=1 inherit systemd go-module desktop xdg DESCRIPTION="web GUI of Project V which supports V2Ray, Xray, SS, SSR, Trojan and Pingtunnel" HOMEPAGE="https://v2raya.org/" SRC_URI=" https://github.com/v2rayA/v2rayA/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz https://github.com/v2rayA/v2rayA/releases/download/v${PV}/web.tar.gz -> ${P}-web.tar.gz " # maintainer generated deps packs # generated with gentoo-zh/gentoo-deps/.github/workflows/generator.yml SRC_URI+=" https://github.com/gentoo-zh/gentoo-deps/releases/download/${P}/${P}-deps.tar.xz https://github.com/gentoo-zh/gentoo-deps/releases/download/v2rayA-core-${PV}/v2rayA-core-${PV}-vendor.tar.xz " LICENSE="AGPL-3" SLOT="0" KEYWORDS="~amd64" RDEPEND=" app-alternatives/v2ray-geoip app-alternatives/v2ray-geosite " BDEPEND=" >=dev-lang/go-1.26:* " src_compile() { mv -v "${WORKDIR}/web" "${S}/service/server/router/web" || die # build v2raya service cd "${S}/service" || die ego build -tags "with_gvisor" \ -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=${PV}" \ -o v2raya -trimpath # build v2raya_core from bundled core/ (xray-core fork) cd "${S}/core" || die ego build -mod vendor -trimpath \ -ldflags "-X main.Version=${PV} -s -w" \ -o v2raya_core ./main } src_install() { dobin "${S}"/service/v2raya dobin "${S}"/core/v2raya_core # symlink geoip/geosite dat files for both: # - v2raya_core (xray-core): looks in /usr/share/xray/ # - v2rayA service (XDG data): looks in /usr/share/v2raya/ # actual files are in /usr/share/v2ray/ (provided by app-alternatives) dosym -r /usr/share/v2ray/geoip.dat /usr/share/xray/geoip.dat dosym -r /usr/share/v2ray/geosite.dat /usr/share/xray/geosite.dat dosym -r /usr/share/v2ray/geoip.dat /usr/share/v2raya/geoip.dat dosym -r /usr/share/v2ray/geosite.dat /usr/share/v2raya/geosite.dat # directory for runtime use keepdir "/etc/v2raya" ./service/v2raya --report config | sed '1,6d' | fold -s -w 78 | sed -E 's/^([^#].+)/# \1/'\ >> "${S}"/install/universal/v2raya.default || die # config /etc/default/v2raya insinto "/etc/default" newins "${S}"/install/universal/v2raya.default v2raya systemd_dounit "${S}"/install/universal/v2raya.service systemd_douserunit "${S}"/install/universal/v2raya-lite.service #thanks to @Universebenzene newinitd "${FILESDIR}/${PN}.initd-r1" v2raya newinitd "${FILESDIR}/${PN}-user.initd" v2raya-user newconfd "${FILESDIR}/${PN}.confd" v2raya newconfd "${FILESDIR}/${PN}-user.confd" v2raya-user doicon -s 512 "${S}"/install/universal/v2raya.png domenu "${S}"/install/universal/v2raya.desktop } pkg_postinst() { xdg_pkg_postinst if has_version '