From b4b1b023837c88c5a9c0b5a3346aaa760c86df2f Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Thu, 17 Feb 2022 18:26:42 +0900 Subject: [PATCH] new package: v2ray --- packages/v2ray/build.sh | 19 +++++++++++++++++++ .../v2ray/common-platform-others.go.patch | 15 +++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 packages/v2ray/build.sh create mode 100644 packages/v2ray/common-platform-others.go.patch diff --git a/packages/v2ray/build.sh b/packages/v2ray/build.sh new file mode 100644 index 000000000..05a77b364 --- /dev/null +++ b/packages/v2ray/build.sh @@ -0,0 +1,19 @@ +TERMUX_PKG_HOMEPAGE=https://www.v2fly.org/ +TERMUX_PKG_DESCRIPTION="A platform for building proxies to bypass network restrictions" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=5.0.3 +TERMUX_PKG_SRCURL=https://github.com/v2fly/v2ray-core.git +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_make() { + termux_setup_golang + go mod init || : + go mod tidy + go build -o v2ray ./main +} + +termux_step_make_install() { + install -Dm700 -t $TERMUX_PREFIX/bin v2ray + install -Dm600 -t $TERMUX_PREFIX/share/v2ray release/config/*.json +} diff --git a/packages/v2ray/common-platform-others.go.patch b/packages/v2ray/common-platform-others.go.patch new file mode 100644 index 000000000..710b5fd97 --- /dev/null +++ b/packages/v2ray/common-platform-others.go.patch @@ -0,0 +1,15 @@ +--- a/common/platform/others.go ++++ b/common/platform/others.go +@@ -31,9 +31,9 @@ + defPath := filepath.Join(assetPath, file) + for _, p := range []string{ + defPath, +- filepath.Join("/usr/local/share/v2ray/", file), +- filepath.Join("/usr/share/v2ray/", file), +- filepath.Join("/opt/share/v2ray/", file), ++ filepath.Join("@TERMUX_PREFIX@/local/share/v2ray/", file), ++ filepath.Join("@TERMUX_PREFIX@/share/v2ray/", file), ++ filepath.Join("@TERMUX_PREFIX@/opt/v2ray/share/", file), + } { + if _, err := os.Stat(p); err != nil && errors.Is(err, fs.ErrNotExist) { + continue