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.

275 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. 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. +libkmod \
  55. +KEEPALIVED_VRRP:kmod-macvlan \
  56. +KEEPALIVED_VRRP:libnl-route \
  57. +KEEPALIVED_VRRP:libnfnetlink \
  58. +KEEPALIVED_SHA1:libopenssl \
  59. +KEEPALIVED_IPTABLES:libip4tc \
  60. $(KEEPALIVED_DEPENDS_LIBIP6TC) \
  61. +KEEPALIVED_IPTABLES:libxtables \
  62. +KEEPALIVED_IPTABLES:libipset \
  63. +(KEEPALIVED_SNMP_VRRP||KEEPALIVED_SNMP_CHECKER||KEEPALIVED_SNMP_RFC2||KEEPALIVED_SNMP_RFC3):libnetsnmp \
  64. +KEEPALIVED_JSON:libjson-c \
  65. +KEEPALIVED_DBUS:glib2
  66. endef
  67. define Package/keepalived/description
  68. VRRP with failover and monitoring daemon for Linux Virtual Server (LVS) clusters.
  69. endef
  70. define Package/keepalived/conffiles
  71. /etc/keepalived/keepalived.conf
  72. /etc/config/keepalived
  73. /etc/keepalived.user
  74. endef
  75. CONFIGURE_ARGS+= \
  76. --with-init=SYSV \
  77. --disable-nftables \
  78. --disable-track-process \
  79. --runstatedir="/var/run"
  80. ifeq ($(CONFIG_KEEPALIVED_VRRP),)
  81. CONFIGURE_ARGS += \
  82. --disable-vrrp
  83. endif
  84. ifeq ($(CONFIG_KEEPALIVED_LVS),)
  85. CONFIGURE_ARGS += \
  86. --disable-lvs
  87. endif
  88. ifeq ($(CONFIG_KEEPALIVED_BFD),y)
  89. CONFIGURE_ARGS += \
  90. --enable-bfd
  91. endif
  92. ifeq ($(CONFIG_KEEPALIVED_SHA1),y)
  93. CONFIGURE_ARGS += \
  94. --enable-sha1
  95. endif
  96. ifeq ($(CONFIG_KEEPALIVED_VRRP),y)
  97. ifeq ($(CONFIG_KEEPALIVED_IPTABLES),)
  98. CONFIGURE_ARGS += \
  99. --disable-iptables
  100. endif
  101. ifeq ($(CONFIG_KEEPALIVED_IPSETS),)
  102. CONFIGURE_ARGS += \
  103. --disable-libipset-dynamic
  104. endif
  105. ifeq ($(CONFIG_KEEPALIVED_SNMP_VRRP),y)
  106. CONFIGURE_ARGS += \
  107. --enable-snmp-vrrp
  108. endif
  109. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC2),y)
  110. CONFIGURE_ARGS += \
  111. --enable-snmp-rfcv2
  112. endif
  113. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC3),y)
  114. CONFIGURE_ARGS += \
  115. --enable-snmp-rfcv3
  116. endif
  117. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC3),y)
  118. ifeq ($(CONFIG_KEEPALIVED_SNMP_REPLY_V3_FOR_V2),)
  119. CONFIGURE_ARGS += \
  120. --disable-snmp-reply-v3-for-v2
  121. endif
  122. endif # CONFIG_KEEPALIVED_SNMP_RFC3
  123. ifeq ($(CONFIG_KEEPALIVED_JSON),y)
  124. CONFIGURE_ARGS += \
  125. --enable-json
  126. endif
  127. ifeq ($(CONFIG_KEEPALIVED_VRRP_AUTH),)
  128. CONFIGURE_ARGS += \
  129. --disable-vrrp-auth
  130. endif
  131. ifeq ($(CONFIG_KEEPALIVED_CHECKSUM_COMPAT),)
  132. CONFIGURE_ARGS += \
  133. --disable-checksum-compat
  134. endif
  135. ifeq ($(CONFIG_KEEPALIVED_DBUS),y)
  136. CONFIGURE_ARGS += \
  137. --enable-dbus
  138. endif
  139. ifeq ($(CONFIG_KEEPALIVED_LINKBEAT),)
  140. CONFIGURE_ARGS += \
  141. --disable-linkbeat
  142. endif
  143. ifeq ($(CONFIG_KEEPALIVED_ROUTES),)
  144. CONFIGURE_ARGS += \
  145. --disable-routes
  146. endif
  147. endif # CONFIG_KEEPALIVED_VRRP
  148. ifeq ($(CONFIG_KEEPALIVED_LVS),y)
  149. ifeq ($(CONFIG_KEEPALIVED_LVS_SYNCD),)
  150. CONFIGURE_ARGS += \
  151. --disable-lvs-syncd
  152. endif
  153. ifeq ($(CONFIG_KEEPALIVED_LVS_64BIT_STATS),)
  154. CONFIGURE_ARGS += \
  155. --disable-lvs-64bit-stats
  156. endif
  157. ifeq ($(CONFIG_KEEPALIVED_FWMARK),)
  158. CONFIGURE_ARGS += \
  159. --disable-fwmark
  160. endif
  161. ifeq ($(CONFIG_KEEPALIVED_SNMP_CHECKER),y)
  162. CONFIGURE_ARGS += \
  163. --enable-snmp-checker
  164. endif
  165. endif # CONFIG_KEEPALIVED_LVS
  166. MAKE_FLAGS += STRIP="/bin/true"
  167. TARGET_CFLAGS += -I$(LINUX_DIR)
  168. define Package/keepalived/install
  169. $(INSTALL_DIR) $(1)/usr/sbin
  170. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/keepalived \
  171. $(1)/usr/sbin/
  172. ifeq ($(CONFIG_KEEPALIVED_LVS),y)
  173. $(INSTALL_DIR) $(1)/usr/bin
  174. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/genhash \
  175. $(1)/usr/bin/
  176. endif
  177. $(INSTALL_DIR) $(1)/etc/keepalived
  178. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/keepalived/keepalived.conf.sample \
  179. $(1)/etc/keepalived/keepalived.conf
  180. $(INSTALL_DIR) $(1)/etc/uci-defaults
  181. $(INSTALL_BIN) ./files/etc/uci-defaults/keepalived \
  182. $(1)/etc/uci-defaults/keepalived
  183. $(INSTALL_DIR) $(1)/etc/init.d
  184. $(INSTALL_BIN) ./files/keepalived.init \
  185. $(1)/etc/init.d/keepalived
  186. $(INSTALL_DIR) $(1)/etc/config
  187. $(INSTALL_CONF) ./files/keepalived.config \
  188. $(1)/etc/config/keepalived
  189. $(INSTALL_DIR) $(1)/etc
  190. $(INSTALL_CONF) ./files/keepalived.user \
  191. $(1)/etc/keepalived.user
  192. $(INSTALL_DIR) $(1)/etc/hotplug.d/keepalived
  193. $(INSTALL_DATA) ./files/hotplug-user \
  194. $(1)/etc/hotplug.d/keepalived/01-user
  195. ifneq ($(CONFIG_KEEPALIVED_SNMP_VRRP)$(CONFIG_KEEPALIVED_SNMP_CHECKER)$(CONFIG_KEEPALIVED_SNMP_RFC2)$(CONFIG_KEEPALIVED_SNMP_RFC3),)
  196. $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
  197. endif
  198. ifneq ($(CONFIG_KEEPALIVED_SNMP_VRRP)$(CONFIG_KEEPALIVED_SNMP_CHECKER),)
  199. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/KEEPALIVED-MIB.txt \
  200. $(1)/usr/share/snmp/mibs/KEEPALIVED-MIB.txt
  201. endif
  202. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC2),y)
  203. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/VRRP-MIB.txt \
  204. $(1)/usr/share/snmp/mibs/VRRP-MIB.txt
  205. endif
  206. ifeq ($(CONFIG_KEEPALIVED_SNMP_RFC3),y)
  207. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/VRRPv3-MIB.txt \
  208. $(1)/usr/share/snmp/mibs/VRRPv3-MIB.txt
  209. endif
  210. ifeq ($(CONFIG_KEEPALIVED_DBUS),y)
  211. $(INSTALL_DIR) $(1)/etc/dbus-1/system.d
  212. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/dbus-1/system.d/org.keepalived.Vrrp1.conf \
  213. $(1)/etc/dbus-1/system.d/org.keepalived.Vrrp1.conf
  214. $(INSTALL_DIR) $(1)/usr/share/dbus-1/interfaces
  215. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Instance.xml \
  216. $(1)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Instance.xml
  217. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Vrrp.xml \
  218. $(1)/usr/share/dbus-1/interfaces/org.keepalived.Vrrp1.Vrrp.xml
  219. endif
  220. endef
  221. $(eval $(call BuildPackage,keepalived))