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