1
0

Makefile 5.7 KB

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