lede/package/lean/v2ray/Makefile
bc li bd31b9e86b Add V2Ray configuration in menuconfig.
只选择v2ray主程序的话压缩后占用体积将可以降到4M以下。
另外测试了裁剪后的v2ray,发现如果只裁掉如ss等协议的话减重效果并不好。。
裁掉tls+wss或是kcp倒是能省下一部分空间,但就没什么意思了。。所以还是上软路由吧(
2018-03-18 05:10:17 +08:00

107 lines
2.9 KiB
Makefile

#
# Copyright (C) 2015-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=v2ray
PKG_VERSION:=v3.12
#PKG_VERSION:=$(shell wget https://api.github.com/repos/v2ray/v2ray-core/releases/latest -q -O -|grep tag_name|awk {'print $2'}|cut -d '"' -f 2)
#PKG_RELEASE:=$(shell wget https://api.github.com/repos/v2ray/v2ray-core/releases/latest -q -O -|grep published_at|awk {'print $2'}|cut -d '"' -f 2|cut -d 'T' -f 1)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
ifeq ($(ARCH),x86_64)
PKG_ARCH_V2RAY:=linux-64
endif
ifeq ($(ARCH),mipsel)
PKG_ARCH_V2RAY:=linux-mipsle
endif
ifeq ($(ARCH),mips)
PKG_ARCH_V2RAY:=linux-mips
endif
ifeq ($(ARCH),i386)
PKG_ARCH_V2RAY:=linux-32
endif
ifeq ($(ARCH),arm)
PKG_ARCH_V2RAY:=linux-arm
endif
ifeq ($(ARCH),aarch64)
PKG_ARCH_V2RAY:=linux-arm64
endif
#PKG_SOURCE:=v2ray-$(PKG_ARCH_V2RAY).zip
#PKG_SOURCE_URL:=https://github.com/v2ray/v2ray-core/releases/download/$(PKG_VERSION)
#PKG_SOURCE_SUBDIR:=v2ray-$(PKG_VERSION)-$(V2RAY_PKG_ARCH)
#PKG_CAT:=unzip
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
TITLE:=V2Ray is a cross-platform proxy software
DEPENDS:=
URL:=https://github.com/v2ray/v2ray-core
endef
define Package/$(PKG_NAME)/config
menu "V2Ray Configuration"
depends on PACKAGE_v2ray
config PACKAGE_V2RAY_INCLUDE_V2RAY
bool "Include v2ray"
default y
config PACKAGE_V2RAY_INCLUDE_V2CTL
bool "Include v2ctl"
depends on PACKAGE_V2RAY_INCLUDE_V2RAY
default y
config PACKAGE_V2RAY_INCLUDE_GEOIP
bool "Include geoip.dat"
depends on PACKAGE_V2RAY_INCLUDE_V2CTL
default n
config PACKAGE_V2RAY_INCLUDE_GEOSITE
bool "Include geosite.dat"
depends on PACKAGE_V2RAY_INCLUDE_V2CTL
default n
endmenu
endef
define Package/$(PKG_NAME)/description
V2Ray is a cross-platform proxy software
endef
define Build/Prepare
wget https://github.com/v2ray/v2ray-core/releases/download/$(PKG_VERSION)/v2ray-$(PKG_ARCH_V2RAY).zip -O $(PKG_BUILD_DIR)/v2ray-$(PKG_VERSION)-$(PKG_ARCH_V2RAY).zip
unzip -o $(PKG_BUILD_DIR)/v2ray-$(PKG_VERSION)-$(PKG_ARCH_V2RAY).zip -d $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin/v2ray
ifdef CONFIG_PACKAGE_V2RAY_INCLUDE_V2RAY
$(INSTALL_BIN) $(PKG_BUILD_DIR)/v2ray-$(PKG_VERSION)-$(PKG_ARCH_V2RAY)/v2ray $(1)/usr/bin/v2ray/
endif
ifdef CONFIG_PACKAGE_V2RAY_INCLUDE_V2CTL
$(INSTALL_BIN) $(PKG_BUILD_DIR)/v2ray-$(PKG_VERSION)-$(PKG_ARCH_V2RAY)/v2ctl $(1)/usr/bin/v2ray/
endif
ifdef CONFIG_PACKAGE_V2RAY_INCLUDE_GEOIP
$(INSTALL_BIN) $(PKG_BUILD_DIR)/v2ray-$(PKG_VERSION)-$(PKG_ARCH_V2RAY)/geoip.dat $(1)/usr/bin/v2ray/
endif
ifdef CONFIG_PACKAGE_V2RAY_INCLUDE_GEOSITE
$(INSTALL_BIN) $(PKG_BUILD_DIR)/v2ray-$(PKG_VERSION)-$(PKG_ARCH_V2RAY)/geosite.dat $(1)/usr/bin/v2ray/
endif
endef
$(eval $(call BuildPackage,$(PKG_NAME)))