1
0

Makefile 6.0 KB

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