Makefile 4.4 KB

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