dnsmasq: Add broken realtime clock build switch in full variant
[openwrt/staging/lynxis/omap.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.76
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
16 PKG_MD5SUM:=00f5ee66b4e4b7f14538bf62ae3c9461
17
18 PKG_LICENSE:=GPL-2.0
19 PKG_LICENSE_FILES:=COPYING
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
22
23 PKG_INSTALL:=1
24 PKG_BUILD_PARALLEL:=1
25 PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6 \
26 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec \
27 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth \
28 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset \
29 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_conntrack \
30 CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_broken_rtc
31
32 include $(INCLUDE_DIR)/package.mk
33
34 define Package/dnsmasq/Default
35 SECTION:=net
36 CATEGORY:=Base system
37 TITLE:=DNS and DHCP server
38 URL:=http://www.thekelleys.org.uk/dnsmasq/
39 USERID:=dnsmasq=453:dnsmasq=453
40 endef
41
42 define Package/dnsmasq
43 $(call Package/dnsmasq/Default)
44 VARIANT:=nodhcpv6
45 endef
46
47 define Package/dnsmasq-dhcpv6
48 $(call Package/dnsmasq/Default)
49 TITLE += (with DHCPv6 support)
50 DEPENDS:=@IPV6
51 VARIANT:=dhcpv6
52 endef
53
54 define Package/dnsmasq-full
55 $(call Package/dnsmasq/Default)
56 TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset, Conntrack enabled by default)
57 DEPENDS:=+PACKAGE_dnsmasq_full_dnssec:libnettle \
58 +PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset \
59 +PACKAGE_dnsmasq_full_conntrack:libnetfilter-conntrack
60 VARIANT:=full
61 endef
62
63 define Package/dnsmasq/description
64 It is intended to provide coupled DNS and DHCP service to a LAN.
65 endef
66
67 define Package/dnsmasq-dhcpv6/description
68 $(call Package/dnsmasq/description)
69
70 This is a variant with DHCPv6 support
71 endef
72
73 define Package/dnsmasq-full/description
74 $(call Package/dnsmasq/description)
75
76 This is a fully configurable variant with DHCPv6, DNSSEC, Authoritative DNS and
77 IPset, Conntrack support enabled by default.
78 endef
79
80 define Package/dnsmasq/conffiles
81 /etc/config/dhcp
82 /etc/dnsmasq.conf
83 endef
84
85 define Package/dnsmasq-full/config
86 if PACKAGE_dnsmasq-full
87 config PACKAGE_dnsmasq_full_dhcpv6
88 bool "Build with DHCPv6 support."
89 depends on IPV6
90 default y
91 config PACKAGE_dnsmasq_full_dnssec
92 bool "Build with DNSSEC support."
93 default y
94 config PACKAGE_dnsmasq_full_auth
95 bool "Build with the facility to act as an authoritative DNS server."
96 default y
97 config PACKAGE_dnsmasq_full_ipset
98 bool "Build with IPset support."
99 default y
100 config PACKAGE_dnsmasq_full_conntrack
101 bool "Build with Conntrack support."
102 default y
103 config PACKAGE_dnsmasq_full_broken_rtc
104 bool "Build with HAVE_BROKEN_RTC."
105 default n
106 endif
107 endef
108
109 Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)
110 Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles)
111
112 TARGET_CFLAGS += -ffunction-sections -fdata-sections
113 TARGET_LDFLAGS += -Wl,--gc-sections
114
115 COPTS = $(if $(CONFIG_IPV6),,-DNO_IPV6)
116
117 ifeq ($(BUILD_VARIANT),nodhcpv6)
118 COPTS += -DNO_DHCP6
119 endif
120
121 ifeq ($(BUILD_VARIANT),full)
122 COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6),,-DNO_DHCP6) \
123 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec),-DHAVE_DNSSEC) \
124 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth),,-DNO_AUTH) \
125 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset),,-DNO_IPSET) \
126 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_conntrack),-DHAVE_CONNTRACK,) \
127 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_broken_rtc),-DHAVE_BROKEN_RTC)
128 COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,)
129 else
130 COPTS += -DNO_AUTH -DNO_IPSET
131 endif
132
133 MAKE_FLAGS := \
134 $(TARGET_CONFIGURE_OPTS) \
135 CFLAGS="$(TARGET_CFLAGS)" \
136 LDFLAGS="$(TARGET_LDFLAGS)" \
137 COPTS="$(COPTS)" \
138 PREFIX="/usr"
139
140 define Package/dnsmasq/install
141 $(INSTALL_DIR) $(1)/usr/sbin
142 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnsmasq $(1)/usr/sbin/
143 $(INSTALL_DIR) $(1)/etc/config
144 $(INSTALL_DATA) ./files/dhcp.conf $(1)/etc/config/dhcp
145 $(INSTALL_DATA) ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
146 $(INSTALL_DIR) $(1)/etc/init.d
147 $(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
148 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
149 $(INSTALL_DATA) ./files/dnsmasq.hotplug $(1)/etc/hotplug.d/iface/25-dnsmasq
150 $(INSTALL_DIR) $(1)/etc/hotplug.d/ntp
151 $(INSTALL_DATA) ./files/dnsmasqsec.hotplug $(1)/etc/hotplug.d/ntp/25-dnsmasqsec
152 endef
153
154 Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
155
156 define Package/dnsmasq-full/install
157 $(call Package/dnsmasq/install,$(1))
158 ifneq ($(CONFIG_PACKAGE_dnsmasq_full_dnssec),)
159 $(INSTALL_DIR) $(1)/usr/share/dnsmasq
160 $(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
161 endif
162 endef
163
164 $(eval $(call BuildPackage,dnsmasq))
165 $(eval $(call BuildPackage,dnsmasq-dhcpv6))
166 $(eval $(call BuildPackage,dnsmasq-full))