Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #
  2. # Copyright (C) 2006-2015 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.78
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/
  13. PKG_MD5SUM:=6d0241b72c79d2b510776ccc4ed69ca4
  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)_noid \
  22. CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth \
  23. CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset
  24. include $(INCLUDE_DIR)/package.mk
  25. define Package/dnsmasq/Default
  26. SECTION:=net
  27. CATEGORY:=Base system
  28. TITLE:=DNS and DHCP server
  29. URL:=http://www.thekelleys.org.uk/dnsmasq/
  30. endef
  31. define Package/dnsmasq
  32. $(call Package/dnsmasq/Default)
  33. VARIANT:=nodhcpv6
  34. endef
  35. define Package/dnsmasq-dhcpv6
  36. $(call Package/dnsmasq/Default)
  37. TITLE += (with DHCPv6 support)
  38. DEPENDS:=@IPV6 +kmod-ipv6
  39. VARIANT:=dhcpv6
  40. endef
  41. define Package/dnsmasq-full
  42. $(call Package/dnsmasq/Default)
  43. TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset, NO_ID enabled by default)
  44. DEPENDS:=+PACKAGE_dnsmasq_full_dnssec:libnettle \
  45. +PACKAGE_dnsmasq_full_dhcpv6:kmod-ipv6 \
  46. +PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset
  47. VARIANT:=full
  48. endef
  49. define Package/dnsmasq/description
  50. It is intended to provide coupled DNS and DHCP service to a LAN.
  51. endef
  52. define Package/dnsmasq-dhcpv6/description
  53. $(call Package/dnsmasq/description)
  54. This is a variant with DHCPv6 support
  55. endef
  56. define Package/dnsmasq-full/description
  57. $(call Package/dnsmasq/description)
  58. This is a fully configurable variant with DHCPv6, DNSSEC, Authoritative DNS and
  59. IPset, NO_ID support enabled by default.
  60. endef
  61. define Package/dnsmasq/conffiles
  62. /etc/config/dhcp
  63. /etc/dnsmasq.conf
  64. endef
  65. define Package/dnsmasq-full/config
  66. if PACKAGE_dnsmasq-full
  67. config PACKAGE_dnsmasq_full_dhcpv6
  68. bool "Build with DHCPv6 support."
  69. depends on IPV6
  70. default y
  71. config PACKAGE_dnsmasq_full_dnssec
  72. bool "Build with DNSSEC support."
  73. default y
  74. config PACKAGE_dnsmasq_full_noid
  75. bool "Build with NO_ID. (hide *.bind pseudo domain)"
  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. endif
  84. endef
  85. Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)
  86. Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles)
  87. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  88. TARGET_LDFLAGS += -Wl,--gc-sections
  89. COPTS = $(if $(CONFIG_IPV6),,-DNO_IPV6)
  90. ifeq ($(BUILD_VARIANT),nodhcpv6)
  91. COPTS += -DNO_DHCP6
  92. endif
  93. ifeq ($(BUILD_VARIANT),full)
  94. COPTS += $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6),,-DNO_DHCP6) \
  95. $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec),-DHAVE_DNSSEC) \
  96. $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth),,-DNO_AUTH) \
  97. $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_noid),-DNO_ID,) \
  98. $(if $(CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset),,-DNO_IPSET)
  99. COPTS += $(if $(CONFIG_LIBNETTLE_MINI),-DNO_GMP,)
  100. else
  101. COPTS += -DNO_AUTH -DNO_IPSET -DNO_ID
  102. endif
  103. MAKE_FLAGS := \
  104. $(TARGET_CONFIGURE_OPTS) \
  105. CFLAGS="$(TARGET_CFLAGS)" \
  106. LDFLAGS="$(TARGET_LDFLAGS)" \
  107. COPTS="$(COPTS)" \
  108. PREFIX="/usr"
  109. define Package/dnsmasq/install
  110. $(INSTALL_DIR) $(1)/usr/sbin
  111. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnsmasq $(1)/usr/sbin/
  112. $(INSTALL_DIR) $(1)/etc/config
  113. $(INSTALL_DATA) ./files/dhcp.conf $(1)/etc/config/dhcp
  114. $(INSTALL_DATA) ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
  115. $(INSTALL_DIR) $(1)/etc/init.d
  116. $(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
  117. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  118. $(INSTALL_DATA) ./files/dnsmasq.hotplug $(1)/etc/hotplug.d/iface/25-dnsmasq
  119. endef
  120. Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
  121. define Package/dnsmasq-full/install
  122. $(call Package/dnsmasq/install,$(1))
  123. ifneq ($(CONFIG_PACKAGE_dnsmasq_full_dnssec),)
  124. $(INSTALL_DIR) $(1)/usr/share/dnsmasq
  125. $(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
  126. endif
  127. endef
  128. $(eval $(call BuildPackage,dnsmasq))
  129. $(eval $(call BuildPackage,dnsmasq-dhcpv6))
  130. $(eval $(call BuildPackage,dnsmasq-full))