Makefile 4.1 KB

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