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.

245 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.2.1
  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:=774585564dc00e67c4eb51521cb2a8e584031364916514860227af07b638a408
  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. $(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,))