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.

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