Skip to content

Commit

Permalink
feat: fix Makefile to support v5 (#178)
Browse files Browse the repository at this point in the history
change v4 to v5

Co-authored-by: m.asadi <m.asadi@hpds.ir>
  • Loading branch information
MJAsadi72 and m.asadi committed May 13, 2024
1 parent bab1a0c commit dbe0f17
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_domain_socket_trans \
CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_quic_trans

GO_PKG:=github.com/v2fly/v2ray-core/v4
GO_PKG:=github.com/v2fly/v2ray-core/v5
GO_PKG_LDFLAGS:=-s -w
GO_PKG_LDFLAGS_X:= \
github.com/v2fly/v2ray-core/v4.version=$(PKG_VERSION) \
github.com/v2fly/v2ray-core/v4.build=R$(PKG_RELEASE) \
github.com/v2fly/v2ray-core/v4.codename=OpenWrt
github.com/v2fly/v2ray-core/v5.version=$(PKG_VERSION) \
github.com/v2fly/v2ray-core/v5.build=R$(PKG_RELEASE) \
github.com/v2fly/v2ray-core/v5.codename=OpenWrt

include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
Expand Down Expand Up @@ -114,151 +114,151 @@ V2RAY_SED_ARGS:=

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_json_v2ctl),y)
V2RAY_SED_ARGS += \
s,// \(_ "github.com/v2fly/v2ray-core/v4/main/json"\),\1,; \
s,_ "github.com/v2fly/v2ray-core/v4/main/jsonem",// &,;
s,// \(_ "github.com/v2fly/v2ray-core/v5/main/json"\),\1,; \
s,_ "github.com/v2fly/v2ray-core/v5/main/jsonem",// &,;
else ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_json_none),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/main/jsonem",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/main/jsonem",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_custom_features),y)

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_dns),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/app/dns",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/app/dns/fakedns",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/app/dns",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/app/dns/fakedns",// &,;
else ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_fakedns),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/app/dns/fakedns",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/app/dns/fakedns",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_log),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/app/log",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/app/log/command",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/app/log",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/app/log/command",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_tls),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/tls",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/tls",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_udp),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/udp",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/udp",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_policy),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/app/policy",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/app/policy",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_reverse),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/app/reverse",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/app/reverse",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_routing),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/app/router",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/app/router",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_statistics),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/app/stats",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/app/stats/command",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/app/stats",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/app/stats/command",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_blackhole_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/blackhole",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/blackhole",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_dns_proxy),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/dns",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/dns",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_dokodemo_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/dokodemo",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/dokodemo",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_freedom_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/freedom",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/freedom",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_mtproto_proxy),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/mtproto",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/mtproto",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_http_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/http",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/http",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_shadowsocks_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/shadowsocks",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/shadowsocks",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_socks_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/socks",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/socks",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_trojan_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/trojan",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/trojan",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_vmess_proto),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/vmess/inbound",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/proxy/vmess/inbound",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/proxy/vmess/outbound",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_tcp_trans),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/tcp",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/tcp",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_mkcp_trans),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/kcp",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/kcp",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_websocket_trans),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/websocket",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/websocket",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_http2_trans),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/http",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/headers/http",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/http",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/headers/http",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_domain_socket_trans),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/domainsocket",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/domainsocket",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_quic_trans),y)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/quic",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/quic",// &,;
endif

ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_mkcp_trans)$(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_without_quic_trans),yy)
V2RAY_SED_ARGS += \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/headers/noop",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/headers/srtp",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/headers/tls",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/headers/utp",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/headers/wechat",// &,; \
s,_ "github.com/v2fly/v2ray-core/v4/transport/internet/headers/wireguard",// &,;
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/headers/noop",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/headers/srtp",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/headers/tls",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/headers/utp",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/headers/wechat",// &,; \
s,_ "github.com/v2fly/v2ray-core/v5/transport/internet/headers/wireguard",// &,;
endif

endif # custom features
Expand Down Expand Up @@ -302,7 +302,7 @@ endif
endef

define Build/Compile
$(eval GO_PKG_BUILD_PKG:=github.com/v2fly/v2ray-core/v4/main)
$(eval GO_PKG_BUILD_PKG:=github.com/v2fly/v2ray-core/v5/main)
$(call GoPackage/Build/Compile)
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ray

Expand All @@ -311,7 +311,7 @@ ifeq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_compress_upx),y)
endif

ifneq ($(CONFIG_PACKAGE_v2ray_$(BUILD_VARIANT)_exclude_v2ctl),y)
$(eval GO_PKG_BUILD_PKG:=github.com/v2fly/v2ray-core/v4/infra/control/main)
$(eval GO_PKG_BUILD_PKG:=github.com/v2fly/v2ray-core/v5/infra/control/main)
$(call GoPackage/Build/Compile)
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ctl

Expand Down

0 comments on commit dbe0f17

Please sign in to comment.