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.

238 lines
6.0 KiB

  1. #
  2. # Copyright (C) 2019 Lucian Cristian <lucian.cristian@gmail.com>
  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:=frr
  9. PKG_VERSION:=7.2
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_URL:=https://github.com/FRRouting/frr/releases/download/$(PKG_NAME)-$(PKG_VERSION)/
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. PKG_HASH:=6cd5bfb6975133ccf23cc3f3a1c1c9a3f6d6a6c792c763b3ea010db75b3de5b3
  14. PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
  15. PKG_DAEMON_AVAILABLE:= \
  16. babeld \
  17. bfdd \
  18. bgpd \
  19. eigrpd \
  20. fabricd \
  21. isisd \
  22. ldpd \
  23. nhrpd \
  24. ospfd \
  25. ospf6d \
  26. pbrd \
  27. pimd \
  28. ripd \
  29. ripngd \
  30. staticd \
  31. vrrpd
  32. PKG_CONFIG_DEPENDS:= \
  33. CONFIG_IPV6 \
  34. CONFIG_FRR_OPENSSL \
  35. CONFIG_FRR_INTERNAL \
  36. CONFIG_PACKAGE_frr-libfrr \
  37. CONFIG_PACKAGE_frr-vtysh \
  38. CONFIG_PACKAGE_frr-watchfrr \
  39. CONFIG_PACKAGE_frr-zebra \
  40. $(patsubst %,CONFIG_PACKAGE_frr-%,$(PKG_DAEMON_AVAILABLE)) \
  41. PKG_BUILD_PARALLEL:=1
  42. PKG_BUILD_DEPENDS:=python3/host
  43. PKG_FIXUP:=autoreconf
  44. PKG_LICENSE:=GPL-2.0
  45. include $(INCLUDE_DIR)/package.mk
  46. include $(INCLUDE_DIR)/host-build.mk
  47. define Package/frr-libfrr/config
  48. source "$(SOURCE)/Config.in"
  49. endef
  50. define Package/frr/Default
  51. SECTION:=net
  52. CATEGORY:=Network
  53. SUBMENU:=Routing and Redirection
  54. URL:=https://www.frrouting.org/
  55. DEPENDS:=frr
  56. endef
  57. define Package/frr
  58. $(call Package/frr/Default)
  59. DEPENDS:=+librt
  60. TITLE:=The FRRouting (FRR) Software Routing Suite
  61. MENU:=1
  62. endef
  63. define Package/frr/description
  64. FRRouting is free software that implements and manages various IPv4 and IPv6
  65. routing protocols.
  66. Currently FRRouting supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1, RIPv2, RIPng,
  67. IS-IS, PIM-SM/MSDP, LDP, VRRP and Babel as well as very early support for EIGRP and
  68. NHRP.
  69. endef
  70. define Package/frr-libfrr
  71. $(call Package/frr/Default)
  72. TITLE:=zebra library
  73. DEPENDS+=+librt +libjson-c +libyang +FRR_OPENSSL:libopenssl
  74. CONFLICTS:=quagga-libzebra
  75. endef
  76. define Package/frr-vtysh
  77. $(call Package/frr/Default)
  78. DEPENDS+=+frr-libfrr +libreadline +libncurses +more
  79. TITLE:=integrated shell for frr routing software
  80. CONFLICTS:=quagga-vtysh
  81. endef
  82. define Package/frr-watchfrr
  83. $(call Package/frr/Default)
  84. TITLE:=frr watchdog
  85. DEPENDS+=+frr-libfrr
  86. DEFAULT:=y if PACKAGE_frr
  87. endef
  88. define Package/frr-zebra
  89. $(call Package/frr/Default)
  90. TITLE:=Zebra daemon
  91. DEPENDS+=+frr-libfrr
  92. DEFAULT:=y if PACKAGE_frr
  93. CONFLICTS:=quagga-zebra
  94. endef
  95. ##Migrate from quagga
  96. ##should test file exists and link in frr folder
  97. #define Package/frr/postinst
  98. ##!/bin/sh
  99. #if [ -f /etc/quagga/ospfd.conf ]; then
  100. # ls to /etc/frr
  101. # sed enable ospfd daemon
  102. #fi
  103. #exit 0
  104. #endef
  105. define BuildDaemon
  106. define Package/frr-$(1)
  107. $$(call Package/frr/Default)
  108. TITLE:= $(1) routing engine
  109. DEPENDS+=frr-libfrr $(2)
  110. endef
  111. define Package/frr-$(1)/install
  112. $(INSTALL_DIR) $$(1)/usr/sbin
  113. if [ "$(1)" != "fabricd" ]; then \
  114. $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/$(1)/.libs/$(1) $$(1)/usr/sbin/; \
  115. else \
  116. $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/isisd/.libs/$(1) $$(1)/usr/sbin/; fi
  117. if [ "$(1)" == "nhrpd" ]; then \
  118. $(INSTALL_DIR) $$(1)/usr/lib; \
  119. $(CP) $(PKG_BUILD_DIR)/build/lib/.libs/libfrrcares.so* $$(1)/usr/lib/; fi
  120. endef
  121. $$(eval $$(call BuildPackage,frr-$(1)))
  122. endef
  123. define Package/frr-libfrr/conffiles
  124. /etc/frr/
  125. endef
  126. define Build/Prepare
  127. $(Build/Prepare/Default)
  128. mkdir -p $(PKG_BUILD_DIR)/build
  129. endef
  130. define Build/Configure
  131. ( cd $(PKG_BUILD_DIR)/build/ ; \
  132. ../configure \
  133. --host="$(GNU_TARGET_NAME)" \
  134. --build="$(GNU_HOST_NAME)" \
  135. CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
  136. CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
  137. LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
  138. HOST_CFLAGS="$(HOST_CFLAGS)" \
  139. HOST_LDFLAGS="$(HOST_LDFLAGS)" \
  140. BUILD_CPPFLAGS="$(TARGET_CPPLAGS)" \
  141. BUILD_CFLAGS="$(TARGET_CFLAGS)" \
  142. BUILD_LDFLAGS="$(TARGET_LDFLAGS)" \
  143. --prefix=/usr \
  144. --enable-shared \
  145. --disable-static \
  146. --enable-user=network \
  147. --enable-group=network \
  148. --enable-multipath=16 \
  149. --disable-capabilities \
  150. --disable-ospfclient \
  151. --disable-doc \
  152. --disable-backtrace \
  153. --localstatedir=/var/run/frr \
  154. --sysconfdir=/etc/frr/ \
  155. $(if $(CONFIG_FRR_OPENSSL),--with-crypto=openssl,) \
  156. $(foreach m,$(PKG_DAEMON_AVAILABLE), \
  157. $(if $(CONFIG_PACKAGE_frr-$(m)),--enable-$(m),--disable-$(m)) ) \
  158. )
  159. endef
  160. # just speed it up
  161. NUM_CORES ?= $(shell grep -c "vendor_id" /proc/cpuinfo)
  162. define Build/Compile
  163. $(MAKE) -C $(PKG_BUILD_DIR)/build -j$(NUM_CORES)
  164. endef
  165. define Package/frr/install
  166. $(INSTALL_DIR) $(1)/usr/sbin
  167. $(INSTALL_BIN) ./files/frrcommon.sh $(1)/usr/sbin/
  168. $(INSTALL_DIR) $(1)/etc/init.d
  169. $(INSTALL_BIN) ./files/frr $(1)/etc/init.d/
  170. endef
  171. define Package/frr-watchfrr/install
  172. $(INSTALL_DIR) $(1)/usr/sbin
  173. $(INSTALL_BIN) ./files/watchfrr.sh $(1)/usr/sbin/
  174. $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/watchfrr/.libs/watchfrr $(1)/usr/sbin/
  175. endef
  176. define Package/frr-zebra/install
  177. $(INSTALL_DIR) $(1)/usr/sbin
  178. $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/zebra/.libs/zebra $(1)/usr/sbin/
  179. endef
  180. define Package/frr-libfrr/install
  181. $(INSTALL_DIR) $(1)/usr/lib
  182. $(CP) $(PKG_BUILD_DIR)/build/lib/.libs/libfrr.so* $(1)/usr/lib/
  183. $(INSTALL_DIR) $(1)/etc/frr
  184. chmod 0750 $(1)/etc/frr
  185. $(INSTALL_CONF) ./files/{frr.conf,daemons} $(1)/etc/frr/
  186. endef
  187. $(eval $(call HostBuild))
  188. $(eval $(call BuildPackage,frr))
  189. $(eval $(call BuildPackage,frr-libfrr))
  190. $(eval $(call BuildPackage,frr-watchfrr))
  191. $(eval $(call BuildPackage,frr-zebra))
  192. $(eval $(call BuildPackage,frr-vtysh))
  193. $(eval $(call BuildDaemon,babeld,))
  194. $(eval $(call BuildDaemon,bfdd,))
  195. $(eval $(call BuildDaemon,bgpd,))
  196. $(eval $(call BuildDaemon,eigrpd,))
  197. $(eval $(call BuildDaemon,fabricd,))
  198. $(eval $(call BuildDaemon,isisd,))
  199. $(eval $(call BuildDaemon,ldpd,))
  200. $(eval $(call BuildDaemon,nhrpd,+libcares))
  201. $(eval $(call BuildDaemon,ospfd,))
  202. $(eval $(call BuildDaemon,ospf6d,@IPV6))
  203. $(eval $(call BuildDaemon,pbrd,))
  204. $(eval $(call BuildDaemon,pimd,))
  205. $(eval $(call BuildDaemon,ripd,))
  206. $(eval $(call BuildDaemon,ripngd,@IPV6))
  207. $(eval $(call BuildDaemon,staticd,))
  208. $(eval $(call BuildDaemon,vrrpd,))