1
0

Makefile 4.9 KB

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