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.

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