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.

248 lines
6.4 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.1
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_DATE:=2021-03-25
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
  13. PKG_SOURCE_VERSION:=18f209926fb659790926b82dd4e30727311d22aa
  14. PKG_SOURCE_URL:=https://codeload.github.com/FRRouting/frr/tar.gz/$(PKG_SOURCE_VERSION)?
  15. PKG_HASH:=a2e21ea5f5c73afda521280c7b1bab3e6734f78517e7cf1b86cbbc0e5f9856cc
  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_CPPFLAGS += -I$(STAGING_DIR_HOST)/include/libelf
  140. HOST_CONFIGURE_ARGS+= \
  141. --enable-clippy-only
  142. define Host/Install
  143. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
  144. $(INSTALL_BIN) $(HOST_BUILD_DIR)/lib/clippy $(STAGING_DIR_HOSTPKG)/bin/
  145. endef
  146. CONFIGURE_ARGS+= \
  147. --with-clippy=$(STAGING_DIR_HOSTPKG)/bin/clippy \
  148. --prefix=/usr \
  149. --enable-shared \
  150. --disable-static \
  151. --disable-pathd \
  152. --enable-user=network \
  153. --enable-group=network \
  154. --disable-ospfclient \
  155. --disable-doc \
  156. --disable-backtrace \
  157. --localstatedir=/var/run/frr \
  158. --sysconfdir=/etc/frr/ \
  159. $(if $(CONFIG_FRR_OPENSSL),--with-crypto=openssl,) \
  160. $(if $(CONFIG_FRR_SNMP),--enable-snmp,) \
  161. $(foreach m,$(PKG_DAEMON_AVAILABLE), \
  162. $(call autoconf_bool,CONFIG_PACKAGE_frr-$(m),$(m)) ) \
  163. $(call autoconf_bool,CONFIG_PACKAGE_frr-vtysh,vtysh) \
  164. $(call autoconf_bool,CONFIG_PACKAGE_frr-libfrr,zebra)
  165. define Package/frr/install
  166. $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
  167. $(INSTALL_BIN) ./files/frrcommon.sh $(1)/usr/sbin/
  168. $(INSTALL_BIN) ./files/frr $(1)/etc/init.d/
  169. endef
  170. define Package/frr-watchfrr/install
  171. $(INSTALL_DIR) $(1)/usr/sbin
  172. $(INSTALL_BIN) ./files/watchfrr.sh $(1)/usr/sbin/
  173. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchfrr $(1)/usr/sbin/
  174. endef
  175. define Package/frr-zebra/install
  176. $(INSTALL_DIR) $(1)/usr/sbin
  177. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
  178. endef
  179. define Package/frr-libfrr/install
  180. $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/frr
  181. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfrr.so* $(1)/usr/lib/
  182. $(if $(CONFIG_FRR_SNMP),$(CP) $(PKG_INSTALL_DIR)/usr/lib/libfrrsnmp.so* $(1)/usr/lib/,)
  183. $(INSTALL_CONF) ./files/{frr.conf,daemons} $(1)/etc/frr/
  184. endef
  185. define Package/frr-vtysh/install
  186. $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/frr
  187. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
  188. $(INSTALL_CONF) ./files/vtysh.conf $(1)/etc/frr/
  189. endef
  190. $(eval $(call HostBuild))
  191. $(eval $(call BuildPackage,frr))
  192. $(eval $(call BuildPackage,frr-libfrr))
  193. $(eval $(call BuildPackage,frr-watchfrr))
  194. $(eval $(call BuildPackage,frr-zebra))
  195. $(eval $(call BuildPackage,frr-vtysh))
  196. $(eval $(call BuildDaemon,babeld,))
  197. $(eval $(call BuildDaemon,bfdd,))
  198. $(eval $(call BuildDaemon,bgpd,))
  199. $(eval $(call BuildDaemon,eigrpd,))
  200. $(eval $(call BuildDaemon,fabricd,))
  201. $(eval $(call BuildDaemon,isisd,))
  202. $(eval $(call BuildDaemon,ldpd,))
  203. $(eval $(call BuildDaemon,nhrpd,+libcares))
  204. $(eval $(call BuildDaemon,ospfd,))
  205. $(eval $(call BuildDaemon,ospf6d,@IPV6))
  206. $(eval $(call BuildDaemon,pbrd,))
  207. $(eval $(call BuildDaemon,pimd,))
  208. $(eval $(call BuildDaemon,ripd,))
  209. $(eval $(call BuildDaemon,ripngd,@IPV6))
  210. $(eval $(call BuildDaemon,staticd,))
  211. $(eval $(call BuildDaemon,vrrpd,))