OSDN Git Service

dnsproxy: update to 0.40.6
[immortalwrt/packages.git] / net / dnsproxy / 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:=dnsproxy
8 PKG_VERSION:=0.40.6
9 PKG_RELEASE:=$(AUTORELESE)
10
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_SOURCE_URL:=https://codeload.github.com/AdguardTeam/dnsproxy/tar.gz/v$(PKG_VERSION)?
13 PKG_HASH:=6e4da43913169af5a97ecf3e524ac98a419482c7c49768aeb18072de384a6fb5
14
15 PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
16 PKG_LICENSE:=Apache-2.0
17 PKG_LICENSE_FILES:=LICENSE
18
19 PKG_CONFIG_DEPENDS:= \
20         CONFIG_DNSPROXY_COMPRESS_GOPROXY \
21         CONFIG_DNSPROXY_COMPRESS_UPX
22
23 PKG_BUILD_DEPENDS:=golang/host
24 PKG_BUILD_PARALLEL:=1
25 PKG_USE_MIPS16:=0
26
27 GO_PKG:=github.com/AdguardTeam/dnsproxy
28 GO_PKG_LDFLAGS:=-s -w
29 GO_PKG_LDFLAGS_X:=main.VersionString=v$(PKG_VERSION)
30
31 include $(INCLUDE_DIR)/package.mk
32 include ../../lang/golang/golang-package.mk
33
34 define Package/dnsproxy/config
35 config DNSPROXY_COMPRESS_GOPROXY
36         bool "Compiling with GOPROXY proxy"
37         default n
38
39 config DNSPROXY_COMPRESS_UPX
40         bool "Compress executable files with UPX"
41         depends on !mips64
42         default n
43 endef
44
45 ifeq ($(CONFIG_DNSPROXY_COMPRESS_GOPROXY),y)
46         export GO111MODULE=on
47         export GOPROXY=https://goproxy.bj.bcebos.com
48 endif
49
50 define Package/dnsproxy
51   SECTION:=net
52   CATEGORY:=Network
53   SUBMENU:=IP Addresses and Names
54   TITLE:=Simple DNS proxy with DoH, DoT, DoQ and DNSCrypt support
55   URL:=https://github.com/AdguardTeam/dnsproxy
56   DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
57   USERID:=dnsproxy=411:dnsproxy=411
58 endef
59
60 define Package/dnsproxy/description
61   A simple DNS proxy server that supports all existing DNS protocols including
62   DNS-over-TLS, DNS-over-HTTPS, DNSCrypt, and DNS-over-QUIC.Moreover, it can
63   work as a DNS-over-HTTPS, DNS-over-TLS or DNS-over-QUIC server.
64 endef
65
66 define Build/Compile
67         $(call GoPackage/Build/Compile)
68 ifeq ($(CONFIG_DNSPROXY_COMPRESS_UPX),y)
69         $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/dnsproxy
70 endif
71 endef
72
73 define Package/dnsproxy/install
74         $(call GoPackage/Package/Install/Bin,$(1))
75
76         $(INSTALL_DIR) $(1)/etc/config/
77         $(INSTALL_CONF) $(CURDIR)/files/dnsproxy.config $(1)/etc/config/dnsproxy
78         $(INSTALL_DIR) $(1)/etc/init.d/
79         $(INSTALL_BIN) $(CURDIR)/files/dnsproxy.init $(1)/etc/init.d/dnsproxy
80 endef
81
82 define Package/dnsproxy/conffiles
83 /etc/config/dnsproxy
84 endef
85
86 $(eval $(call GoBinPackage,dnsproxy))
87 $(eval $(call BuildPackage,dnsproxy))