From 4d900b2a1de62c7d3d9d0371861db269f12b0d47 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 8 Sep 2022 09:54:40 +0800 Subject: [PATCH] v2ray-geodata: split from xray-geodata This can be used for v2ray, Xray, v2rayA and some other projects, make it generic. Signed-off-by: Tianling Shen (cherry picked from commit 975153f93da132e545353d90ff3eb76b16ed0938) [rebased into 22.03 branch] Signed-off-by: Tianling Shen --- net/v2ray-geodata/Makefile | 83 ++++++++++++++++++++++++++++++++++++++ net/xray-core/Makefile | 33 --------------- 2 files changed, 83 insertions(+), 33 deletions(-) create mode 100644 net/v2ray-geodata/Makefile diff --git a/net/v2ray-geodata/Makefile b/net/v2ray-geodata/Makefile new file mode 100644 index 0000000000..76ea33b519 --- /dev/null +++ b/net/v2ray-geodata/Makefile @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021-2022 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=v2ray-geodata +PKG_RELEASE:=$(AUTORELEASE) + +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +include $(INCLUDE_DIR)/package.mk + +GEOIP_VER:=202209170841 +GEOIP_FILE:=geoip.dat.$(GEOIP_VER) +define Download/geoip + URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/ + URL_FILE:=geoip.dat + FILE:=$(GEOIP_FILE) + HASH:=ceb0cfdf0fab39141e807fe7bb8a0972c6b3f616abcd1097ac30c26368f368a5 +endef + +GEOSITE_VER:=20220918140014 +GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER) +define Download/geosite + URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/ + URL_FILE:=dlc.dat + FILE:=$(GEOSITE_FILE) + HASH:=8a69b68f02d422ab05f351772c871f367bf387fa78dc37c4f8c1e421a13540a6 +endef + +define Package/v2ray-geodata/template + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + URL:=https://www.v2fly.org + PKGARCH:=all +endef + +define Package/v2ray-geoip + $(call Package/v2ray-geodata/template) + TITLE:=GeoIP List for V2Ray + PROVIDES:=v2ray-geodata xray-geodata xray-geoip + VERSION:=$(GEOIP_VER)-$(PKG_RELEASE) + LICENSE:=CC-BY-SA-4.0 +endef + +define Package/v2ray-geosite + $(call Package/v2ray-geodata/template) + TITLE:=Geosite List for V2Ray + PROVIDES:=v2ray-geodata xray-geodata xray-geosite + VERSION:=$(GEOSITE_VER)-$(PKG_RELEASE) + LICENSE:=MIT +endef + +define Build/Prepare + $(call Build/Prepare/Default) +ifneq ($(CONFIG_PACKAGE_v2ray-geoip),) + $(call Download,geoip) +endif +ifneq ($(CONFIG_PACKAGE_v2ray-geosite),) + $(call Download,geosite) +endif +endef + +define Build/Compile +endef + +define Package/v2ray-geoip/install + $(INSTALL_DIR) $(1)/usr/share/v2ray $(1)/usr/share/xray + $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/v2ray/geoip.dat + $(LN) ../v2ray/geoip.dat $(1)/usr/share/xray/geoip.dat +endef + +define Package/v2ray-geosite/install + $(INSTALL_DIR) $(1)/usr/share/v2ray $(1)/usr/share/xray + $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/v2ray/geosite.dat + $(LN) ../v2ray/geosite.dat $(1)/usr/share/xray/geosite.dat +endef + +$(eval $(call BuildPackage,v2ray-geoip)) +$(eval $(call BuildPackage,v2ray-geosite)) diff --git a/net/xray-core/Makefile b/net/xray-core/Makefile index f17ada5ac4..cbfa899c2c 100644 --- a/net/xray-core/Makefile +++ b/net/xray-core/Makefile @@ -78,32 +78,6 @@ define Package/xray-core/conffiles /etc/config/xray endef -GEOIP_VER:=202209170841 -GEOIP_FILE:=geoip.dat.$(GEOIP_VER) -define Download/geoip - URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/ - URL_FILE:=geoip.dat - FILE:=$(GEOIP_FILE) - HASH:=ceb0cfdf0fab39141e807fe7bb8a0972c6b3f616abcd1097ac30c26368f368a5 -endef - -GEOSITE_VER:=20220918140014 -GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER) -define Download/geosite - URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/ - URL_FILE:=dlc.dat - FILE:=$(GEOSITE_FILE) - HASH:=8a69b68f02d422ab05f351772c871f367bf387fa78dc37c4f8c1e421a13540a6 -endef - -define Build/Prepare - $(call Build/Prepare/Default) -ifneq ($(CONFIG_PACKAGE_xray-geodata),) - $(call Download,geoip) - $(call Download,geosite) -endif -endef - define Package/xray-core/install $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR)) $(INSTALL_DIR) $(1)/usr/bin/ @@ -124,12 +98,5 @@ define Package/xray-example/install $(INSTALL_DATA) $(CURDIR)/files/vpoint_vmess_freedom.json $(1)/etc/xray/ endef -define Package/xray-geodata/install - $(INSTALL_DIR) $(1)/usr/share/xray/ - $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat - $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/xray/geosite.dat -endef - $(eval $(call BuildPackage,xray-core)) $(eval $(call BuildPackage,xray-example)) -$(eval $(call BuildPackage,xray-geodata)) -- 2.30.2