You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

272 lines
6.6 KiB

  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:=keepalived
  9. PKG_VERSION:=2.0.20
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://www.keepalived.org/software
  13. PKG_HASH:=9670fbc5eb3dc113828be8b702549dc68ec9578cf83287520d935be76fc8f193
  14. PKG_CPE_ID:=cpe:/a:keepalived:keepalived
  15. PKG_LICENSE:=GPL-2.0-or-later
  16. PKG_LICENSE_FILES:=COPYING
  17. PKG_MAINTAINER:=Ben Kelly <ben@benjii.net> \
  18. Florian Eckert <fe@dev.tdt.de>
  19. PKG_CONFIG_DEPENDS += \
  20. KEEPALIVED_VRRP \
  21. KEEPALIVED_LVS \
  22. KEEPALIVED_IPTABLES \
  23. KEEPALIVED_BFD \
  24. KEEPALIVED_SNMP_VRRP \
  25. KEEPALIVED_SNMP_CHECKER \
  26. KEEPALIVED_SNMP_RFC2 \
  27. KEEPALIVED_SNMP_RFC3 \
  28. KEEPALIVED_SNMP_REPLY_V3_FOR_V2 \
  29. KEEPALIVED_DBUS \
  30. KEEPALIVED_JSON \
  31. KEEPALIVED_ROUTES \
  32. IPV6
  33. PKG_INSTALL:=1
  34. include $(INCLUDE_DIR)/package.mk
  35. include $(INCLUDE_DIR)/kernel.mk
  36. define Package/keepalived/config
  37. source "$(SOURCE)/Config.in"
  38. endef
  39. # specifying +(IPV6&&KEEPALIVED_IPTABLES) in the DEPENDS definition doesn't work
  40. ifeq ($(CONFIG_KEEPALIVED_IPTABLES)$(CONFIG_IPV6),yy)
  41. KEEPALIVED_DEPENDS_LIBIP6TC=+libip6tc
  42. endif
  43. # The +kmod-nf-ipvs line should be +KEEPALIVED_LVS:kmod-nf-ipvs,
  44. # but make menuconfig then reports :error: recursive dependency detected!
  45. # !!FIXME DEPENDS:= +KEEPALIVED_LVS:kmod-nf-ipvs
  46. define Package/keepalived
  47. SECTION:=net
  48. CATEGORY:=Network
  49. TITLE:=VRRP with failover and monitoring daemon for LVS clusters
  50. URL:=http://www.keepalived.org/
  51. DEPENDS:= \
  52. +libnl-genl \
  53. +libmagic \
  54. +KEEPALIVED_VRRP:kmod-macvlan \
  55. +KEEPALIVED_VRRP:libnl-route \
  56. +KEEPALIVED_VRRP:libnfnetlink \
  57. +KEEPALIVED_SHA1:libopenssl \
  58. +KEEPALIVED_IPTABLES:libip4tc \
  59. $(KEEPALIVED_DEPENDS_LIBIP6TC) \
  60. +KEEPALIVED_IPTABLES:libxtables \
  61. +KEEPALIVED_IPTABLES:libipset \
  62. +(KEEPALIVED_SNMP_VRRP||KEEPALIVED_SNMP_CHECKER||KEEPALIVED_SNMP_RFC2||KEEPALIVED_SNMP_RFC3):libnetsnmp \
  63. +KEEPALIVED_JSON:libjson-c \
  64. +KEEPALIVED_DBUS:glib2
  65. endef
  66. define Package/keepalived/description
  67. VRRP with failover and monitoring daemon for Linux Virtual Server (LVS) clusters.
  68. endef
  69. define Package/keepalived/conffiles
  70. /etc/keepalived/keepalived.conf
  71. /etc/config/keepalived
  72. /etc/keepalived.user
  73. endef
  74. CONFIGURE_ARGS+= \
  75. --with-init=SYSV \
  76. --disable-nftables \
  77. --disable-track-process \
  78. --with-run-dir="/var/run"
  79. ifeq ($(CONFIG_KEEPALIVED_VRRP),)
  80. CONFIGURE_ARGS += \
  81. --disable-vrrp
  82. endif
  83. ifeq ($(CONFIG_KEEPALIVED_LVS),)
  84. CONFIGURE_ARGS += \
  85. --disable-lvs
  86. endif
  87. ifeq ($(CONFIG_KEEPALIVED_BFD),y)
  88. CONFIGURE_ARGS += \
  89. --enable-bfd
  90. endif
  91. ifeq ($(CONFIG_KEEPALIVED_SHA1),y)
  92. CONFIGURE_ARGS += \
  93. --enable-sha1
  94. endif
  95. ifeq ($(CONFIG_KEEPALIVED_VRRP),y)
  96. ifeq ($(CONFIG_KEEPALIVED_IPTABLES),)
  97. CONFIGURE_ARGS += \
  98. --disable-iptables
  99. endif
  100. ifeq ($(CONFIG_KEEPALIVED_IPSETS),)
  101. CONFIGURE_ARGS += \
  102. --disable-libipset-dynamic
  103. endif
  104. ifeq ($(CONFIG_KEEPALIVED_SNMP_VRRP),y)
  105. CONFIGURE_ARGS += \
  106. --enable-snmp-vrrp
  107. endif
  108. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC2),y)
  109. CONFIGURE_ARGS += \
  110. --enable-snmp-rfcv2
  111. endif
  112. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC3),y)
  113. CONFIGURE_ARGS += \
  114. --enable-snmp-rfcv3
  115. endif
  116. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC3),y)
  117. ifeq ($(CONFIG_KEEPALIVED_SNMP_REPLY_V3_FOR_V2),)
  118. CONFIGURE_ARGS += \
  119. --disable-snmp-reply-v3-for-v2
  120. endif
  121. endif # CONFIG_KEEPALIVED_SNMP_RFC3
  122. ifeq ($(CONFIG_KEEPALIVED_JSON),y)
  123. CONFIGURE_ARGS += \
  124. --enable-json
  125. endif
  126. ifeq ($(CONFIG_KEEPALIVED_VRRP_AUTH),)
  127. CONFIGURE_ARGS += \
  128. --disable-vrrp-auth
  129. endif
  130. ifeq ($(CONFIG_KEEPALIVED_CHECKSUM_COMPAT),)
  131. CONFIGURE_ARGS += \
  132. --disable-checksum-compat
  133. endif
  134. ifeq ($(CONFIG_KEEPALIVED_DBUS),y)
  135. CONFIGURE_ARGS += \
  136. --enable-dbus
  137. endif
  138. ifeq ($(CONFIG_KEEPALIVED_LINKBEAT),)
  139. CONFIGURE_ARGS += \
  140. --disable-linkbeat
  141. endif
  142. ifeq ($(CONFIG_KEEPALIVED_ROUTES),)
  143. CONFIGURE_ARGS += \
  144. --disable-routes
  145. endif
  146. endif # CONFIG_KEEPALIVED_VRRP
  147. ifeq ($(CONFIG_KEEPALIVED_LVS),y)
  148. ifeq ($(CONFIG_KEEPALIVED_LVS_SYNCD),)
  149. CONFIGURE_ARGS += \
  150. --disable-lvs-syncd
  151. endif
  152. ifeq ($(CONFIG_KEEPALIVED_LVS_64BIT_STATS),)
  153. CONFIGURE_ARGS += \
  154. --disable-lvs-64bit-stats
  155. endif
  156. ifeq ($(CONFIG_KEEPALIVED_FWMARK),)
  157. CONFIGURE_ARGS += \
  158. --disable-fwmark
  159. endif
  160. ifeq ($(CONFIG_KEEPALIVED_SNMP_CHECKER),y)
  161. CONFIGURE_ARGS += \
  162. --enable-snmp-checker
  163. endif
  164. endif # CONFIG_KEEPALIVED_LVS
  165. MAKE_FLAGS += STRIP="/bin/true"
  166. TARGET_CFLAGS += -I$(LINUX_DIR)
  167. define Package/keepalived/install
  168. $(INSTALL_DIR) $(1)/usr/sbin
  169. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/keepalived \
  170. $(1)/usr/sbin/
  171. $(INSTALL_DIR) $(1)/usr/bin
  172. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/genhash \
  173. $(1)/usr/bin/
  174. $(INSTALL_DIR) $(1)/etc/keepalived
  175. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/keepalived/keepalived.conf \
  176. $(1)/etc/keepalived/
  177. $(INSTALL_DIR) $(1)/etc/uci-defaults
  178. $(INSTALL_BIN) ./files/etc/uci-defaults/keepalived \
  179. $(1)/etc/uci-defaults/keepalived
  180. $(INSTALL_DIR) $(1)/etc/init.d
  181. $(INSTALL_BIN) ./files/keepalived.init \
  182. $(1)/etc/init.d/keepalived
  183. $(INSTALL_DIR) $(1)/etc/config
  184. $(INSTALL_CONF) ./files/keepalived.config \
  185. $(1)/etc/config/keepalived
  186. $(INSTALL_DIR) $(1)/etc
  187. $(INSTALL_CONF) ./files/keepalived.user \
  188. $(1)/etc/keepalived.user
  189. $(INSTALL_DIR) $(1)/etc/hotplug.d/keepalived
  190. $(INSTALL_DATA) ./files/hotplug-user \
  191. $(1)/etc/hotplug.d/keepalived/01-user
  192. ifneq ($(CONFIG_KEEPALIVED_SNMP_VRRP)$(CONFIG_KEEPALIVED_SNMP_CHECKER)$(CONFIG_KEEPALIVED_SNMP_RFC2)$(CONFIG_KEEPALIVED_SNMP_RFC3),)
  193. $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
  194. endif
  195. ifneq ($(CONFIG_KEEPALIVED_SNMP_VRRP)$(CONFIG_KEEPALIVED_SNMP_CHECKER),)
  196. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/KEEPALIVED-MIB.txt \
  197. $(1)/usr/share/snmp/mibs/KEEPALIVED-MIB.txt
  198. endif
  199. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC2),y)
  200. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/VRRP-MIB.txt \
  201. $(1)/usr/share/snmp/mibs/VRRP-MIB.txt
  202. endif
  203. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC3),y)
  204. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/VRRPv3-MIB.txt \
  205. $(1)/usr/share/snmp/mibs/VRRPv3-MIB.txt
  206. endif
  207. ifeq ($(CONFIG_KEEPALIVED_DBUS),y)
  208. $(INSTALL_DIR) $(1)/etc/dbus-1/system.d
  209. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/dbus-1/system.d/org.keepalived.Vrrp1.conf \
  210. $(1)/etc/dbus-1/system.d/org.keepalived.Vrrp1.conf
  211. $(INSTALL_DIR) $(1)/usr/share/dbus-1/interfaces
  212. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Instance.xml \
  213. $(1)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Instance.xml
  214. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Vrrp.xml \
  215. $(1)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Vrrp.xml
  216. endif
  217. endef
  218. $(eval $(call BuildPackage,keepalived))