2023-11-16 12:19:06 +03:00
|
|
|
SHELL = /bin/bash -o pipefail
|
|
|
|
export PATH := $(shell go env GOPATH)/bin:$(PATH)
|
|
|
|
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
BUILD_DIR=$(ROOT_DIR)/.build
|
|
|
|
AZ_DIR=$(ROOT_DIR)/antizapret-pac-generator-light
|
|
|
|
GEOIP_DIR=$(ROOT_DIR)/geoip
|
|
|
|
GEOSITE_DIR=$(ROOT_DIR)/domain-list-community
|
|
|
|
DATA_DIR=$(ROOT_DIR)/data
|
|
|
|
|
|
|
|
.PHONY: all submodules az geoip geosite release
|
|
|
|
|
|
|
|
all: submodules az geoip geosite
|
|
|
|
@echo Done.
|
|
|
|
|
|
|
|
submodules:
|
|
|
|
@git submodule update --init --recursive
|
|
|
|
|
|
|
|
builddir:
|
|
|
|
ifeq (,$(wildcard $(BUILD_DIR)))
|
2023-11-16 12:19:47 +03:00
|
|
|
@mkdir -p $(BUILD_DIR)
|
2023-11-16 12:19:06 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
az: builddir
|
|
|
|
@bash -c 'set -euo pipefail; \
|
|
|
|
cd $(AZ_DIR) && \
|
|
|
|
patch --forward < $(DATA_DIR)/az-cyrillic-idn-fix.patch || true && \
|
|
|
|
./update.sh && \
|
|
|
|
./parse.sh'
|
2023-11-16 12:37:23 +03:00
|
|
|
@echo Antizapret data has been processed.
|
2023-11-16 12:19:06 +03:00
|
|
|
|
|
|
|
geoip: builddir
|
|
|
|
@cat $(DATA_DIR)/geoip-generator-config.json > $(GEOIP_DIR)/config.json
|
|
|
|
@mkdir -p $(GEOIP_DIR)/data
|
|
|
|
@cp $(AZ_DIR)/result/iplist_all.txt $(GEOIP_DIR)/data/ru-blocked-ips-all
|
|
|
|
@cp $(AZ_DIR)/result/iplist_blockedbyip.txt $(GEOIP_DIR)/data/ru-blocked-ips-directblock
|
|
|
|
@cp $(AZ_DIR)/result/iplist_blockedbyip_noid2971.txt $(GEOIP_DIR)/data/ru-blocked-ips-noid2971
|
|
|
|
ifeq (,$(wildcard $(GEOIP_DIR)/geoip-src.dat))
|
2023-11-16 12:37:23 +03:00
|
|
|
@curl -fsSL https://github.com/v2fly/geoip/releases/latest/download/geoip.dat -o $(GEOIP_DIR)/geoip-src.dat
|
2023-11-16 12:19:06 +03:00
|
|
|
endif
|
|
|
|
@cd $(GEOIP_DIR) && go run ./
|
|
|
|
@mv $(GEOIP_DIR)/output/dat/geoip.dat $(BUILD_DIR)/geoip.dat
|
2023-11-16 12:37:23 +03:00
|
|
|
@echo Built fresh geoip.dat
|
2023-11-16 12:19:06 +03:00
|
|
|
|
|
|
|
geosite: builddir
|
|
|
|
@cp $(AZ_DIR)/result/hostlist_zones.txt $(GEOSITE_DIR)/data/category-ru-blocked-zones
|
|
|
|
@cp $(AZ_DIR)/result/hostlist_original.txt $(GEOSITE_DIR)/data/category-ru-blocked-domains
|
|
|
|
@cd $(GEOSITE_DIR) && go run ./ --outputdir=$(BUILD_DIR) --outputname=geosite.dat
|
2023-11-16 12:37:23 +03:00
|
|
|
@echo Built fresh geosite.dat
|
2023-11-16 12:19:06 +03:00
|
|
|
|
|
|
|
VERSION := $(shell date +%Y%m%d%H%M%S)
|
|
|
|
release:
|
|
|
|
@echo Tagging as $(VERSION)
|
|
|
|
@curl -X POST \
|
|
|
|
https://gitea.neur0tx.site/api/v1/repos/xray-addons/geoip-geosite-with-ru-blocklist/tags?token=${GITEA_API_KEY} \
|
|
|
|
-H "Accept: application/json" \
|
|
|
|
-H "Content-Type: application/json" \
|
2023-11-16 12:24:04 +03:00
|
|
|
-d '{"message": "$(VERSION): daily release from ci","tag_name": "$(VERSION)","target": "master"}'
|