Merge pull request #22342 from blocktrron/quectel-timesync-20231008
[feed/packages.git] / net / v2ray-geodata / Makefile
1 # SPDX-License-Identifier: GPL-3.0-only
2 #
3 # Copyright (C) 2021-2022 ImmortalWrt.org
4
5 include $(TOPDIR)/rules.mk
6
7 PKG_NAME:=v2ray-geodata
8 PKG_RELEASE:=1
9
10 PKG_LICENSE_FILES:=LICENSE
11 PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
12
13 include $(INCLUDE_DIR)/package.mk
14
15 GEOIP_VER:=202310120354
16 GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
17 define Download/geoip
18 URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
19 URL_FILE:=geoip.dat
20 FILE:=$(GEOIP_FILE)
21 HASH:=7107cfe4e211d4df5234d0d2b1c47bdcd19f6602c2b7969f3a5e12f7cf48692e
22 endef
23
24 GEOSITE_VER:=20231015073627
25 GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
26 define Download/geosite
27 URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
28 URL_FILE:=dlc.dat
29 FILE:=$(GEOSITE_FILE)
30 HASH:=2042c47d520634236fbf238a4168196bea64a2d61ca5e6cbab9fd0ac37c7e659
31 endef
32
33 GEOSITE_IRAN_VER:=202310160024
34 GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER)
35 define Download/geosite-ir
36 URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/
37 URL_FILE:=iran.dat
38 FILE:=$(GEOSITE_IRAN_FILE)
39 HASH:=70db057c5c1d07de251c4543e6c20ff0a352c95977e120d1522a7f826ff08cf2
40 endef
41
42 define Package/v2ray-geodata/template
43 SECTION:=net
44 CATEGORY:=Network
45 SUBMENU:=IP Addresses and Names
46 URL:=https://www.v2fly.org
47 PKGARCH:=all
48 endef
49
50 define Package/v2ray-geoip
51 $(call Package/v2ray-geodata/template)
52 TITLE:=GeoIP List for V2Ray
53 PROVIDES:=v2ray-geodata xray-geodata xray-geoip
54 VERSION:=$(GEOIP_VER)-$(PKG_RELEASE)
55 LICENSE:=CC-BY-SA-4.0
56 endef
57
58 define Package/v2ray-geosite
59 $(call Package/v2ray-geodata/template)
60 TITLE:=Geosite List for V2Ray
61 PROVIDES:=v2ray-geodata xray-geodata xray-geosite
62 VERSION:=$(GEOSITE_VER)-$(PKG_RELEASE)
63 LICENSE:=MIT
64 endef
65
66 define Package/v2ray-geosite-ir
67 $(call Package/v2ray-geodata/template)
68 TITLE:=Iran Geosite List for V2Ray
69 PROVIDES:=xray-geosite-ir
70 VERSION:=$(GEOSITE_IRAN_VER)-$(PKG_RELEASE)
71 LICENSE:=MIT
72 endef
73
74 define Build/Prepare
75 $(call Build/Prepare/Default)
76 ifneq ($(CONFIG_PACKAGE_v2ray-geoip),)
77 $(call Download,geoip)
78 endif
79 ifneq ($(CONFIG_PACKAGE_v2ray-geosite),)
80 $(call Download,geosite)
81 endif
82 ifneq ($(CONFIG_PACKAGE_v2ray-geosite-ir),)
83 $(call Download,geosite-ir)
84 endif
85 endef
86
87 define Build/Compile
88 endef
89
90 define Package/v2ray-geoip/install
91 $(INSTALL_DIR) $(1)/usr/share/v2ray $(1)/usr/share/xray
92 $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/v2ray/geoip.dat
93 $(LN) ../v2ray/geoip.dat $(1)/usr/share/xray/geoip.dat
94 endef
95
96 define Package/v2ray-geosite/install
97 $(INSTALL_DIR) $(1)/usr/share/v2ray $(1)/usr/share/xray
98 $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/v2ray/geosite.dat
99 $(LN) ../v2ray/geosite.dat $(1)/usr/share/xray/geosite.dat
100 endef
101
102 define Package/v2ray-geosite-ir/install
103 $(INSTALL_DIR) $(1)/usr/share/v2ray $(1)/usr/share/xray
104 $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_IRAN_FILE) $(1)/usr/share/v2ray/iran.dat
105 $(LN) ../v2ray/iran.dat $(1)/usr/share/xray/iran.dat
106 endef
107
108 $(eval $(call BuildPackage,v2ray-geoip))
109 $(eval $(call BuildPackage,v2ray-geosite))
110 $(eval $(call BuildPackage,v2ray-geosite-ir))