dnsmasq: bump to 2.80test2
[openwrt/openwrt.git] / package / network / services / dnsmasq / Makefile
1 #
2 # Copyright (C) 2006-2016 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=dnsmasq
11 PKG_VERSION:=2.80test2
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases
16 PKG_HASH:=e731666094699afcbad947f89f7f8afbf92e5ddc3c915459d4936159d81116f0
17
18 PKG_LICENSE:=GPL-2.0
19 PKG_LICENSE_FILES:=COPYING
20 PKG_CPE_ID:=cpe:/a:thekelleys:dnsmasq
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23
24 PKG_INSTALL:=1
25 PKG_BUILD_PARALLEL:=1
26 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcp \
27 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6 \
28 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec \
29 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth \
30 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset \
31 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_conntrack \
32 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_noid \
33 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_broken_rtc
34
35 include $(INCLUDE_DIR)/package.mk
36
37 define Package/dnsmasq/Default
38 SECTION:=net
39 CATEGORY:=Base system
40 TITLE:=DNS and DHCP server
41 URL:=http://www.thekelleys.org.uk/dnsmasq/
42 DEPENDS:=+libubus
43 USERID:=dnsmasq=453:dnsmasq=453
44 endef
45
46 define Package/dnsmasq
47 $(call Package/dnsmasq/Default)
48 VARIANT:=nodhcpv6
49 endef
50
51 define Package/dnsmasq-dhcpv6
52 $(call Package/dnsmasq/Default)
53 TITLE += (with DHCPv6 support)
54 DEPENDS+=@IPV6
55 VARIANT:=dhcpv6
56 endef
57
58 define Package/dnsmasq-full
59 $(call Package/dnsmasq/Default)
60 TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset, Conntrack, NO_ID enabled by default)
61 DEPENDS+=+PACKAGE_dnsmasq_full_dnssec:libnettle \
62 +PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset \
63 +PACKAGE_dnsmasq_full_conntrack:libnetfilter-conntrack
64 VARIANT:=full
65 endef
66
67 define Package/dnsmasq/description
68 It is intended to provide coupled DNS and DHCP service to a LAN.
69 endef
70
71 define Package/dnsmasq-dhcpv6/description
72 $(call Package/dnsmasq/description)
73
74 This is a variant with DHCPv6 support
75 endef
76
77 define Package/dnsmasq-full/description
78 $(call Package/dnsmasq/description)
79
80 This is a fully configurable variant with DHCPv4, DHCPv6, DNSSEC, Authoritative DNS
81 and IPset, Conntrack support & NO_ID enabled by default.
82 endef
83
84 define Package/dnsmasq/conffiles
85 /etc/config/dhcp
86 /etc/dnsmasq.conf
87 endef
88
89 define Package/dnsmasq-full/config
90 if PACKAGE_dnsmasq-full
91 config PACKAGE_dnsmasq_full_dhcp
92 bool "Build with DHCP support."
93 default y
94 config PACKAGE_dnsmasq_full_dhcpv6
95 bool "Build with DHCPv6 support."
96 depends on IPV6 && PACKAGE_dnsmasq_full_dhcp
97 default y
98 config PACKAGE_dnsmasq_full_dnssec
99 bool "Build with DNSSEC support."
100 default y
101 config PACKAGE_dnsmasq_full_auth
102 bool "Build with the facility to act as an authoritative DNS server."
103 default y
104 config PACKAGE_dnsmasq_full_ipset
105 bool "Build with IPset support."
106 default y
107 config PACKAGE_dnsmasq_full_conntrack
108 bool "Build with Conntrack support."
109 default y
110 config PACKAGE_dnsmasq_full_noid
111 bool "Build with NO_ID. (hide *.bind pseudo domain)"
112 default y
113 config PACKAGE_dnsmasq_full_broken_rtc
114 bool "Build with HAVE_BROKEN_RTC."
115 default n
116 endif
117 endef
118
119 Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)
120 Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles)
121
122 TARGET_CFLAGS += -ffunction-sections -fdata-sections
123 TARGET_LDFLAGS += -Wl,--gc-sections
124
125 COPTS = $(if $(CONFIG_IPV6),,-DNO_IPV6)
126
127 ifeq ($(BUILD_VARIANT),nodhcpv6)
128 COPTS += -DNO_DHCP6
129 endif
130
131 ifeq ($(BUILD_VARIANT),full)
132 COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcp),,-DNO_DHCP) \
133 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6),,-DNO_DHCP6) \
134 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec),-DHAVE_DNSSEC) \
135 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth),,-DNO_AUTH) \
136 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset),,-DNO_IPSET) \
137 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_conntrack),-DHAVE_CONNTRACK,) \
138 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_noid),-DNO_ID,) \
139 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_broken_rtc),-DHAVE_BROKEN_RTC)
140 COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,)
141 else
142 COPTS += -DNO_AUTH -DNO_IPSET -DNO_ID
143 endif
144
145 MAKE_FLAGS := \
146 $(TARGET_CONFIGURE_OPTS) \
147 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
148 LDFLAGS="$(TARGET_LDFLAGS)" \
149 COPTS="$(COPTS)" \
150 PREFIX="/usr"
151
152 define Package/dnsmasq/install
153 $(INSTALL_DIR) $(1)/usr/sbin
154 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnsmasq $(1)/usr/sbin/
155 $(INSTALL_DIR) $(1)/etc/config
156 $(INSTALL_DATA) ./files/dhcp.conf $(1)/etc/config/dhcp
157 $(INSTALL_DATA) ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
158 $(INSTALL_DIR) $(1)/etc/init.d
159 $(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
160 $(INSTALL_DIR) $(1)/etc/hotplug.d/dhcp
161 $(INSTALL_DIR) $(1)/etc/hotplug.d/neigh
162 $(INSTALL_DIR) $(1)/etc/hotplug.d/ntp
163 $(INSTALL_DIR) $(1)/etc/hotplug.d/tftp
164 $(INSTALL_DATA) ./files/dnsmasqsec.hotplug $(1)/etc/hotplug.d/ntp/25-dnsmasqsec
165 $(INSTALL_DIR) $(1)/usr/share/dnsmasq
166 $(INSTALL_DATA) ./files/rfc6761.conf $(1)/usr/share/dnsmasq/
167 $(INSTALL_DIR) $(1)/usr/lib/dnsmasq
168 $(INSTALL_BIN) ./files/dhcp-script.sh $(1)/usr/lib/dnsmasq/dhcp-script.sh
169 $(INSTALL_DIR) $(1)/usr/share/acl.d
170 $(INSTALL_DATA) ./files/dnsmasq_acl.json $(1)/usr/share/acl.d/
171 endef
172
173 Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
174
175 define Package/dnsmasq-full/install
176 $(call Package/dnsmasq/install,$(1))
177 ifneq ($(CONFIG_PACKAGE_dnsmasq_full_dnssec),)
178 $(INSTALL_DIR) $(1)/usr/share/dnsmasq
179 $(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
180 endif
181 endef
182
183 $(eval $(call BuildPackage,dnsmasq))
184 $(eval $(call BuildPackage,dnsmasq-dhcpv6))
185 $(eval $(call BuildPackage,dnsmasq-full))