1 # Copyright 2022 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
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/"
12 https://github.com/v2rayA/v2rayA/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
14 # maintainer generated vendor
15 # generated with https://github.com/liuyujielol/rei-overlay/blob/main/net-proxy/v2rayA/scripts/v2rayA_vendor_gen.sh
17 https://github.com/liuyujielol/vendors/releases/download/${PN}/${P}-yarn_mirror.tar.xz
18 https://github.com/liuyujielol/vendors/releases/download/${PN}/${P}-go-vendor.tar.xz
32 >=net-proxy/v2ray-bin-5
45 mv -v "${WORKDIR}/vendor" "${S}/service" || die
48 # set yarn-offline-mirror to ${WORKDIR}/yarn_offline_mirror
49 echo "yarn-offline-mirror \"${WORKDIR}/yarn_offline_mirror\"" >> "${S}/gui/.yarnrc" || die
51 yarn
install --offline --check-files || die
"yarn offline install failed"
56 ## Fix node build error: https://github.com/webpack/webpack/issues/14532#issuecomment-947012063
57 if has_version
'>=dev-libs/openssl-3'; then
58 export NODE_OPTIONS
=--openssl-legacy-provider
60 OUTPUT_DIR
="${S}/service/server/router/web" yarn build || die
"yarn build failed"
62 for file in $
(find "${S}/service/server/router/web" |
grep -v png |
grep -v index.html|
grep -v .gz
)
64 if [ ! -d $file ]; then
69 cd "${S}/service" || die
70 ego build
-mod vendor
-ldflags "-X github.com/v2rayA/v2rayA/conf.Version=${PV} -s -w" -o v2raya
74 dobin
"${S}"/service
/v2raya
75 # directory for runtime use
78 # generate default config
79 cat <<-EOF > "${S}"/v2raya || die
80 # v2raya config example
81 # Everything has defaults so you only need to uncomment things you want to
84 .
/service
/v2raya
--report config |
sed '1,6d' |
fold -s -w 78 |
sed -E 's/^([^#].+)/# \1/'\
85 >> "${S}"/v2raya || die
87 # config /etc/default/v2raya
88 insinto
"/etc/default"
91 systemd_dounit
"${S}"/install
/universal
/v2raya.service
92 systemd_douserunit
"${S}"/install
/universal
/v2raya-lite.service
94 #thanks to @Universebenzene
95 newinitd
"${FILESDIR}/${PN}.initd" v2raya
96 newinitd
"${FILESDIR}/${PN}-user.initd" v2raya-user
97 newconfd
"${FILESDIR}/${PN}.confd" v2raya
98 newconfd
"${FILESDIR}/${PN}-user.confd" v2raya-user
100 newicon
-s 512 "${S}"/gui
/public
/img
/icons
/android-chrome-512x512.png v2raya.png
101 domenu
"${S}"/install
/universal
/v2raya.desktop
107 if has_version
'<net-proxy/v2rayA-2.0.0' ; then
108 elog
"Starting from net-proxy/v2rayA-2.0.0"
109 elog
"Support for v2ray-4 & xray has been dropped"
110 elog
"A config migration may be required"