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.

246 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:=2
  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 +libatomic +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. TARGET_LDFLAGS += -latomic
  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. $(call autoconf_bool,CONFIG_PACKAGE_frr-$(m),$(m)) ) \
  158. $(call autoconf_bool,CONFIG_PACKAGE_frr-vtysh,vtysh) \
  159. $(call autoconf_bool,CONFIG_PACKAGE_frr-libfrr,zebra) \
  160. )
  161. endef
  162. # just speed it up
  163. NUM_CORES ?= $(shell grep -c "vendor_id" /proc/cpuinfo)
  164. define Build/Compile
  165. $(MAKE) -C $(PKG_BUILD_DIR)/build -j$(NUM_CORES)
  166. endef
  167. define Package/frr/install
  168. $(INSTALL_DIR) $(1)/usr/sbin
  169. $(INSTALL_BIN) ./files/frrcommon.sh $(1)/usr/sbin/
  170. $(INSTALL_DIR) $(1)/etc/init.d
  171. $(INSTALL_BIN) ./files/frr $(1)/etc/init.d/
  172. endef
  173. define Package/frr-watchfrr/install
  174. $(INSTALL_DIR) $(1)/usr/sbin
  175. $(INSTALL_BIN) ./files/watchfrr.sh $(1)/usr/sbin/
  176. $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/watchfrr/.libs/watchfrr $(1)/usr/sbin/
  177. endef
  178. define Package/frr-zebra/install
  179. $(INSTALL_DIR) $(1)/usr/sbin
  180. $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/zebra/.libs/zebra $(1)/usr/sbin/
  181. endef
  182. define Package/frr-libfrr/install
  183. $(INSTALL_DIR) $(1)/usr/lib
  184. $(CP) $(PKG_BUILD_DIR)/build/lib/.libs/libfrr.so* $(1)/usr/lib/
  185. $(INSTALL_DIR) $(1)/etc/frr
  186. chmod 0750 $(1)/etc/frr
  187. $(INSTALL_CONF) ./files/{frr.conf,daemons} $(1)/etc/frr/
  188. endef
  189. define Package/frr-vtysh/install
  190. $(INSTALL_DIR) $(1)/usr/bin
  191. $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/vtysh/.libs/vtysh $(1)/usr/bin/
  192. endef
  193. $(eval $(call HostBuild))
  194. $(eval $(call BuildPackage,frr))
  195. $(eval $(call BuildPackage,frr-libfrr))
  196. $(eval $(call BuildPackage,frr-watchfrr))
  197. $(eval $(call BuildPackage,frr-zebra))
  198. $(eval $(call BuildPackage,frr-vtysh))
  199. $(eval $(call BuildDaemon,babeld,))
  200. $(eval $(call BuildDaemon,bfdd,))
  201. $(eval $(call BuildDaemon,bgpd,))
  202. $(eval $(call BuildDaemon,eigrpd,))
  203. $(eval $(call BuildDaemon,fabricd,))
  204. $(eval $(call BuildDaemon,isisd,))
  205. $(eval $(call BuildDaemon,ldpd,))
  206. $(eval $(call BuildDaemon,nhrpd,+libcares))
  207. $(eval $(call BuildDaemon,ospfd,))
  208. $(eval $(call BuildDaemon,ospf6d,@IPV6))
  209. $(eval $(call BuildDaemon,pbrd,))
  210. $(eval $(call BuildDaemon,pimd,))
  211. $(eval $(call BuildDaemon,ripd,))
  212. $(eval $(call BuildDaemon,ripngd,@IPV6))
  213. $(eval $(call BuildDaemon,staticd,))
  214. $(eval $(call BuildDaemon,vrrpd,))