dnsmasq: allow de-selecting features from -full variant.
[openwrt/staging/chunkeey.git] / package / network / services / dnsmasq / Makefile
1 #
2 # Copyright (C) 2006-2013 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.72
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
16 PKG_MD5SUM:=cf82f81cf09ad3d47612985012240483
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
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/dnsmasq/Default
29 SECTION:=net
30 CATEGORY:=Base system
31 TITLE:=DNS and DHCP server
32 URL:=http://www.thekelleys.org.uk/dnsmasq/
33 endef
34
35 define Package/dnsmasq
36 $(call Package/dnsmasq/Default)
37 VARIANT:=nodhcpv6
38 endef
39
40 define Package/dnsmasq-dhcpv6
41 $(call Package/dnsmasq/Default)
42 TITLE += (with DHCPv6 support)
43 DEPENDS:=@IPV6 +kmod-ipv6
44 VARIANT:=dhcpv6
45 endef
46
47 define Package/dnsmasq-full
48 $(call Package/dnsmasq/Default)
49 TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPSET)
50 DEPENDS:=@IPV6 +kmod-ipv6 +libnettle
51 VARIANT:=full
52 endef
53
54 define Package/dnsmasq/description
55 It is intended to provide coupled DNS and DHCP service to a LAN.
56 endef
57
58 define Package/dnsmasq-dhcpv6/description
59 $(call Package/dnsmasq/description)
60
61 This is a variant with DHCPv6 support
62 endef
63
64 define Package/dnsmasq-full/description
65 $(call Package/dnsmasq/description)
66
67 This is a variant with DHCPv6, DNSSEC, Authroitative DNS and IPSET support
68 endef
69
70 define Package/dnsmasq/conffiles
71 /etc/config/dhcp
72 /etc/dnsmasq.conf
73 endef
74
75 define Package/dnsmasq/config/Default
76 if PACKAGE_$(1)-$(2)
77 config PACKAGE_dnsmasq_$(2)_dhcpv6
78 bool "Build with DHCPv6 support."
79 default y
80 config PACKAGE_dnsmasq_$(2)_dnssec
81 bool "Build with DNSSEC support."
82 default y
83 config PACKAGE_dnsmasq_$(2)_auth
84 bool "Build with the facility to act as an authoritative DNS server."
85 default y
86 config PACKAGE_dnsmasq_$(2)_ipset
87 bool "Build with ipset support."
88 select PACKAGE_kmod-ipt-ipset
89 default y
90 endif
91 endef
92
93 Package/dnsmasq-full/config=$(call Package/dnsmasq/config/Default,dnsmasq,full)
94
95 Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)
96 Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles)
97
98 TARGET_CFLAGS += -ffunction-sections -fdata-sections
99 TARGET_LDFLAGS += -Wl,--gc-sections
100
101 COPTS = $(if $(CONFIG_IPV6),,-DNO_IPV6)
102
103 ifeq ($(BUILD_VARIANT),nodhcpv6)
104 COPTS += -DNO_DHCP6
105 endif
106
107 ifeq ($(BUILD_VARIANT),full)
108 COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6),,-DNO_DHCP6) \
109 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec),-DHAVE_DNSSEC) \
110 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth),,-DNO_AUTH) \
111 $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset),,-DNO_IPSET)
112 COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,)
113 else
114 COPTS += -DNO_AUTH -DNO_IPSET
115 endif
116
117 MAKE_FLAGS := \
118 $(TARGET_CONFIGURE_OPTS) \
119 CFLAGS="$(TARGET_CFLAGS)" \
120 LDFLAGS="$(TARGET_LDFLAGS)" \
121 COPTS="$(COPTS)" \
122 PREFIX="/usr"
123
124 define Package/dnsmasq/install
125 $(INSTALL_DIR) $(1)/usr/sbin
126 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnsmasq $(1)/usr/sbin/
127 $(INSTALL_DIR) $(1)/etc/config
128 $(INSTALL_DATA) ./files/dhcp.conf $(1)/etc/config/dhcp
129 $(INSTALL_DATA) ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
130 $(INSTALL_DIR) $(1)/etc/init.d
131 $(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
132 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
133 $(INSTALL_DATA) ./files/dnsmasq.hotplug $(1)/etc/hotplug.d/iface/25-dnsmasq
134 endef
135
136 Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
137
138 define Package/dnsmasq-full/install
139 $(call Package/dnsmasq/install,$(1))
140 $(INSTALL_DIR) $(1)/usr/share/dnsmasq
141 $(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
142 endef
143
144 $(eval $(call BuildPackage,dnsmasq))
145 $(eval $(call BuildPackage,dnsmasq-dhcpv6))
146 $(eval $(call BuildPackage,dnsmasq-full))