f18be903c346b37c515259a91db46f6a4c87d727
[feed/packages.git] / net / dnsdist / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=dnsdist
4 PKG_VERSION:=1.9.1
5 PKG_RELEASE:=1
6
7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
8 PKG_SOURCE_URL:=https://downloads.powerdns.com/releases/
9 PKG_HASH:=4b1db4fae2917e54a804440580a602db3300aed7801f6c986bf03ba7768bc01a
10
11 PKG_MAINTAINER:=Peter van Dijk <peter.van.dijk@powerdns.com>, Remi Gacogne <remi.gacogne@powerdns.com>
12 PKG_LICENSE:=GPL-2.0-only
13 PKG_LICENSE_FILES:=COPYING
14 PKG_CPE_ID:=cpe:/a:powerdns:dnsdist
15
16 PKG_INSTALL:=1
17 PKG_BUILD_PARALLEL:=1
18
19 PKG_BUILD_DEPENDS:=boost
20
21 PKG_CONFIG_DEPENDS:= \
22 CONFIG_DNSDIST_GNUTLS \
23 CONFIG_DNSDIST_OPENSSL
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/dnsdist/Default
28 SECTION:=net
29 CATEGORY:=Network
30 SUBMENU:=IP Addresses and Names
31 TITLE:=dnsdist DNS-, DOS- and abuse-aware loadbalancer $(2)
32 USERID:=dnsdist:dnsdist
33 DEPENDS:= \
34 +ca-bundle \
35 +libatomic \
36 +libcap \
37 +libstdcpp \
38 @HAS_LUAJIT_ARCH +luajit
39 URL:=https://dnsdist.org/
40 VARIANT:=$(1)
41 PROVIDES:=dnsdist
42 endef
43
44 define Package/dnsdist/description/Default
45 dnsdist is a highly DNS-, DoS- and abuse-aware loadbalancer. Its goal in life
46 is to route traffic to the best server, delivering top performance to legitimate
47 users while shunting or blocking abusive traffic.
48 endef
49
50 define Package/dnsdist/conffiles/Default
51 /etc/dnsdist.conf
52 /etc/config/dnsdist
53 /etc/init.d/dnsdist
54 endef
55
56 define Package/dnsdist/config
57 source "$(SOURCE)/Config.in"
58 endef
59
60 define Package/dnsdist/install/Default
61 $(INSTALL_DIR) $(1)/etc
62 $(INSTALL_DIR) $(1)/etc/dnsdist.conf.d
63 $(INSTALL_CONF) ./files/dnsdist.conf $(1)/etc/dnsdist.conf
64 $(INSTALL_DIR) $(1)/etc/config
65 $(INSTALL_CONF) ./files/dnsdist.config $(1)/etc/config/dnsdist
66 $(INSTALL_DIR) $(1)/etc/init.d
67 $(INSTALL_BIN) ./files/dnsdist.init $(1)/etc/init.d/dnsdist
68 $(INSTALL_DIR) $(1)/usr/bin
69 $(INSTALL_BIN) $(PKG_BUILD_DIR)/dnsdist $(1)/usr/bin/
70 endef
71
72 define Package/dnsdist
73 $(call Package/dnsdist/Default,mini,- minimal version with a restricted feature set)
74 DEPENDS+= \
75 +DNSDIST_LIBEDIT:libedit \
76 +DNSDIST_DNSTAP:libfstrm \
77 +DNSDIST_GNUTLS:libgnutls \
78 +DNSDIST_DNS_OVER_HTTPS:libnghttp2 \
79 +DNSDIST_NET_SNMP:libnetsnmp \
80 +DNSDIST_OPENSSL:libopenssl \
81 +DNSDIST_SODIUM:libsodium \
82 +DNSDIST_LMDB:lmdb \
83 +DNSDIST_CDB:tinycdb \
84 +DNSDIST_RE2:re2
85 endef
86
87 Package/dnsdist/description=$(call Package/dnsdist/description/Default)
88 Package/dnsdist/conffiles=$(call Package/dnsdist/conffiles/Default)
89 Package/dnsdist/install=$(call Package/dnsdist/install/Default,$1)
90
91 define Package/dnsdist-full
92 $(call Package/dnsdist/Default,full,- full version with all the features built in)
93 DEPENDS+= \
94 +libedit \
95 +libfstrm \
96 +libgnutls \
97 +libnetsnmp \
98 +libnghttp2 \
99 +libopenssl \
100 +libsodium \
101 +lmdb \
102 +tinycdb \
103 +re2
104 endef
105 Package/dnsdist-full/description=$(call Package/dnsdist/description/Default)
106 Package/dnsdist-full/conffiles=$(call Package/dnsdist/conffiles/Default)
107 Package/dnsdist-full/install=$(call Package/dnsdist/install/Default,$1)
108
109 # not everything groks --disable-nls
110 DISABLE_NLS:=
111
112 # disable PIE for this package, see CONFIG_DNSDIST_PIE
113 PKG_ASLR_PIE:=0
114
115 ifneq ($(CONFIG_DNSDIST_DEBUG_SYMBOLS),)
116 RSTRIP:=:
117 STRIP:=:
118 endif
119
120 IsEnabled = $(or $(filter full,$(BUILD_VARIANT)),$(CONFIG_$(1)))
121
122 # OpenWRT's setting of CXX destroys dnsdist's -std=c++17
123 # --with-re2 compensates for that because it compensates for a bug in re2.pc that also destroys it
124 # so this addition is for the --without-re2 case
125 #
126 # none of this is pretty
127 TARGET_CXX+=-std=c++17
128 TARGET_CFLAGS+=-Os -fvisibility=hidden -flto -fno-ipa-cp -DNDEBUG
129 TARGET_CXXFLAGS+=-Os -fvisibility=hidden -flto -fno-ipa-cp -DNDEBUG \
130 -DDISABLE_DEPRECATED_DYNBLOCK -DDISABLE_RECVMMSG -DDISABLE_NPN -DDISABLE_FALSE_SHARING_PADDING -DUSE_SINGLE_ACCEPTOR_THREAD -DOPENSSL_NO_ENGINE -DDISABLE_OPENSSL_ERROR_STRINGS \
131 $(if $(call IsEnabled,DNSDIST_CARBON),,-DDISABLE_CARBON) \
132 $(if $(call IsEnabled,DNSDIST_COMPLETION),,-DDISABLE_COMPLETION) \
133 $(if $(call IsEnabled,DNSDIST_DEBUG_SYMBOLS),-g3,) \
134 $(if $(call IsEnabled,DNSDIST_DELAY_PIPE),,-DDISABLE_DELAY_PIPE) \
135 $(if $(call IsEnabled,DNSDIST_DYNBLOCKS),,-DDISABLE_DYNBLOCKS) \
136 $(if $(call IsEnabled,DNSDIST_ECS_ACTIONS),,-DDISABLE_ECS_ACTIONS) \
137 $(if $(call IsEnabled,DNSDIST_HASHED),,-DDISABLE_HASHED_CREDENTIALS) \
138 $(if $(call IsEnabled,DNSDIST_LUA_ADVANCED),,-DDISABLE_NON_FFI_DQ_BINDINGS -DDISABLE_DOWNSTREAM_BINDINGS -DDISABLE_DNSHEADER_BINDINGS -DDISABLE_COMBO_ADDR_BINDINGS -DDISABLE_QPS_LIMITER_BINDINGS -DDISABLE_PACKETCACHE_BINDINGS -DDISABLE_CLIENT_STATE_BINDINGS -DDISABLE_DNSPACKET_BINDINGS -DDISABLE_LUA_BINDINGS_RINGS) \
139 $(if $(call IsEnabled,DNSDIST_MAC),-DDNSDIST_RINGS_WITH_MACADDRESS,) \
140 $(if $(call IsEnabled,DNSDIST_OCSP_STAPLING),,-DDISABLE_OCSP_STAPLING) \
141 $(if $(call IsEnabled,DNSDIST_PROTOBUF),,-DDISABLE_PROTOBUF) \
142 $(if $(call IsEnabled,DNSDIST_PROMETHEUS),,-DDISABLE_PROMETHEUS) \
143 $(if $(call IsEnabled,DNSDIST_RULES_ALTER),,-DDISABLE_RULES_ALTERING_QUERIES) \
144 $(if $(call IsEnabled,DNSDIST_SECPOLL),,-DDISABLE_SECPOLL) \
145 $(if $(call IsEnabled,DNSDIST_TOP_N),,-DDISABLE_TOP_N_BINDINGS) \
146 $(if $(call IsEnabled,DNSDIST_WEB),,-DDISABLE_WEB_CONFIG -DDISABLE_BUILTIN_HTML -DDISABLE_LUA_WEB_HANDLERS)
147
148 CONFIGURE_ARGS+= \
149 --with-pic \
150 --with-lua=luajit \
151 --with-libcap \
152 --without-xsk \
153 $(if $(call IsEnabled,DNSDIST_PIE),,--disable-hardening) \
154 $(if $(call IsEnabled,DNSDIST_SODIUM),--enable-dnscrypt --with-libsodium,--disable-dnscrypt --without-libsodium) \
155 $(if $(call IsEnabled,DNSDIST_DNSTAP),--enable-dnstap=yes,--enable-dnstap=no) \
156 $(if $(call IsEnabled,DNSDIST_RE2),--with,--without)-re2 \
157 $(if $(call IsEnabled,DNSDIST_NET_SNMP),--with,--without)-net-snmp \
158 $(if $(call IsEnabled,DNSDIST_GNUTLS),--with,--without)-gnutls \
159 $(if $(call IsEnabled,DNSDIST_OPENSSL),--with,--without)-libssl \
160 $(if $(call IsEnabled,DNSDIST_DNS_OVER_TLS),--enable-dns-over-tls,) \
161 $(if $(call IsEnabled,DNSDIST_CDB),--with,--without)-cdb \
162 $(if $(call IsEnabled,DNSDIST_LMDB),--with,--without)-lmdb \
163 $(if $(call IsEnabled,DNSDIST_LIBEDIT),--with,--without)-libedit \
164 $(if $(call IsEnabled,DNSDIST_IPCIPHER),--enable,--disable)-ipcipher \
165 $(if $(call IsEnabled,DNSDIST_EBPF),--with,--without)-ebpf \
166 $(if $(call IsEnabled,DNSDIST_DNS_OVER_HTTPS),--enable-dns-over-https,) \
167
168 $(eval $(call BuildPackage,dnsdist))
169 $(eval $(call BuildPackage,dnsdist-full))