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