OSDN Git Service

6525f43dc714d75dc0c76a17e3ef6fac2e18844f
[immortalwrt/packages.git] / net / v2ray-geodata / Makefile
1 # SPDX-License-Identifier: GPL-3.0-only
2 #
3 # Copyright (C) 2021 ImmortalWrt.org
4
5 include $(TOPDIR)/rules.mk
6
7 PKG_NAME:=v2ray-geodata
8 PKG_RELEASE:=$(AUTORELEASE)
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:=202203100039
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:=7532aadf5bda5e2bc1b9a100662022405f19d61245a27b3ace9a982ca0242bc9
22 endef
23
24 GEOSITE_VER:=20220310015105
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:=c7d9ee11e415ffbd8458e2cb9716eea7a220a3023d1db35d84e47d33b1f4cd72
31 endef
32
33 define Package/v2ray-geodata/template
34   SECTION:=net
35   CATEGORY:=Network
36   SUBMENU:=IP Addresses and Names
37   URL:=https://www.v2fly.org
38   PKGARCH:=all
39 endef
40
41 define Package/v2ray-geoip
42   $(call Package/v2ray-geodata/template)
43   TITLE:=GeoIP List for V2Ray
44   VERSION:=$(GEOIP_VER)-$(PKG_RELEASE)
45   LICENSE:=CC-BY-SA-4.0
46 endef
47
48 define Package/v2ray-geosite
49   $(call Package/v2ray-geodata/template)
50   TITLE:=Geosite List for V2Ray
51   VERSION:=$(GEOSITE_VER)-$(PKG_RELEASE)
52   LICENSE:=MIT
53 endef
54
55 define Build/Prepare
56         $(call Build/Prepare/Default)
57 ifneq ($(CONFIG_PACKAGE_v2ray-geoip),)
58         $(call Download,geoip)
59 endif
60 ifneq ($(CONFIG_PACKAGE_v2ray-geosite),)
61         $(call Download,geosite)
62 endif
63 endef
64
65 define Build/Compile
66 endef
67
68 define Package/v2ray-geoip/install
69         $(INSTALL_DIR) $(1)/usr/share/v2ray
70         $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/v2ray/geoip.dat
71 endef
72
73 define Package/v2ray-geosite/install
74         $(INSTALL_DIR) $(1)/usr/share/v2ray
75         $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/v2ray/geosite.dat
76 endef
77
78 $(eval $(call BuildPackage,v2ray-geoip))
79 $(eval $(call BuildPackage,v2ray-geosite))