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.

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