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.

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